aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/Makefile5
-rw-r--r--drivers/pnp/base.h4
-rw-r--r--drivers/pnp/core.c11
-rw-r--r--drivers/pnp/driver.c1
-rw-r--r--drivers/pnp/interface.c37
-rw-r--r--drivers/pnp/isapnp/core.c2
-rw-r--r--drivers/pnp/pnpacpi/core.c2
-rw-r--r--drivers/pnp/pnpbios/core.c6
-rw-r--r--drivers/pnp/quirks.c2
-rw-r--r--drivers/pnp/resource.c4
10 files changed, 24 insertions, 50 deletions
diff --git a/drivers/pnp/Makefile b/drivers/pnp/Makefile
index a381a92fd1b6..8de3775ec242 100644
--- a/drivers/pnp/Makefile
+++ b/drivers/pnp/Makefile
@@ -2,8 +2,11 @@
2# Makefile for the Linux Plug-and-Play Support. 2# Makefile for the Linux Plug-and-Play Support.
3# 3#
4 4
5obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o system.o 5obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o
6 6
7obj-$(CONFIG_PNPACPI) += pnpacpi/ 7obj-$(CONFIG_PNPACPI) += pnpacpi/
8obj-$(CONFIG_PNPBIOS) += pnpbios/ 8obj-$(CONFIG_PNPBIOS) += pnpbios/
9obj-$(CONFIG_ISAPNP) += isapnp/ 9obj-$(CONFIG_ISAPNP) += isapnp/
10
11# pnp_system_init goes after pnpacpi/pnpbios init
12obj-y += system.o
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 5e4e82c82659..0b8d14050efa 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -4,6 +4,7 @@
4 */ 4 */
5 5
6extern spinlock_t pnp_lock; 6extern spinlock_t pnp_lock;
7extern struct device_attribute pnp_interface_attrs[];
7void *pnp_alloc(long size); 8void *pnp_alloc(long size);
8 9
9int pnp_register_protocol(struct pnp_protocol *protocol); 10int pnp_register_protocol(struct pnp_protocol *protocol);
@@ -16,7 +17,6 @@ struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
16 17
17int pnp_add_device(struct pnp_dev *dev); 18int pnp_add_device(struct pnp_dev *dev);
18struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id); 19struct pnp_id *pnp_add_id(struct pnp_dev *dev, char *id);
19int pnp_interface_attach_device(struct pnp_dev *dev);
20 20
21int pnp_add_card(struct pnp_card *card); 21int pnp_add_card(struct pnp_card *card);
22void pnp_remove_card(struct pnp_card *card); 22void pnp_remove_card(struct pnp_card *card);
@@ -147,7 +147,7 @@ char *pnp_resource_type_name(struct resource *res);
147void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc); 147void dbg_pnp_show_resources(struct pnp_dev *dev, char *desc);
148 148
149void pnp_free_resources(struct pnp_dev *dev); 149void pnp_free_resources(struct pnp_dev *dev);
150int pnp_resource_type(struct resource *res); 150unsigned long pnp_resource_type(struct resource *res);
151 151
152struct pnp_resource { 152struct pnp_resource {
153 struct list_head list; 153 struct list_head list;
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 521561509a75..16c01c6fa7c5 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -159,21 +159,13 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id, char *pnpid
159 159
160int __pnp_add_device(struct pnp_dev *dev) 160int __pnp_add_device(struct pnp_dev *dev)
161{ 161{
162 int ret;
163
164 pnp_fixup_device(dev); 162 pnp_fixup_device(dev);
165 dev->status = PNP_READY; 163 dev->status = PNP_READY;
166 spin_lock(&pnp_lock); 164 spin_lock(&pnp_lock);
167 list_add_tail(&dev->global_list, &pnp_global); 165 list_add_tail(&dev->global_list, &pnp_global);
168 list_add_tail(&dev->protocol_list, &dev->protocol->devices); 166 list_add_tail(&dev->protocol_list, &dev->protocol->devices);
169 spin_unlock(&pnp_lock); 167 spin_unlock(&pnp_lock);
170 168 return device_register(&dev->dev);
171 ret = device_register(&dev->dev);
172 if (ret)
173 return ret;
174
175 pnp_interface_attach_device(dev);
176 return 0;
177} 169}
178 170
179/* 171/*
@@ -216,7 +208,6 @@ void __pnp_remove_device(struct pnp_dev *dev)
216 208
217static int __init pnp_init(void) 209static int __init pnp_init(void)
218{ 210{
219 printk(KERN_INFO "Linux Plug and Play Support v0.97 (c) Adam Belay\n");
220 return bus_register(&pnp_bus_type); 211 return bus_register(&pnp_bus_type);
221} 212}
222 213
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 54673a4f5901..527ee764c93f 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -205,6 +205,7 @@ struct bus_type pnp_bus_type = {
205 .remove = pnp_device_remove, 205 .remove = pnp_device_remove,
206 .suspend = pnp_bus_suspend, 206 .suspend = pnp_bus_suspend,
207 .resume = pnp_bus_resume, 207 .resume = pnp_bus_resume,
208 .dev_attrs = pnp_interface_attrs,
208}; 209};
209 210
210int pnp_register_driver(struct pnp_driver *drv) 211int pnp_register_driver(struct pnp_driver *drv)
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index a876ecf7028c..478a4a739c00 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -243,8 +243,6 @@ static ssize_t pnp_show_options(struct device *dmdev,
243 return ret; 243 return ret;
244} 244}
245 245
246static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL);
247
248static ssize_t pnp_show_current_resources(struct device *dmdev, 246static ssize_t pnp_show_current_resources(struct device *dmdev,
249 struct device_attribute *attr, 247 struct device_attribute *attr,
250 char *buf) 248 char *buf)
@@ -420,9 +418,6 @@ done:
420 return count; 418 return count;
421} 419}
422 420
423static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR,
424 pnp_show_current_resources, pnp_set_current_resources);
425
426static ssize_t pnp_show_current_ids(struct device *dmdev, 421static ssize_t pnp_show_current_ids(struct device *dmdev,
427 struct device_attribute *attr, char *buf) 422 struct device_attribute *attr, char *buf)
428{ 423{
@@ -437,27 +432,11 @@ static ssize_t pnp_show_current_ids(struct device *dmdev,
437 return (str - buf); 432 return (str - buf);
438} 433}
439 434
440static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL); 435struct device_attribute pnp_interface_attrs[] = {
441 436 __ATTR(resources, S_IRUGO | S_IWUSR,
442int pnp_interface_attach_device(struct pnp_dev *dev) 437 pnp_show_current_resources,
443{ 438 pnp_set_current_resources),
444 int rc = device_create_file(&dev->dev, &dev_attr_options); 439 __ATTR(options, S_IRUGO, pnp_show_options, NULL),
445 440 __ATTR(id, S_IRUGO, pnp_show_current_ids, NULL),
446 if (rc) 441 __ATTR_NULL,
447 goto err; 442};
448 rc = device_create_file(&dev->dev, &dev_attr_resources);
449 if (rc)
450 goto err_opt;
451 rc = device_create_file(&dev->dev, &dev_attr_id);
452 if (rc)
453 goto err_res;
454
455 return 0;
456
457err_res:
458 device_remove_file(&dev->dev, &dev_attr_resources);
459err_opt:
460 device_remove_file(&dev->dev, &dev_attr_options);
461err:
462 return rc;
463}
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index bd213ffbcd9e..e851160e14f0 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -1012,7 +1012,7 @@ static int __init isapnp_init(void)
1012 printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n"); 1012 printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n");
1013 return 0; 1013 return 0;
1014 } 1014 }
1015#ifdef CONFIG_PPC_MERGE 1015#ifdef CONFIG_PPC
1016 if (check_legacy_ioport(_PIDXR) || check_legacy_ioport(_PNPWRP)) 1016 if (check_legacy_ioport(_PIDXR) || check_legacy_ioport(_PNPWRP))
1017 return -EINVAL; 1017 return -EINVAL;
1018#endif 1018#endif
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index a12800f8e4c9..383e47c392a4 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -272,7 +272,7 @@ static int __init pnpacpi_init(void)
272 return 0; 272 return 0;
273} 273}
274 274
275subsys_initcall(pnpacpi_init); 275fs_initcall(pnpacpi_init);
276 276
277static int __init pnpacpi_setup(char *str) 277static int __init pnpacpi_setup(char *str)
278{ 278{
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 2f79eb2190e1..996f64838079 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -519,7 +519,7 @@ static int __init pnpbios_init(void)
519{ 519{
520 int ret; 520 int ret;
521 521
522#if defined(CONFIG_PPC_MERGE) 522#if defined(CONFIG_PPC)
523 if (check_legacy_ioport(PNPBIOS_BASE)) 523 if (check_legacy_ioport(PNPBIOS_BASE))
524 return -ENODEV; 524 return -ENODEV;
525#endif 525#endif
@@ -571,13 +571,13 @@ static int __init pnpbios_init(void)
571 return 0; 571 return 0;
572} 572}
573 573
574subsys_initcall(pnpbios_init); 574fs_initcall(pnpbios_init);
575 575
576static int __init pnpbios_thread_init(void) 576static int __init pnpbios_thread_init(void)
577{ 577{
578 struct task_struct *task; 578 struct task_struct *task;
579 579
580#if defined(CONFIG_PPC_MERGE) 580#if defined(CONFIG_PPC)
581 if (check_legacy_ioport(PNPBIOS_BASE)) 581 if (check_legacy_ioport(PNPBIOS_BASE))
582 return 0; 582 return 0;
583#endif 583#endif
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 3d2e56094783..8473fe5ed7ff 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -245,7 +245,7 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
245 */ 245 */
246 for_each_pci_dev(pdev) { 246 for_each_pci_dev(pdev) {
247 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 247 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
248 unsigned int type; 248 unsigned long type;
249 249
250 type = pci_resource_flags(pdev, i) & 250 type = pci_resource_flags(pdev, i) &
251 (IORESOURCE_IO | IORESOURCE_MEM); 251 (IORESOURCE_IO | IORESOURCE_MEM);
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 5ef463d89f16..f604061d2bb0 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -467,14 +467,14 @@ int pnp_check_dma(struct pnp_dev *dev, struct resource *res)
467#endif 467#endif
468} 468}
469 469
470int pnp_resource_type(struct resource *res) 470unsigned long pnp_resource_type(struct resource *res)
471{ 471{
472 return res->flags & (IORESOURCE_IO | IORESOURCE_MEM | 472 return res->flags & (IORESOURCE_IO | IORESOURCE_MEM |
473 IORESOURCE_IRQ | IORESOURCE_DMA); 473 IORESOURCE_IRQ | IORESOURCE_DMA);
474} 474}
475 475
476struct resource *pnp_get_resource(struct pnp_dev *dev, 476struct resource *pnp_get_resource(struct pnp_dev *dev,
477 unsigned int type, unsigned int num) 477 unsigned long type, unsigned int num)
478{ 478{
479 struct pnp_resource *pnp_res; 479 struct pnp_resource *pnp_res;
480 struct resource *res; 480 struct resource *res;