[patch 1/2] acpi: driverregistration again can report ENODEV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Frank Seidel <fseidel@xxxxxxx>

Let acpi_bus_register_driver report -ENODEV if
there was no driver attached to a device.

Signed-off-by: Frank Seidel <fseidel@xxxxxxx>
---
 drivers/acpi/scan.c |    8 ++++++++
 1 files changed, 8 insertions(+)

Index: linux-2.6/drivers/acpi/scan.c
===================================================================
--- linux-2.6.orig/drivers/acpi/scan.c
+++ linux-2.6/drivers/acpi/scan.c
@@ -596,15 +596,23 @@ static void acpi_driver_detach(struct ac
  */
 int acpi_bus_register_driver(struct acpi_driver *driver)
 {
+	int count;
 
 	if (acpi_disabled)
 		return -ENODEV;
 
+	count = atomic_read(&driver->references);
 	spin_lock(&acpi_device_lock);
 	list_add_tail(&driver->node, &acpi_bus_drivers);
 	spin_unlock(&acpi_device_lock);
 	acpi_driver_attach(driver);
 
+	/* Return error if there were no devices this
+	 * driver was additionally attached to.
+	 */
+	if (atomic_read(&driver->references) == count)
+		return -ENODEV;
+
 	return 0;
 }
 

--
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux