aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2008-03-20 04:40:32 -0400
committerLen Brown <len.brown@intel.com>2008-03-25 22:48:37 -0400
commit5c9fcb5deef4d3a49798d76c48b726d2e3c7df72 (patch)
tree88f982727fab5e76f6acee2df9657e9b9cbf991b
parenta4083c9271e0a697278e089f2c0b9a95363ada0a (diff)
ACPI: fix a regression of ACPI device driver autoloading
commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 sets the cid of ACPI video/dock/bay device and leaves the hid empty. As a result, "modalias" should export the cid for devices which don't have a hid. ACPI Video driver is not autoloaded with commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 applied. "cat /sys/.../device:03(acpi video bus)/modalias" shows nothing. ACPI Video driver is autoloaded after revert that commit. "cat /sys/.../LNXVIDEO:0x/modalias" shows "acpi:LNXVIDEO:" ACPI Video driver is autoloaded with commit 3620f2f2f39e7870cf1a4fb2e34063a142f28716 and this patch applied. "cat /sys/.../device:03(acpi video bus)/modalias" shows "acpi:LNXVIDEO:" Signed-off-by: Zhang Rui <rui.zhang@intel.com> Acked-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/scan.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 57570ac47803..e6ce262b5d44 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -39,20 +39,26 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
39 int size) 39 int size)
40{ 40{
41 int len; 41 int len;
42 int count;
42 43
43 if (!acpi_dev->flags.hardware_id) 44 if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids)
44 return -ENODEV; 45 return -ENODEV;
45 46
46 len = snprintf(modalias, size, "acpi:%s:", 47 len = snprintf(modalias, size, "acpi:");
47 acpi_dev->pnp.hardware_id);
48 if (len < 0 || len >= size)
49 return -EINVAL;
50 size -= len; 48 size -= len;
51 49
50 if (acpi_dev->flags.hardware_id) {
51 count = snprintf(&modalias[len], size, "%s:",
52 acpi_dev->pnp.hardware_id);
53 if (count < 0 || count >= size)
54 return -EINVAL;
55 len += count;
56 size -= count;
57 }
58
52 if (acpi_dev->flags.compatible_ids) { 59 if (acpi_dev->flags.compatible_ids) {
53 struct acpi_compatible_id_list *cid_list; 60 struct acpi_compatible_id_list *cid_list;
54 int i; 61 int i;
55 int count;
56 62
57 cid_list = acpi_dev->pnp.cid_list; 63 cid_list = acpi_dev->pnp.cid_list;
58 for (i = 0; i < cid_list->count; i++) { 64 for (i = 0; i < cid_list->count; i++) {