aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pnp/manager.c78
-rw-r--r--include/linux/pnp.h8
2 files changed, 2 insertions, 84 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 */
241void pnp_init_resource_table(struct pnp_resource_table *table) 241void 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
275void 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 */
433int 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
471fail:
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 */
611void 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
619EXPORT_SYMBOL(pnp_manual_config_dev);
620EXPORT_SYMBOL(pnp_start_dev); 548EXPORT_SYMBOL(pnp_start_dev);
621EXPORT_SYMBOL(pnp_stop_dev); 549EXPORT_SYMBOL(pnp_stop_dev);
622EXPORT_SYMBOL(pnp_activate_dev); 550EXPORT_SYMBOL(pnp_activate_dev);
623EXPORT_SYMBOL(pnp_disable_dev); 551EXPORT_SYMBOL(pnp_disable_dev);
624EXPORT_SYMBOL(pnp_resource_change);
625EXPORT_SYMBOL(pnp_init_resource_table);
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 1737f071787a..e8187d9faf01 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -390,18 +390,13 @@ int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option,
390 struct pnp_port *data); 390 struct pnp_port *data);
391int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option, 391int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option,
392 struct pnp_mem *data); 392 struct pnp_mem *data);
393void pnp_init_resource_table(struct pnp_resource_table *table);
394void pnp_init_resources(struct pnp_dev *dev); 393void pnp_init_resources(struct pnp_dev *dev);
395int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
396 int mode);
397int pnp_auto_config_dev(struct pnp_dev *dev); 394int pnp_auto_config_dev(struct pnp_dev *dev);
398int pnp_validate_config(struct pnp_dev *dev); 395int pnp_validate_config(struct pnp_dev *dev);
399int pnp_start_dev(struct pnp_dev *dev); 396int pnp_start_dev(struct pnp_dev *dev);
400int pnp_stop_dev(struct pnp_dev *dev); 397int pnp_stop_dev(struct pnp_dev *dev);
401int pnp_activate_dev(struct pnp_dev *dev); 398int pnp_activate_dev(struct pnp_dev *dev);
402int pnp_disable_dev(struct pnp_dev *dev); 399int pnp_disable_dev(struct pnp_dev *dev);
403void pnp_resource_change(struct resource *resource, resource_size_t start,
404 resource_size_t size);
405 400
406/* protocol helpers */ 401/* protocol helpers */
407int pnp_is_active(struct pnp_dev *dev); 402int pnp_is_active(struct pnp_dev *dev);
@@ -438,16 +433,13 @@ static inline int pnp_register_irq_resource(struct pnp_dev *dev, struct pnp_opti
438static inline int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; } 433static inline int pnp_register_dma_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; }
439static inline int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_port *data) { return -ENODEV; } 434static inline int pnp_register_port_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
440static inline int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; } 435static inline int pnp_register_mem_resource(struct pnp_dev *dev, struct pnp_option *option, struct pnp_mem *data) { return -ENODEV; }
441static inline void pnp_init_resource_table(struct pnp_resource_table *table) { }
442static inline void pnp_init_resources(struct pnp_dev *dev) { } 436static inline void pnp_init_resources(struct pnp_dev *dev) { }
443static inline int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode) { return -ENODEV; }
444static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; } 437static inline int pnp_auto_config_dev(struct pnp_dev *dev) { return -ENODEV; }
445static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; } 438static inline int pnp_validate_config(struct pnp_dev *dev) { return -ENODEV; }
446static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; } 439static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
447static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 440static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
448static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 441static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
449static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 442static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
450static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { }
451 443
452/* protocol helpers */ 444/* protocol helpers */
453static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } 445static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }