diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-11-06 19:41:01 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-11-06 19:41:01 -0500 |
commit | 6931007cc90ba94b3c2b29179d0a7cde194dabe8 (patch) | |
tree | f60e1a83e7116eb678de61d511c17e62a45d8f82 /drivers/acpi | |
parent | 71bba8fafac8975dbb684df4098d2dd6baac1fda (diff) |
ACPI / scan: Start matching drivers after trying scan handlers
ACPI scan handlers should always be attached to struct acpi_device
objects before any ACPI drivers, but there is a window during which
a driver may be attached to a struct acpi_device before checking if
there is a matching scan handler. Namely, that will happen if an
ACPI driver module is loaded during acpi_bus_scan() right after
the first namespace walk is complete and before the given device
is processed by the second namespace walk.
To prevent that from happening, set the match_driver flags of
struct acpi_device objects right before running device_attach()
for them in acpi_bus_device_attach().
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/scan.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index fbdb82e70d10..4d377a22622a 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1677,7 +1677,6 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | |||
1677 | 1677 | ||
1678 | void acpi_device_add_finalize(struct acpi_device *device) | 1678 | void acpi_device_add_finalize(struct acpi_device *device) |
1679 | { | 1679 | { |
1680 | device->flags.match_driver = true; | ||
1681 | dev_set_uevent_suppress(&device->dev, false); | 1680 | dev_set_uevent_suppress(&device->dev, false); |
1682 | kobject_uevent(&device->dev.kobj, KOBJ_ADD); | 1681 | kobject_uevent(&device->dev.kobj, KOBJ_ADD); |
1683 | } | 1682 | } |
@@ -1916,8 +1915,12 @@ static acpi_status acpi_bus_device_attach(acpi_handle handle, u32 lvl_not_used, | |||
1916 | return AE_OK; | 1915 | return AE_OK; |
1917 | 1916 | ||
1918 | ret = acpi_scan_attach_handler(device); | 1917 | ret = acpi_scan_attach_handler(device); |
1919 | if (ret) | 1918 | if (ret < 0) |
1920 | return ret > 0 ? AE_OK : AE_CTRL_DEPTH; | 1919 | return AE_CTRL_DEPTH; |
1920 | |||
1921 | device->flags.match_driver = true; | ||
1922 | if (ret > 0) | ||
1923 | return AE_OK; | ||
1921 | 1924 | ||
1922 | ret = device_attach(&device->dev); | 1925 | ret = device_attach(&device->dev); |
1923 | return ret >= 0 ? AE_OK : AE_CTRL_DEPTH; | 1926 | return ret >= 0 ? AE_OK : AE_CTRL_DEPTH; |