Skip to contentSkip to conversation

acpi: set fake hid

PATCH In review Zhang Rui 2 participants 5 messages Sep 22, 2006 – Sep 25, 2006

Subsystems (3)
lore
Share & tools
lore

Zhang Rui

author
#0 lore raw

PATCH 12/12 acpi: set fake hid

Set fake hid for non-PNPID ACPI devices.

We do this mainly because:
1. hid is used to match ACPI devices and drivers.
.match method which is incompatible to driver model can be deleted from acpi_driver.ops then.
2. As the .uevent method mark ACPI drivers by PNPID,
fake hid is set to non-PNPID devices so that udev script can load the right ACPI driver by looking for "HWID = " or "COMPTID = ".

---
 drivers/acpi/pci_bind.c     |   20 +-------------
 drivers/acpi/scan.c         |   59 ++++++++++++++++++++++++++++++++++++++++++--
 drivers/acpi/video.c        |   37 ---------------------------
 include/acpi/acpi_bus.h     |    6 ----
 include/acpi/acpi_drivers.h |    2 +
 5 files changed, 63 insertions(+), 61 deletions(-)
drivers/acpi/pci_bind.c +2 -18
Index: linux-2.6.18/drivers/acpi/pci_bind.c
===================================================================
@@ -379,32 +379,16 @@ acpi_pci_bind_root(struct acpi_device *d
 
 static int acpi_pci_bridge_add(struct acpi_device *device);
 static int acpi_pci_bridge_remove(struct acpi_device *device, int type);
-static int acpi_pci_bridge_match(struct acpi_device *device,
-       struct acpi_driver *driver);
+
 static struct acpi_driver acpi_pci_bridge_driver = {
        .name = ACPI_PCI_BRIDGE_DRIVER_NAME,
+	.ids = ACPI_PCI_BRIDGE_HID,
        .ops = {
                .add = acpi_pci_bridge_add,
                .remove = acpi_pci_bridge_remove,
-               .match = acpi_pci_bridge_match,
        },
 };
 
-static int acpi_pci_bridge_match(struct acpi_device *device,
-       struct acpi_driver *driver)
-{
-       acpi_status status;
-       acpi_handle handle;
-
-       /* pci bridge has _PRT but isn't PNP0A03 */
-       status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
-       if (ACPI_FAILURE(status))
-               return -ENODEV;
-       if (!acpi_match_ids(device, "PNP0A03"))
-               return -ENODEV;
-       return 0;
-}
-
 static int acpi_pci_bridge_add(struct acpi_device *device)
 {
        return acpi_pci_bind(device);
drivers/acpi/scan.c +57 -2

77 lines not on this page · raw message

drivers/acpi/video.c +1 -36
Index: linux-2.6.18/drivers/acpi/video.c
===================================================================
@@ -65,16 +65,14 @@ MODULE_LICENSE("GPL");
 
 static int acpi_video_bus_add(struct acpi_device *device);
 static int acpi_video_bus_remove(struct acpi_device *device, int type);
-static int acpi_video_bus_match(struct acpi_device *device,
-				struct acpi_driver *driver);
 
 static struct acpi_driver acpi_video_bus = {
 	.name = ACPI_VIDEO_DRIVER_NAME,
 	.class = ACPI_VIDEO_CLASS,
+	.ids = ACPI_VIDEO_HID,
 	.ops = {
 		.add = acpi_video_bus_add,
 		.remove = acpi_video_bus_remove,
-		.match = acpi_video_bus_match,
 		},
 };
 
@@ -1774,39 +1772,6 @@ static int acpi_video_bus_remove(struct 
 	return 0;
 }
 
-static int
-acpi_video_bus_match(struct acpi_device *device, struct acpi_driver *driver)
-{
-	acpi_handle h_dummy1;
-	acpi_handle h_dummy2;
-	acpi_handle h_dummy3;
-
-
-	if (!device || !driver)
-		return -EINVAL;
-
-	/* Since there is no HID, CID for ACPI Video drivers, we have
-	 * to check well known required nodes for each feature we support.
-	 */
-
-	/* Does this device able to support video switching ? */
-	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) &&
-	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2)))
-		return 0;
-
-	/* Does this device able to retrieve a video ROM ? */
-	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1)))
-		return 0;
-
-	/* Does this device able to configure which video head to be POSTed ? */
-	if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) &&
-	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) &&
-	    ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3)))
-		return 0;
-
-	return -ENODEV;
-}
-
 static int __init acpi_video_init(void)
 {
 	int result = 0;
include/acpi/acpi_drivers.h +2 -0
Index: linux-2.6.18/include/acpi/acpi_drivers.h
===================================================================
@@ -43,6 +43,8 @@
 #define ACPI_BUTTON_HID_POWERF		"ACPI_FPB"
 #define ACPI_BUTTON_HID_SLEEPF		"ACPI_FSB"
 
+#define ACPI_VIDEO_HID			"ACPI_VID"
+#define ACPI_PCI_BRIDGE_HID		"ACPI_PCI"
 /* --------------------------------------------------------------------------
                                        PCI
    -------------------------------------------------------------------------- */
include/acpi/acpi_bus.h +1 -5
Index: linux-2.6.18/include/acpi/acpi_bus.h
===================================================================
@@ -97,8 +97,6 @@ typedef int (*acpi_op_resume) (struct ac
 typedef int (*acpi_op_scan) (struct acpi_device * device);
 typedef int (*acpi_op_bind) (struct acpi_device * device);
 typedef int (*acpi_op_unbind) (struct acpi_device * device);
-typedef int (*acpi_op_match) (struct acpi_device * device,
-			      struct acpi_driver * driver);
 typedef int (*acpi_op_shutdown) (struct acpi_device * device);
 
 struct acpi_bus_ops {
@@ -112,9 +110,8 @@ struct acpi_bus_ops {
 	u32 acpi_op_scan:1;
 	u32 acpi_op_bind:1;
 	u32 acpi_op_unbind:1;
-	u32 acpi_op_match:1;
 	u32 acpi_op_shutdown:1;
-	u32 reserved:20;
+	u32 reserved:21;
 };
 
 struct acpi_device_ops {
@@ -128,7 +125,6 @@ struct acpi_device_ops {
 	acpi_op_scan scan;
 	acpi_op_bind bind;
 	acpi_op_unbind unbind;
-	acpi_op_match match;
 	acpi_op_shutdown shutdown;
 };
 
#1 lore raw

+static int acpi_pci_bridge_match(struct acpi_device *device) +{
+ acpi_status status;
+ acpi_handle handle;
+

+       /* pci bridge has _PRT but isn't PNP0A03 */
+       status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
+       if (ACPI_FAILURE(status))

+ return -ENODEV;
+ if (!acpi_match_ids(device, "PNP0A03"))
+ return -ENODEV;
+ return 0;
+}
+

You seem to handle pci-pci bridge here incorrectly (returns -ENODEV from match to PNP0A03)

--Mika

author
#2 lore raw
Quoted 16 lines · Mika Penttilä
drivers/acpi/scan.c +14 -0
+static int acpi_pci_bridge_match(struct acpi_device *device)
+{
+       acpi_status status;
+       acpi_handle handle;
+
+       /* pci bridge has _PRT but isn't PNP0A03 */
+       status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
+       if (ACPI_FAILURE(status))
+               return -ENODEV;
+       if (!acpi_match_ids(device, "PNP0A03"))
+               return -ENODEV;
+       return 0;
+}
+
Quoted 2 lines

You seem to handle pci-pci bridge here incorrectly (returns -ENODEV from match to PNP0A03)

Is there any pci-pci bridge that has a _HID of "PNP0A03"?

thanks,
--Rui
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 18 lines · Zhang Rui
Quoted 16 lines · Mika Penttilä
drivers/acpi/scan.c +14 -0
+static int acpi_pci_bridge_match(struct acpi_device *device)
+{
+       acpi_status status;
+       acpi_handle handle;
+
+       /* pci bridge has _PRT but isn't PNP0A03 */
+       status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
+       if (ACPI_FAILURE(status))
+               return -ENODEV;
+       if (!acpi_match_ids(device, "PNP0A03"))
+               return -ENODEV;
+       return 0;
+}
+
Quoted 9 lines
Quoted 3 lines

You seem to handle pci-pci bridge here incorrectly (returns -ENODEV from match to PNP0A03)

Is there any pci-pci bridge that has a _HID of "PNP0A03"?

thanks,
--Rui

Don't know, but isn't the purpose here for acpi_pci_bridge_match() to match pci-pci bridges also? They won't just because they aren't PNP0A03.

--Mika

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

author
#4 lore raw
Quoted 14 lines · Mika Penttilä
Quoted 13 lines · Zhang Rui

drivers/acpi/scan.c static void acpi_device_get_busid(struct · line 750

Quoted 11 lines · Mika Penttilä
drivers/acpi/scan.c +11 -0
+static int acpi_pci_bridge_match(struct acpi_device *device)
+{
+       acpi_status status;
+       acpi_handle handle;
+
+       /* pci bridge has _PRT but isn't PNP0A03 */
+       status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
+       if (ACPI_FAILURE(status))
+               return -ENODEV;
+       if (!acpi_match_ids(device, "PNP0A03"))
+               return -ENODEV;

acpi_pci_bridge_match will return 0, if we found a pci-pci bridge. Because it has a PRT table and its HID is _NOT_ "PNP0A03".

Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
drivers/acpi/scan.c +3 -0
+       return 0;
+}
+

You seem to handle pci-pci bridge here incorrectly (returns -ENODEV from match to PNP0A03)

Is there any pci-pci bridge that has a _HID of "PNP0A03"?

Quoted 8 lines
Quoted 4 lines

thanks,
--Rui

Don't know, but isn't the purpose here for acpi_pci_bridge_match() to match pci-pci bridges also? They won't just because they aren't PNP0A03.

--Mika

According to the ACPI spec, only ACPI PCI Root Bridge has a _HID of "PNP0A03".

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