aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-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++) {