diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/manager.c | 78 |
1 files changed, 2 insertions, 76 deletions
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 2251dd7da062..d407c07b5b9d 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -238,8 +238,9 @@ static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | |||
238 | * pnp_init_resources - Resets a resource table to default values. | 238 | * pnp_init_resources - Resets a resource table to default values. |
239 | * @table: pointer to the desired resource table | 239 | * @table: pointer to the desired resource table |
240 | */ | 240 | */ |
241 | void pnp_init_resource_table(struct pnp_resource_table *table) | 241 | void pnp_init_resources(struct pnp_dev *dev) |
242 | { | 242 | { |
243 | struct pnp_resource_table *table = &dev->res; | ||
243 | int idx; | 244 | int idx; |
244 | 245 | ||
245 | for (idx = 0; idx < PNP_MAX_IRQ; idx++) { | 246 | for (idx = 0; idx < PNP_MAX_IRQ; idx++) { |
@@ -272,11 +273,6 @@ void pnp_init_resource_table(struct pnp_resource_table *table) | |||
272 | } | 273 | } |
273 | } | 274 | } |
274 | 275 | ||
275 | void pnp_init_resources(struct pnp_dev *dev) | ||
276 | { | ||
277 | pnp_init_resource_table(&dev->res); | ||
278 | } | ||
279 | |||
280 | /** | 276 | /** |
281 | * pnp_clean_resources - clears resources that were not manually set | 277 | * pnp_clean_resources - clears resources that were not manually set |
282 | * @res: the resources to clean | 278 | * @res: the resources to clean |
@@ -423,59 +419,6 @@ fail: | |||
423 | } | 419 | } |
424 | 420 | ||
425 | /** | 421 | /** |
426 | * pnp_manual_config_dev - Disables Auto Config and Manually sets the resource table | ||
427 | * @dev: pointer to the desired device | ||
428 | * @res: pointer to the new resource config | ||
429 | * @mode: 0 or PNP_CONFIG_FORCE | ||
430 | * | ||
431 | * This function can be used by drivers that want to manually set thier resources. | ||
432 | */ | ||
433 | int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, | ||
434 | int mode) | ||
435 | { | ||
436 | int i; | ||
437 | struct pnp_resource_table *bak; | ||
438 | |||
439 | if (!pnp_can_configure(dev)) | ||
440 | return -ENODEV; | ||
441 | bak = pnp_alloc(sizeof(struct pnp_resource_table)); | ||
442 | if (!bak) | ||
443 | return -ENOMEM; | ||
444 | *bak = dev->res; | ||
445 | |||
446 | mutex_lock(&pnp_res_mutex); | ||
447 | dev->res = *res; | ||
448 | if (!(mode & PNP_CONFIG_FORCE)) { | ||
449 | for (i = 0; i < PNP_MAX_PORT; i++) { | ||
450 | if (!pnp_check_port(dev, i)) | ||
451 | goto fail; | ||
452 | } | ||
453 | for (i = 0; i < PNP_MAX_MEM; i++) { | ||
454 | if (!pnp_check_mem(dev, i)) | ||
455 | goto fail; | ||
456 | } | ||
457 | for (i = 0; i < PNP_MAX_IRQ; i++) { | ||
458 | if (!pnp_check_irq(dev, i)) | ||
459 | goto fail; | ||
460 | } | ||
461 | for (i = 0; i < PNP_MAX_DMA; i++) { | ||
462 | if (!pnp_check_dma(dev, i)) | ||
463 | goto fail; | ||
464 | } | ||
465 | } | ||
466 | mutex_unlock(&pnp_res_mutex); | ||
467 | |||
468 | kfree(bak); | ||
469 | return 0; | ||
470 | |||
471 | fail: | ||
472 | dev->res = *bak; | ||
473 | mutex_unlock(&pnp_res_mutex); | ||
474 | kfree(bak); | ||
475 | return -EINVAL; | ||
476 | } | ||
477 | |||
478 | /** | ||
479 | * pnp_auto_config_dev - automatically assigns resources to a device | 422 | * pnp_auto_config_dev - automatically assigns resources to a device |
480 | * @dev: pointer to the desired device | 423 | * @dev: pointer to the desired device |
481 | */ | 424 | */ |
@@ -602,24 +545,7 @@ int pnp_disable_dev(struct pnp_dev *dev) | |||
602 | return 0; | 545 | return 0; |
603 | } | 546 | } |
604 | 547 | ||
605 | /** | ||
606 | * pnp_resource_change - change one resource | ||
607 | * @resource: pointer to resource to be changed | ||
608 | * @start: start of region | ||
609 | * @size: size of region | ||
610 | */ | ||
611 | void pnp_resource_change(struct resource *resource, resource_size_t start, | ||
612 | resource_size_t size) | ||
613 | { | ||
614 | resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); | ||
615 | resource->start = start; | ||
616 | resource->end = start + size - 1; | ||
617 | } | ||
618 | |||
619 | EXPORT_SYMBOL(pnp_manual_config_dev); | ||
620 | EXPORT_SYMBOL(pnp_start_dev); | 548 | EXPORT_SYMBOL(pnp_start_dev); |
621 | EXPORT_SYMBOL(pnp_stop_dev); | 549 | EXPORT_SYMBOL(pnp_stop_dev); |
622 | EXPORT_SYMBOL(pnp_activate_dev); | 550 | EXPORT_SYMBOL(pnp_activate_dev); |
623 | EXPORT_SYMBOL(pnp_disable_dev); | 551 | EXPORT_SYMBOL(pnp_disable_dev); |
624 | EXPORT_SYMBOL(pnp_resource_change); | ||
625 | EXPORT_SYMBOL(pnp_init_resource_table); | ||