aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:33:52 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:16 -0400
commit772defc6292bae8b6db298476d1dabd22a99492b (patch)
treeb973807f7f65f6d59e8a273ff80ab3d312e71dc3 /drivers/pnp/pnpacpi
parent1692b27bf37826f85f9c12f8468848885643532a (diff)
PNP: change pnp_add_id() to allocate its own pnp_id structures
This moves some of the pnp_id knowledge out of the backends and into the PNP core. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-By: Rene Herman <rene.herman@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/core.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 4807d76f8a04..86aea1ebfee7 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -73,18 +73,6 @@ static int __init ispnpidacpi(char *id)
73 return 1; 73 return 1;
74} 74}
75 75
76static void __init pnpidacpi_to_pnpid(char *id, char *str)
77{
78 str[0] = id[0];
79 str[1] = id[1];
80 str[2] = id[2];
81 str[3] = tolower(id[3]);
82 str[4] = tolower(id[4]);
83 str[5] = tolower(id[5]);
84 str[6] = tolower(id[6]);
85 str[7] = '\0';
86}
87
88static int pnpacpi_get_resources(struct pnp_dev *dev, 76static int pnpacpi_get_resources(struct pnp_dev *dev,
89 struct pnp_resource_table *res) 77 struct pnp_resource_table *res)
90{ 78{
@@ -201,12 +189,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
201 189
202 dev->number = num; 190 dev->number = num;
203 191
204 /* set the initial values for the PnP device */ 192 dev_id = pnp_add_id(dev, acpi_device_hid(device));
205 dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
206 if (!dev_id) 193 if (!dev_id)
207 goto err; 194 goto err;
208 pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id);
209 pnp_add_id(dev_id, dev);
210 195
211 if (dev->active) { 196 if (dev->active) {
212 /* parse allocated resource */ 197 /* parse allocated resource */
@@ -227,7 +212,6 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
227 } 212 }
228 } 213 }
229 214
230 /* parse compatible ids */
231 if (device->flags.compatible_ids) { 215 if (device->flags.compatible_ids) {
232 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; 216 struct acpi_compatible_id_list *cid_list = device->pnp.cid_list;
233 int i; 217 int i;
@@ -235,12 +219,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
235 for (i = 0; i < cid_list->count; i++) { 219 for (i = 0; i < cid_list->count; i++) {
236 if (!ispnpidacpi(cid_list->id[i].value)) 220 if (!ispnpidacpi(cid_list->id[i].value))
237 continue; 221 continue;
238 dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 222 pnp_add_id(dev, cid_list->id[i].value);
239 if (!dev_id)
240 continue;
241
242 pnpidacpi_to_pnpid(cid_list->id[i].value, dev_id->id);
243 pnp_add_id(dev_id, dev);
244 } 223 }
245 } 224 }
246 225