diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:33:52 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:16 -0400 |
commit | 772defc6292bae8b6db298476d1dabd22a99492b (patch) | |
tree | b973807f7f65f6d59e8a273ff80ab3d312e71dc3 /drivers/pnp/driver.c | |
parent | 1692b27bf37826f85f9c12f8468848885643532a (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/driver.c')
-rw-r--r-- | drivers/pnp/driver.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index e85cbf116db1..d3f869ee1d92 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -226,22 +226,36 @@ void pnp_unregister_driver(struct pnp_driver *drv) | |||
226 | 226 | ||
227 | /** | 227 | /** |
228 | * pnp_add_id - adds an EISA id to the specified device | 228 | * pnp_add_id - adds an EISA id to the specified device |
229 | * @id: pointer to a pnp_id structure | ||
230 | * @dev: pointer to the desired device | 229 | * @dev: pointer to the desired device |
230 | * @id: pointer to an EISA id string | ||
231 | */ | 231 | */ |
232 | int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) | 232 | struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id) |
233 | { | 233 | { |
234 | struct pnp_id *ptr; | 234 | struct pnp_id *dev_id, *ptr; |
235 | 235 | ||
236 | id->next = NULL; | 236 | dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
237 | if (!dev_id) | ||
238 | return NULL; | ||
239 | |||
240 | dev_id->id[0] = id[0]; | ||
241 | dev_id->id[1] = id[1]; | ||
242 | dev_id->id[2] = id[2]; | ||
243 | dev_id->id[3] = tolower(id[3]); | ||
244 | dev_id->id[4] = tolower(id[4]); | ||
245 | dev_id->id[5] = tolower(id[5]); | ||
246 | dev_id->id[6] = tolower(id[6]); | ||
247 | dev_id->id[7] = '\0'; | ||
248 | |||
249 | dev_id->next = NULL; | ||
237 | ptr = dev->id; | 250 | ptr = dev->id; |
238 | while (ptr && ptr->next) | 251 | while (ptr && ptr->next) |
239 | ptr = ptr->next; | 252 | ptr = ptr->next; |
240 | if (ptr) | 253 | if (ptr) |
241 | ptr->next = id; | 254 | ptr->next = dev_id; |
242 | else | 255 | else |
243 | dev->id = id; | 256 | dev->id = dev_id; |
244 | return 0; | 257 | |
258 | return dev_id; | ||
245 | } | 259 | } |
246 | 260 | ||
247 | EXPORT_SYMBOL(pnp_register_driver); | 261 | EXPORT_SYMBOL(pnp_register_driver); |