On 21/06/2019 14:56, Bjorn Helgaas wrote:
> +static void hisi_lpc_acpi_remove(struct device *hostdev)
> +{
> + struct acpi_device *adev = ACPI_COMPANION(hostdev);
> + struct acpi_device *child;
> +
> + device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev);
> +
> + list_for_each_entry(child, &adev->children, node)
Hi Bjorn,
> + acpi_device_clear_enumerated(child);
There are only two other non-ACPI core callers of
acpi_device_clear_enumerated() (i2c and spi). That always makes me
wonder if we're getting too deep in ACPI internals.
It's no coincidence that i2c and spi are the only other two non-ACPI
core callers. For getting ACPI support for the hisi-lpc driver, we
modeled the driver to have the same ACPI enumeration method as i2c and
spi hosts. That is, allow the host driver to enumerate the child devices.
You can check drivers/acpi/scan.c::acpi_device_enumeration_by_parent()
for where we make the check on the host and how it is used.
Thanks,
John
> +}
> +
> /*
> * hisi_lpc_acpi_probe - probe children for ACPI FW
> * @hostdev: LPC host device pointer
> @@ -555,8 +566,7 @@ static int hisi_lpc_acpi_probe(struct device *hostdev)
> return 0;
>
> fail:
> - device_for_each_child(hostdev, NULL,
> - hisi_lpc_acpi_remove_subdev);
> + hisi_lpc_acpi_remove(hostdev);
> return ret;