Skip to content

Commit

Permalink
ACPI: fix a regression of ACPI device driver autoloading
Browse files Browse the repository at this point in the history
commit 3620f2f 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 3620f2f 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
3620f2f 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>
  • Loading branch information
Zhang Rui authored and Len Brown committed Mar 26, 2008
1 parent a4083c9 commit 5c9fcb5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,26 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
int size)
{
int len;
int count;

if (!acpi_dev->flags.hardware_id)
if (!acpi_dev->flags.hardware_id && !acpi_dev->flags.compatible_ids)
return -ENODEV;

len = snprintf(modalias, size, "acpi:%s:",
acpi_dev->pnp.hardware_id);
if (len < 0 || len >= size)
return -EINVAL;
len = snprintf(modalias, size, "acpi:");
size -= len;

if (acpi_dev->flags.hardware_id) {
count = snprintf(&modalias[len], size, "%s:",
acpi_dev->pnp.hardware_id);
if (count < 0 || count >= size)
return -EINVAL;
len += count;
size -= count;
}

if (acpi_dev->flags.compatible_ids) {
struct acpi_compatible_id_list *cid_list;
int i;
int count;

cid_list = acpi_dev->pnp.cid_list;
for (i = 0; i < cid_list->count; i++) {
Expand Down

0 comments on commit 5c9fcb5

Please sign in to comment.