On 12/10/2012 07:00 AM, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> > > Currently, as soon as an ACPI device node object (struct acpi_device) > is created, the driver core attempts to probe ACPI drivers against > it. That leads to some unpleasant side effects, like the fact that > the boot code path for ACPI namespace scanning is different from the > analogous hot-plug code path (during boot ACPI drivers are not > present when ACPI device node objects are registered, so they are > guaranteed not to be probed, which is not the case during hot-plug). > That, in turn, leads to unnecessary complications in the PCI > enumeration algorithm. > > Reduce the differences between the boot and hot-plug cases by > splitting the ACPI namespace scanning for devices into two passes, > such that struct acpi_device objects are registerd in the first > patch without probing ACPI drivers and the drivers are probed > against them directly in the second pass. This way ACPI drivers > can assume that all of the ACPI device node objects in the given > scope will be registered when their .add() routines run and the > hot-plug case becomes the same as the boot case from their > perspective. > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> > --- > drivers/acpi/scan.c | 96 +++++++++++++++++++++++++++++++++--------------- > include/acpi/acpi_bus.h | 1 > 2 files changed, 68 insertions(+), 29 deletions(-) > > Index: linux/include/acpi/acpi_bus.h > =================================================================== > --- linux.orig/include/acpi/acpi_bus.h > +++ linux/include/acpi/acpi_bus.h > @@ -98,6 +98,7 @@ typedef void (*acpi_op_notify) (struct a > struct acpi_bus_ops { > u32 acpi_op_add:1; > u32 acpi_op_start:1; > + u32 acpi_op_match:1; > }; > > struct acpi_device_ops { > Index: linux/drivers/acpi/scan.c > =================================================================== > --- linux.orig/drivers/acpi/scan.c > +++ linux/drivers/acpi/scan.c > @@ -494,7 +494,8 @@ static int acpi_bus_match(struct device > struct acpi_device *acpi_dev = to_acpi_device(dev); > struct acpi_driver *acpi_drv = to_acpi_driver(drv); > > - return !acpi_match_device_ids(acpi_dev, acpi_drv->ids); > + return acpi_dev->bus_ops.acpi_op_match > + && !acpi_match_device_ids(acpi_dev, acpi_drv->ids); > } Hi Rafael, PCI host bridge hotplug has the same requirement to separate device enumeration from device driver binding. And VFIO has a similar requirement too. Yinghai and I have implemented two different solutions for PCI host bridge hotplug but all rejected by Greg. So it would be great if we could promote a common mechanism to the device core to temporarily disable binding drivers to devices, which could used to support ACPI hotplug, PCI hotplug and VFIO. Regards! Gerry -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html