aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/manager.c')
-rw-r--r--drivers/pnp/manager.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 17c95188bd11..3bda513a6bd3 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz> 4 * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz>
5 * Copyright 2003 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
6 *
7 */ 6 */
8 7
9#include <linux/errno.h> 8#include <linux/errno.h>
@@ -222,11 +221,11 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
222/** 221/**
223 * pnp_init_resources - Resets a resource table to default values. 222 * pnp_init_resources - Resets a resource table to default values.
224 * @table: pointer to the desired resource table 223 * @table: pointer to the desired resource table
225 *
226 */ 224 */
227void pnp_init_resource_table(struct pnp_resource_table *table) 225void pnp_init_resource_table(struct pnp_resource_table *table)
228{ 226{
229 int idx; 227 int idx;
228
230 for (idx = 0; idx < PNP_MAX_IRQ; idx++) { 229 for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
231 table->irq_resource[idx].name = NULL; 230 table->irq_resource[idx].name = NULL;
232 table->irq_resource[idx].start = -1; 231 table->irq_resource[idx].start = -1;
@@ -260,11 +259,11 @@ void pnp_init_resource_table(struct pnp_resource_table *table)
260/** 259/**
261 * pnp_clean_resources - clears resources that were not manually set 260 * pnp_clean_resources - clears resources that were not manually set
262 * @res: the resources to clean 261 * @res: the resources to clean
263 *
264 */ 262 */
265static void pnp_clean_resource_table(struct pnp_resource_table *res) 263static void pnp_clean_resource_table(struct pnp_resource_table *res)
266{ 264{
267 int idx; 265 int idx;
266
268 for (idx = 0; idx < PNP_MAX_IRQ; idx++) { 267 for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
269 if (!(res->irq_resource[idx].flags & IORESOURCE_AUTO)) 268 if (!(res->irq_resource[idx].flags & IORESOURCE_AUTO))
270 continue; 269 continue;
@@ -410,6 +409,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
410{ 409{
411 int i; 410 int i;
412 struct pnp_resource_table *bak; 411 struct pnp_resource_table *bak;
412
413 if (!dev || !res) 413 if (!dev || !res)
414 return -EINVAL; 414 return -EINVAL;
415 if (!pnp_can_configure(dev)) 415 if (!pnp_can_configure(dev))
@@ -454,7 +454,6 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
454/** 454/**
455 * pnp_auto_config_dev - automatically assigns resources to a device 455 * pnp_auto_config_dev - automatically assigns resources to a device
456 * @dev: pointer to the desired device 456 * @dev: pointer to the desired device
457 *
458 */ 457 */
459int pnp_auto_config_dev(struct pnp_dev *dev) 458int pnp_auto_config_dev(struct pnp_dev *dev)
460{ 459{
@@ -491,9 +490,8 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
491 * pnp_start_dev - low-level start of the PnP device 490 * pnp_start_dev - low-level start of the PnP device
492 * @dev: pointer to the desired device 491 * @dev: pointer to the desired device
493 * 492 *
494 * assumes that resources have alread been allocated 493 * assumes that resources have already been allocated
495 */ 494 */
496
497int pnp_start_dev(struct pnp_dev *dev) 495int pnp_start_dev(struct pnp_dev *dev)
498{ 496{
499 if (!pnp_can_write(dev)) { 497 if (!pnp_can_write(dev)) {
@@ -508,7 +506,6 @@ int pnp_start_dev(struct pnp_dev *dev)
508 } 506 }
509 507
510 pnp_info("Device %s activated.", dev->dev.bus_id); 508 pnp_info("Device %s activated.", dev->dev.bus_id);
511
512 return 0; 509 return 0;
513} 510}
514 511
@@ -518,7 +515,6 @@ int pnp_start_dev(struct pnp_dev *dev)
518 * 515 *
519 * does not free resources 516 * does not free resources
520 */ 517 */
521
522int pnp_stop_dev(struct pnp_dev *dev) 518int pnp_stop_dev(struct pnp_dev *dev)
523{ 519{
524 if (!pnp_can_disable(dev)) { 520 if (!pnp_can_disable(dev)) {
@@ -532,7 +528,6 @@ int pnp_stop_dev(struct pnp_dev *dev)
532 } 528 }
533 529
534 pnp_info("Device %s disabled.", dev->dev.bus_id); 530 pnp_info("Device %s disabled.", dev->dev.bus_id);
535
536 return 0; 531 return 0;
537} 532}
538 533
@@ -548,9 +543,8 @@ int pnp_activate_dev(struct pnp_dev *dev)
548 543
549 if (!dev) 544 if (!dev)
550 return -EINVAL; 545 return -EINVAL;
551 if (dev->active) { 546 if (dev->active)
552 return 0; /* the device is already active */ 547 return 0; /* the device is already active */
553 }
554 548
555 /* ensure resources are allocated */ 549 /* ensure resources are allocated */
556 if (pnp_auto_config_dev(dev)) 550 if (pnp_auto_config_dev(dev))
@@ -561,7 +555,6 @@ int pnp_activate_dev(struct pnp_dev *dev)
561 return error; 555 return error;
562 556
563 dev->active = 1; 557 dev->active = 1;
564
565 return 1; 558 return 1;
566} 559}
567 560
@@ -577,9 +570,8 @@ int pnp_disable_dev(struct pnp_dev *dev)
577 570
578 if (!dev) 571 if (!dev)
579 return -EINVAL; 572 return -EINVAL;
580 if (!dev->active) { 573 if (!dev->active)
581 return 0; /* the device is already disabled */ 574 return 0; /* the device is already disabled */
582 }
583 575
584 error = pnp_stop_dev(dev); 576 error = pnp_stop_dev(dev);
585 if (error) 577 if (error)
@@ -600,7 +592,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
600 * @resource: pointer to resource to be changed 592 * @resource: pointer to resource to be changed
601 * @start: start of region 593 * @start: start of region
602 * @size: size of region 594 * @size: size of region
603 *
604 */ 595 */
605void pnp_resource_change(struct resource *resource, resource_size_t start, 596void pnp_resource_change(struct resource *resource, resource_size_t start,
606 resource_size_t size) 597 resource_size_t size)
@@ -613,9 +604,6 @@ void pnp_resource_change(struct resource *resource, resource_size_t start,
613} 604}
614 605
615EXPORT_SYMBOL(pnp_manual_config_dev); 606EXPORT_SYMBOL(pnp_manual_config_dev);
616#if 0
617EXPORT_SYMBOL(pnp_auto_config_dev);
618#endif
619EXPORT_SYMBOL(pnp_start_dev); 607EXPORT_SYMBOL(pnp_start_dev);
620EXPORT_SYMBOL(pnp_stop_dev); 608EXPORT_SYMBOL(pnp_stop_dev);
621EXPORT_SYMBOL(pnp_activate_dev); 609EXPORT_SYMBOL(pnp_activate_dev);