Messages in this thread | | | Subject | Re: [RFC PATCH 2/2] HISI LPC: Add PNP device support | From | Andy Shevchenko <> | Date | Fri, 20 Apr 2018 15:50:06 +0300 |
| |
On Fri, 2018-04-20 at 18:07 +0800, John Garry wrote: > Currently the driver creates an per-ACPI device mfd_cell > for child devices. This does not suit devices which are > PNP-compatible, as we expect PNP-compatible devices to > derive PNP devices. > > To add PNP device support, we continue to allow the PNP > scan code to create the PNP device (which have the > enumeration_by_parent flag set), but expect the PNP > scan to defer adding the device to allow the host probe > code to do this. In addition, no longer do we create an > mfd_cell (platform_device) for PNP-compatible devices. > > We take this approach so that host probe code can > translate the IO resources of the PNP device prior > to adding the device.
> + list_for_each_entry(child, &adev->children, node) { > + if (acpi_is_pnp_device(child)) > + continue;
This is good candidate for a separate helper macro
#define for_each_acpi_non_pnp_device(child, adev) \ ...
(see, for example, for_each_pci_bridge() implementation as an example)
> + list_for_each_entry(child, &adev->children, node) {
> + if (!acpi_is_pnp_device(child)) > + continue;
Ditto.
> + /* > + * Prior to adding the device, we need to translate > the > + * resources to logical PIO addresses. > + */ > + list_for_each_entry(pnp_res, &pnp_dev->resources, > list) { > + struct resource *res = &pnp_res->res; > +
> + if (res->flags | IORESOURCE_IO)
What does this mean?
> + hisi_lpc_acpi_xlat_io_res(child, > adev, res); > + }
-- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy
| |