1111#include <linux/delay.h>
1212#include <linux/io.h>
1313#include <linux/logic_pio.h>
14- #include <linux/mfd/core.h>
1514#include <linux/module.h>
1615#include <linux/of.h>
1716#include <linux/of_address.h>
@@ -341,15 +340,6 @@ static const struct logic_pio_host_ops hisi_lpc_ops = {
341340};
342341
343342#ifdef CONFIG_ACPI
344- #define MFD_CHILD_NAME_PREFIX DRV_NAME"-"
345- #define MFD_CHILD_NAME_LEN (ACPI_ID_LEN + sizeof(MFD_CHILD_NAME_PREFIX) - 1)
346-
347- struct hisi_lpc_mfd_cell {
348- struct mfd_cell_acpi_match acpi_match ;
349- char name [MFD_CHILD_NAME_LEN ];
350- char pnpid [ACPI_ID_LEN ];
351- };
352-
353343static int hisi_lpc_acpi_xlat_io_res (struct acpi_device * adev ,
354344 struct acpi_device * host ,
355345 struct resource * res )
@@ -368,7 +358,7 @@ static int hisi_lpc_acpi_xlat_io_res(struct acpi_device *adev,
368358}
369359
370360/*
371- * hisi_lpc_acpi_set_io_res - set the resources for a child's MFD
361+ * hisi_lpc_acpi_set_io_res - set the resources for a child
372362 * @child: the device node to be updated the I/O resource
373363 * @hostdev: the device node associated with host controller
374364 * @res: double pointer to be set to the address of translated resources
@@ -458,69 +448,23 @@ static int hisi_lpc_acpi_set_io_res(struct device *child,
458448 *
459449 * Returns 0 when successful, and a negative value for failure.
460450 *
461- * Scan all child devices and create a per-device MFD with
462- * logical PIO translated IO resources.
463451 */
464452static int hisi_lpc_acpi_probe (struct device * hostdev )
465453{
466454 struct acpi_device * adev = ACPI_COMPANION (hostdev );
467- struct hisi_lpc_mfd_cell * hisi_lpc_mfd_cells ;
468- struct mfd_cell * mfd_cells ;
469455 struct acpi_device * child ;
470- int size , ret , count = 0 , cell_num = 0 ;
471-
472- list_for_each_entry (child , & adev -> children , node )
473- cell_num ++ ;
474-
475- /* allocate the mfd cell and companion ACPI info, one per child */
476- size = sizeof (* mfd_cells ) + sizeof (* hisi_lpc_mfd_cells );
477- mfd_cells = devm_kcalloc (hostdev , cell_num , size , GFP_KERNEL );
478- if (!mfd_cells )
479- return - ENOMEM ;
456+ int ret ;
480457
481- hisi_lpc_mfd_cells = (struct hisi_lpc_mfd_cell * )& mfd_cells [cell_num ];
482458 /* Only consider the children of the host */
483459 list_for_each_entry (child , & adev -> children , node ) {
484- struct mfd_cell * mfd_cell = & mfd_cells [count ];
485- struct hisi_lpc_mfd_cell * hisi_lpc_mfd_cell =
486- & hisi_lpc_mfd_cells [count ];
487- struct mfd_cell_acpi_match * acpi_match =
488- & hisi_lpc_mfd_cell -> acpi_match ;
489- char * name = hisi_lpc_mfd_cell [count ].name ;
490- char * pnpid = hisi_lpc_mfd_cell [count ].pnpid ;
491- struct mfd_cell_acpi_match match = {
492- .pnpid = pnpid ,
493- };
494-
495- /*
496- * For any instances of this host controller (Hip06 and Hip07
497- * are the only chipsets), we would not have multiple slaves
498- * with the same HID. And in any system we would have just one
499- * controller active. So don't worrry about MFD name clashes.
500- */
501- snprintf (name , MFD_CHILD_NAME_LEN , MFD_CHILD_NAME_PREFIX "%s" ,
502- acpi_device_hid (child ));
503- snprintf (pnpid , ACPI_ID_LEN , "%s" , acpi_device_hid (child ));
504-
505- memcpy (acpi_match , & match , sizeof (* acpi_match ));
506- mfd_cell -> name = name ;
507- mfd_cell -> acpi_match = acpi_match ;
508-
509- ret = hisi_lpc_acpi_set_io_res (& child -> dev , & adev -> dev ,
510- & mfd_cell -> resources ,
511- & mfd_cell -> num_resources );
460+ const struct resource * res ;
461+ int num_res ;
462+
463+ ret = hisi_lpc_acpi_set_io_res (& child -> dev , & adev -> dev , & res ,
464+ & num_res );
512465 if (ret ) {
513- dev_warn (& child -> dev , "set resource fail (%d)\n" , ret );
514- return ret ;
466+ dev_warn (hostdev , "set resource fail (%d)\n" , ret );
515467 }
516- count ++ ;
517- }
518-
519- ret = mfd_add_devices (hostdev , PLATFORM_DEVID_NONE ,
520- mfd_cells , cell_num , NULL , 0 , NULL );
521- if (ret ) {
522- dev_err (hostdev , "failed to add mfd cells (%d)\n" , ret );
523- return ret ;
524468 }
525469
526470 return 0 ;
0 commit comments