Re: [Lhms-devel] [RFC] Patch [1/2] for acpi_memhotplug.c

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

 



On Thu, 22 Jun 2006 14:20:38 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> I'll try to write a patch.
> 

This is a patch. (against 2.6.17-mm1 but maybe okay to other kernels.)
Could you try this ?
But I'm not sure this is sane way or not..

Regards,
-Kame
=====
Index: linux-2.6.17-mm1/drivers/acpi/scan.c
===================================================================
--- linux-2.6.17-mm1.orig/drivers/acpi/scan.c
+++ linux-2.6.17-mm1/drivers/acpi/scan.c
@@ -231,6 +231,14 @@ static int acpi_bus_get_power_flags(stru
 	return_VALUE(0);
 }
 
+static int acpi_match_hid(struct acpi_device *device, char *id)
+{
+	if (device->flags.hardware_id)
+		if (strstr(id, device->pnp.hardware_id))
+			return 0;
+	return -ENOENT;
+}
+
 int acpi_match_ids(struct acpi_device *device, char *ids)
 {
 	if (device->flags.hardware_id)
@@ -476,6 +484,14 @@ acpi_bus_match(struct acpi_device *devic
 	return acpi_match_ids(device, driver->ids);
 }
 
+static int
+acpi_bus_hid_match(struct acpi_device *device, struct acpi_driver *driver)
+{
+	if (driver && driver->ops.match)
+		return driver->ops.match(device, driver);
+	return acpi_match_hid(device, driver->ids);
+}
+
 /**
  * acpi_bus_driver_init - add a device to a driver
  * @device: the device to add and initialize
@@ -647,8 +663,24 @@ static int acpi_bus_find_driver(struct a
 	struct list_head *node, *next;
 
 	ACPI_FUNCTION_TRACE("acpi_bus_find_driver");
-
 	spin_lock(&acpi_device_lock);
+
+	/* At first, find driver for HID */
+	list_for_each_safe(node, next, &acpi_bus_drivers) {
+		struct acpi_driver *driver =
+		    container_of(node, struct acpi_driver, node);
+
+		atomic_inc(&driver->references);
+		spin_unlock(&acpi_device_lock);
+		if (!acpi_bus_hid_match(device, driver)) {
+			result = acpi_bus_driver_init(device, driver);
+			if (!result)
+				goto Done;
+		}
+		atomic_dec(&driver->references);
+		spin_lock(&acpi_device_lock);
+	}
+	/* find driver for all IDs */
 	list_for_each_safe(node, next, &acpi_bus_drivers) {
 		struct acpi_driver *driver =
 		    container_of(node, struct acpi_driver, node);

-
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