aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp')
-rw-r--r--drivers/pnp/card.c33
-rw-r--r--drivers/pnp/core.c29
-rw-r--r--drivers/pnp/driver.c20
-rw-r--r--drivers/pnp/interface.c2
-rw-r--r--drivers/pnp/isapnp/compat.c23
-rw-r--r--drivers/pnp/isapnp/core.c30
-rw-r--r--drivers/pnp/isapnp/proc.c7
-rw-r--r--drivers/pnp/manager.c24
-rw-r--r--drivers/pnp/pnpacpi/core.c23
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c160
-rw-r--r--drivers/pnp/pnpbios/bioscalls.c161
-rw-r--r--drivers/pnp/pnpbios/core.c28
-rw-r--r--drivers/pnp/pnpbios/proc.c5
-rw-r--r--drivers/pnp/pnpbios/rsparser.c99
-rw-r--r--drivers/pnp/quirks.c1
-rw-r--r--drivers/pnp/resource.c33
-rw-r--r--drivers/pnp/support.c8
-rw-r--r--drivers/pnp/system.c12
18 files changed, 248 insertions, 450 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index a379a38c196c..b6a4f02b01d1 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -2,7 +2,6 @@
2 * card.c - contains functions for managing groups of PnP devices 2 * card.c - contains functions for managing groups of PnP devices
3 * 3 *
4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
5 *
6 */ 5 */
7 6
8#include <linux/module.h> 7#include <linux/module.h>
@@ -17,12 +16,15 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
17 struct pnp_card *card) 16 struct pnp_card *card)
18{ 17{
19 const struct pnp_card_device_id *drv_id = drv->id_table; 18 const struct pnp_card_device_id *drv_id = drv->id_table;
19
20 while (*drv_id->id) { 20 while (*drv_id->id) {
21 if (compare_pnp_id(card->id, drv_id->id)) { 21 if (compare_pnp_id(card->id, drv_id->id)) {
22 int i = 0; 22 int i = 0;
23
23 for (;;) { 24 for (;;) {
24 int found; 25 int found;
25 struct pnp_dev *dev; 26 struct pnp_dev *dev;
27
26 if (i == PNP_MAX_DEVICES 28 if (i == PNP_MAX_DEVICES
27 || !*drv_id->devs[i].id) 29 || !*drv_id->devs[i].id)
28 return drv_id; 30 return drv_id;
@@ -52,6 +54,7 @@ static void card_remove(struct pnp_dev *dev)
52static void card_remove_first(struct pnp_dev *dev) 54static void card_remove_first(struct pnp_dev *dev)
53{ 55{
54 struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver); 56 struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);
57
55 if (!dev->card || !drv) 58 if (!dev->card || !drv)
56 return; 59 return;
57 if (drv->remove) 60 if (drv->remove)
@@ -96,12 +99,11 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
96 * pnp_add_card_id - adds an EISA id to the specified card 99 * pnp_add_card_id - adds an EISA id to the specified card
97 * @id: pointer to a pnp_id structure 100 * @id: pointer to a pnp_id structure
98 * @card: pointer to the desired card 101 * @card: pointer to the desired card
99 *
100 */ 102 */
101
102int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) 103int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
103{ 104{
104 struct pnp_id *ptr; 105 struct pnp_id *ptr;
106
105 if (!id) 107 if (!id)
106 return -EINVAL; 108 return -EINVAL;
107 if (!card) 109 if (!card)
@@ -121,6 +123,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
121{ 123{
122 struct pnp_id *id; 124 struct pnp_id *id;
123 struct pnp_id *next; 125 struct pnp_id *next;
126
124 if (!card) 127 if (!card)
125 return; 128 return;
126 id = card->id; 129 id = card->id;
@@ -134,6 +137,7 @@ static void pnp_free_card_ids(struct pnp_card *card)
134static void pnp_release_card(struct device *dmdev) 137static void pnp_release_card(struct device *dmdev)
135{ 138{
136 struct pnp_card *card = to_pnp_card(dmdev); 139 struct pnp_card *card = to_pnp_card(dmdev);
140
137 pnp_free_card_ids(card); 141 pnp_free_card_ids(card);
138 kfree(card); 142 kfree(card);
139} 143}
@@ -143,6 +147,7 @@ static ssize_t pnp_show_card_name(struct device *dmdev,
143{ 147{
144 char *str = buf; 148 char *str = buf;
145 struct pnp_card *card = to_pnp_card(dmdev); 149 struct pnp_card *card = to_pnp_card(dmdev);
150
146 str += sprintf(str, "%s\n", card->name); 151 str += sprintf(str, "%s\n", card->name);
147 return (str - buf); 152 return (str - buf);
148} 153}
@@ -168,6 +173,7 @@ static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);
168static int pnp_interface_attach_card(struct pnp_card *card) 173static int pnp_interface_attach_card(struct pnp_card *card)
169{ 174{
170 int rc = device_create_file(&card->dev, &dev_attr_name); 175 int rc = device_create_file(&card->dev, &dev_attr_name);
176
171 if (rc) 177 if (rc)
172 return rc; 178 return rc;
173 179
@@ -186,11 +192,11 @@ static int pnp_interface_attach_card(struct pnp_card *card)
186 * pnp_add_card - adds a PnP card to the PnP Layer 192 * pnp_add_card - adds a PnP card to the PnP Layer
187 * @card: pointer to the card to add 193 * @card: pointer to the card to add
188 */ 194 */
189
190int pnp_add_card(struct pnp_card *card) 195int pnp_add_card(struct pnp_card *card)
191{ 196{
192 int error; 197 int error;
193 struct list_head *pos, *temp; 198 struct list_head *pos, *temp;
199
194 if (!card || !card->protocol) 200 if (!card || !card->protocol)
195 return -EINVAL; 201 return -EINVAL;
196 202
@@ -233,10 +239,10 @@ int pnp_add_card(struct pnp_card *card)
233 * pnp_remove_card - removes a PnP card from the PnP Layer 239 * pnp_remove_card - removes a PnP card from the PnP Layer
234 * @card: pointer to the card to remove 240 * @card: pointer to the card to remove
235 */ 241 */
236
237void pnp_remove_card(struct pnp_card *card) 242void pnp_remove_card(struct pnp_card *card)
238{ 243{
239 struct list_head *pos, *temp; 244 struct list_head *pos, *temp;
245
240 if (!card) 246 if (!card)
241 return; 247 return;
242 device_unregister(&card->dev); 248 device_unregister(&card->dev);
@@ -255,7 +261,6 @@ void pnp_remove_card(struct pnp_card *card)
255 * @card: pointer to the card to add to 261 * @card: pointer to the card to add to
256 * @dev: pointer to the device to add 262 * @dev: pointer to the device to add
257 */ 263 */
258
259int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) 264int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
260{ 265{
261 if (!card || !dev || !dev->protocol) 266 if (!card || !dev || !dev->protocol)
@@ -275,7 +280,6 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
275 * pnp_remove_card_device- removes a device from the specified card 280 * pnp_remove_card_device- removes a device from the specified card
276 * @dev: pointer to the device to remove 281 * @dev: pointer to the device to remove
277 */ 282 */
278
279void pnp_remove_card_device(struct pnp_dev *dev) 283void pnp_remove_card_device(struct pnp_dev *dev)
280{ 284{
281 spin_lock(&pnp_lock); 285 spin_lock(&pnp_lock);
@@ -291,7 +295,6 @@ void pnp_remove_card_device(struct pnp_dev *dev)
291 * @id: pointer to a PnP ID structure that explains the rules for finding the device 295 * @id: pointer to a PnP ID structure that explains the rules for finding the device
292 * @from: Starting place to search from. If NULL it will start from the begining. 296 * @from: Starting place to search from. If NULL it will start from the begining.
293 */ 297 */
294
295struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, 298struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
296 const char *id, struct pnp_dev *from) 299 const char *id, struct pnp_dev *from)
297{ 300{
@@ -299,6 +302,7 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
299 struct pnp_dev *dev; 302 struct pnp_dev *dev;
300 struct pnp_card_driver *drv; 303 struct pnp_card_driver *drv;
301 struct pnp_card *card; 304 struct pnp_card *card;
305
302 if (!clink || !id) 306 if (!clink || !id)
303 goto done; 307 goto done;
304 card = clink->card; 308 card = clink->card;
@@ -340,10 +344,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
340 * pnp_release_card_device - call this when the driver no longer needs the device 344 * pnp_release_card_device - call this when the driver no longer needs the device
341 * @dev: pointer to the PnP device stucture 345 * @dev: pointer to the PnP device stucture
342 */ 346 */
343
344void pnp_release_card_device(struct pnp_dev *dev) 347void pnp_release_card_device(struct pnp_dev *dev)
345{ 348{
346 struct pnp_card_driver *drv = dev->card_link->driver; 349 struct pnp_card_driver *drv = dev->card_link->driver;
350
347 if (!drv) 351 if (!drv)
348 return; 352 return;
349 drv->link.remove = &card_remove; 353 drv->link.remove = &card_remove;
@@ -357,6 +361,7 @@ void pnp_release_card_device(struct pnp_dev *dev)
357static int card_suspend(struct pnp_dev *dev, pm_message_t state) 361static int card_suspend(struct pnp_dev *dev, pm_message_t state)
358{ 362{
359 struct pnp_card_link *link = dev->card_link; 363 struct pnp_card_link *link = dev->card_link;
364
360 if (link->pm_state.event == state.event) 365 if (link->pm_state.event == state.event)
361 return 0; 366 return 0;
362 link->pm_state = state; 367 link->pm_state = state;
@@ -366,6 +371,7 @@ static int card_suspend(struct pnp_dev *dev, pm_message_t state)
366static int card_resume(struct pnp_dev *dev) 371static int card_resume(struct pnp_dev *dev)
367{ 372{
368 struct pnp_card_link *link = dev->card_link; 373 struct pnp_card_link *link = dev->card_link;
374
369 if (link->pm_state.event == PM_EVENT_ON) 375 if (link->pm_state.event == PM_EVENT_ON)
370 return 0; 376 return 0;
371 link->pm_state = PMSG_ON; 377 link->pm_state = PMSG_ON;
@@ -377,7 +383,6 @@ static int card_resume(struct pnp_dev *dev)
377 * pnp_register_card_driver - registers a PnP card driver with the PnP Layer 383 * pnp_register_card_driver - registers a PnP card driver with the PnP Layer
378 * @drv: pointer to the driver to register 384 * @drv: pointer to the driver to register
379 */ 385 */
380
381int pnp_register_card_driver(struct pnp_card_driver *drv) 386int pnp_register_card_driver(struct pnp_card_driver *drv)
382{ 387{
383 int error; 388 int error;
@@ -411,7 +416,6 @@ int pnp_register_card_driver(struct pnp_card_driver *drv)
411 * pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer 416 * pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer
412 * @drv: pointer to the driver to unregister 417 * @drv: pointer to the driver to unregister
413 */ 418 */
414
415void pnp_unregister_card_driver(struct pnp_card_driver *drv) 419void pnp_unregister_card_driver(struct pnp_card_driver *drv)
416{ 420{
417 spin_lock(&pnp_lock); 421 spin_lock(&pnp_lock);
@@ -420,13 +424,6 @@ void pnp_unregister_card_driver(struct pnp_card_driver *drv)
420 pnp_unregister_driver(&drv->link); 424 pnp_unregister_driver(&drv->link);
421} 425}
422 426
423#if 0
424EXPORT_SYMBOL(pnp_add_card);
425EXPORT_SYMBOL(pnp_remove_card);
426EXPORT_SYMBOL(pnp_add_card_device);
427EXPORT_SYMBOL(pnp_remove_card_device);
428EXPORT_SYMBOL(pnp_add_card_id);
429#endif /* 0 */
430EXPORT_SYMBOL(pnp_request_card_device); 427EXPORT_SYMBOL(pnp_request_card_device);
431EXPORT_SYMBOL(pnp_release_card_device); 428EXPORT_SYMBOL(pnp_release_card_device);
432EXPORT_SYMBOL(pnp_register_card_driver); 429EXPORT_SYMBOL(pnp_register_card_driver);
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 1dfdc325211d..61066fdb9e6d 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -2,7 +2,6 @@
2 * core.c - contains all core device and protocol registration functions 2 * core.c - contains all core device and protocol registration functions
3 * 3 *
4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
5 *
6 */ 5 */
7 6
8#include <linux/pnp.h> 7#include <linux/pnp.h>
@@ -48,7 +47,6 @@ void *pnp_alloc(long size)
48 * 47 *
49 * Ex protocols: ISAPNP, PNPBIOS, etc 48 * Ex protocols: ISAPNP, PNPBIOS, etc
50 */ 49 */
51
52int pnp_register_protocol(struct pnp_protocol *protocol) 50int pnp_register_protocol(struct pnp_protocol *protocol)
53{ 51{
54 int nodenum; 52 int nodenum;
@@ -82,7 +80,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
82/** 80/**
83 * pnp_protocol_unregister - removes a pnp protocol from the pnp layer 81 * pnp_protocol_unregister - removes a pnp protocol from the pnp layer
84 * @protocol: pointer to the corresponding pnp_protocol structure 82 * @protocol: pointer to the corresponding pnp_protocol structure
85 *
86 */ 83 */
87void pnp_unregister_protocol(struct pnp_protocol *protocol) 84void pnp_unregister_protocol(struct pnp_protocol *protocol)
88{ 85{
@@ -96,6 +93,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
96{ 93{
97 struct pnp_id *id; 94 struct pnp_id *id;
98 struct pnp_id *next; 95 struct pnp_id *next;
96
99 if (!dev) 97 if (!dev)
100 return; 98 return;
101 id = dev->id; 99 id = dev->id;
@@ -109,6 +107,7 @@ static void pnp_free_ids(struct pnp_dev *dev)
109static void pnp_release_device(struct device *dmdev) 107static void pnp_release_device(struct device *dmdev)
110{ 108{
111 struct pnp_dev *dev = to_pnp_dev(dmdev); 109 struct pnp_dev *dev = to_pnp_dev(dmdev);
110
112 pnp_free_option(dev->independent); 111 pnp_free_option(dev->independent);
113 pnp_free_option(dev->dependent); 112 pnp_free_option(dev->dependent);
114 pnp_free_ids(dev); 113 pnp_free_ids(dev);
@@ -118,6 +117,7 @@ static void pnp_release_device(struct device *dmdev)
118int __pnp_add_device(struct pnp_dev *dev) 117int __pnp_add_device(struct pnp_dev *dev)
119{ 118{
120 int ret; 119 int ret;
120
121 pnp_fixup_device(dev); 121 pnp_fixup_device(dev);
122 dev->dev.bus = &pnp_bus_type; 122 dev->dev.bus = &pnp_bus_type;
123 dev->dev.dma_mask = &dev->dma_mask; 123 dev->dev.dma_mask = &dev->dma_mask;
@@ -141,7 +141,6 @@ int __pnp_add_device(struct pnp_dev *dev)
141 * 141 *
142 * adds to driver model, name database, fixups, interface, etc. 142 * adds to driver model, name database, fixups, interface, etc.
143 */ 143 */
144
145int pnp_add_device(struct pnp_dev *dev) 144int pnp_add_device(struct pnp_dev *dev)
146{ 145{
147 if (!dev || !dev->protocol || dev->card) 146 if (!dev || !dev->protocol || dev->card)
@@ -161,21 +160,6 @@ void __pnp_remove_device(struct pnp_dev *dev)
161 device_unregister(&dev->dev); 160 device_unregister(&dev->dev);
162} 161}
163 162
164/**
165 * pnp_remove_device - removes a pnp device from the pnp layer
166 * @dev: pointer to dev to add
167 *
168 * this function will free all mem used by dev
169 */
170#if 0
171void pnp_remove_device(struct pnp_dev *dev)
172{
173 if (!dev || dev->card)
174 return;
175 __pnp_remove_device(dev);
176}
177#endif /* 0 */
178
179static int __init pnp_init(void) 163static int __init pnp_init(void)
180{ 164{
181 printk(KERN_INFO "Linux Plug and Play Support v0.97 (c) Adam Belay\n"); 165 printk(KERN_INFO "Linux Plug and Play Support v0.97 (c) Adam Belay\n");
@@ -183,10 +167,3 @@ static int __init pnp_init(void)
183} 167}
184 168
185subsys_initcall(pnp_init); 169subsys_initcall(pnp_init);
186
187#if 0
188EXPORT_SYMBOL(pnp_register_protocol);
189EXPORT_SYMBOL(pnp_unregister_protocol);
190EXPORT_SYMBOL(pnp_add_device);
191EXPORT_SYMBOL(pnp_remove_device);
192#endif /* 0 */
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 913d926f8baf..30b8f6f3258a 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -2,7 +2,6 @@
2 * driver.c - device id matching, driver model, etc. 2 * driver.c - device id matching, driver model, etc.
3 * 3 *
4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 4 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
5 *
6 */ 5 */
7 6
8#include <linux/string.h> 7#include <linux/string.h>
@@ -16,6 +15,7 @@
16static int compare_func(const char *ida, const char *idb) 15static int compare_func(const char *ida, const char *idb)
17{ 16{
18 int i; 17 int i;
18
19 /* we only need to compare the last 4 chars */ 19 /* we only need to compare the last 4 chars */
20 for (i = 3; i < 7; i++) { 20 for (i = 3; i < 7; i++) {
21 if (ida[i] != 'X' && 21 if (ida[i] != 'X' &&
@@ -44,6 +44,7 @@ static const struct pnp_device_id *match_device(struct pnp_driver *drv,
44 struct pnp_dev *dev) 44 struct pnp_dev *dev)
45{ 45{
46 const struct pnp_device_id *drv_id = drv->id_table; 46 const struct pnp_device_id *drv_id = drv->id_table;
47
47 if (!drv_id) 48 if (!drv_id)
48 return NULL; 49 return NULL;
49 50
@@ -140,6 +141,7 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
140{ 141{
141 struct pnp_dev *pnp_dev = to_pnp_dev(dev); 142 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
142 struct pnp_driver *pnp_drv = to_pnp_driver(drv); 143 struct pnp_driver *pnp_drv = to_pnp_driver(drv);
144
143 if (match_device(pnp_drv, pnp_dev) == NULL) 145 if (match_device(pnp_drv, pnp_dev) == NULL)
144 return 0; 146 return 0;
145 return 1; 147 return 1;
@@ -197,12 +199,12 @@ static int pnp_bus_resume(struct device *dev)
197} 199}
198 200
199struct bus_type pnp_bus_type = { 201struct bus_type pnp_bus_type = {
200 .name = "pnp", 202 .name = "pnp",
201 .match = pnp_bus_match, 203 .match = pnp_bus_match,
202 .probe = pnp_device_probe, 204 .probe = pnp_device_probe,
203 .remove = pnp_device_remove, 205 .remove = pnp_device_remove,
204 .suspend = pnp_bus_suspend, 206 .suspend = pnp_bus_suspend,
205 .resume = pnp_bus_resume, 207 .resume = pnp_bus_resume,
206}; 208};
207 209
208int pnp_register_driver(struct pnp_driver *drv) 210int pnp_register_driver(struct pnp_driver *drv)
@@ -225,12 +227,11 @@ void pnp_unregister_driver(struct pnp_driver *drv)
225 * pnp_add_id - adds an EISA id to the specified device 227 * pnp_add_id - adds an EISA id to the specified device
226 * @id: pointer to a pnp_id structure 228 * @id: pointer to a pnp_id structure
227 * @dev: pointer to the desired device 229 * @dev: pointer to the desired device
228 *
229 */ 230 */
230
231int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) 231int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
232{ 232{
233 struct pnp_id *ptr; 233 struct pnp_id *ptr;
234
234 if (!id) 235 if (!id)
235 return -EINVAL; 236 return -EINVAL;
236 if (!dev) 237 if (!dev)
@@ -248,8 +249,5 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
248 249
249EXPORT_SYMBOL(pnp_register_driver); 250EXPORT_SYMBOL(pnp_register_driver);
250EXPORT_SYMBOL(pnp_unregister_driver); 251EXPORT_SYMBOL(pnp_unregister_driver);
251#if 0
252EXPORT_SYMBOL(pnp_add_id);
253#endif
254EXPORT_SYMBOL(pnp_device_attach); 252EXPORT_SYMBOL(pnp_device_attach);
255EXPORT_SYMBOL(pnp_device_detach); 253EXPORT_SYMBOL(pnp_device_detach);
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index b6beb8a36da7..fe6684e13e82 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -3,7 +3,6 @@
3 * 3 *
4 * Some code, especially possible resource dumping is based on isapnp_proc.c (c) Jaroslav Kysela <perex@suse.cz> 4 * Some code, especially possible resource dumping is based on isapnp_proc.c (c) Jaroslav Kysela <perex@suse.cz>
5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
6 *
7 */ 6 */
8 7
9#include <linux/pnp.h> 8#include <linux/pnp.h>
@@ -488,6 +487,7 @@ static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL);
488int pnp_interface_attach_device(struct pnp_dev *dev) 487int pnp_interface_attach_device(struct pnp_dev *dev)
489{ 488{
490 int rc = device_create_file(&dev->dev, &dev_attr_options); 489 int rc = device_create_file(&dev->dev, &dev_attr_options);
490
491 if (rc) 491 if (rc)
492 goto err; 492 goto err;
493 rc = device_create_file(&dev->dev, &dev_attr_resources); 493 rc = device_create_file(&dev->dev, &dev_attr_resources);
diff --git a/drivers/pnp/isapnp/compat.c b/drivers/pnp/isapnp/compat.c
index aaf45e3ebee2..10bdcc4d4f7b 100644
--- a/drivers/pnp/isapnp/compat.c
+++ b/drivers/pnp/isapnp/compat.c
@@ -3,11 +3,8 @@
3 * the old isapnp APIs. If possible use the new APIs instead. 3 * the old isapnp APIs. If possible use the new APIs instead.
4 * 4 *
5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
6 *
7 */ 6 */
8 7
9/* TODO: see if more isapnp functions are needed here */
10
11#include <linux/module.h> 8#include <linux/module.h>
12#include <linux/isapnp.h> 9#include <linux/isapnp.h>
13#include <linux/string.h> 10#include <linux/string.h>
@@ -19,16 +16,17 @@ static void pnp_convert_id(char *buf, unsigned short vendor,
19 'A' + ((vendor >> 2) & 0x3f) - 1, 16 'A' + ((vendor >> 2) & 0x3f) - 1,
20 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, 17 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
21 'A' + ((vendor >> 8) & 0x1f) - 1, 18 'A' + ((vendor >> 8) & 0x1f) - 1,
22 (device >> 4) & 0x0f, 19 (device >> 4) & 0x0f, device & 0x0f,
23 device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f); 20 (device >> 12) & 0x0f, (device >> 8) & 0x0f);
24} 21}
25 22
26struct pnp_card *pnp_find_card(unsigned short vendor, 23struct pnp_card *pnp_find_card(unsigned short vendor, unsigned short device,
27 unsigned short device, struct pnp_card *from) 24 struct pnp_card *from)
28{ 25{
29 char id[8]; 26 char id[8];
30 char any[8]; 27 char any[8];
31 struct list_head *list; 28 struct list_head *list;
29
32 pnp_convert_id(id, vendor, device); 30 pnp_convert_id(id, vendor, device);
33 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID); 31 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
34 32
@@ -36,6 +34,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
36 34
37 while (list != &pnp_cards) { 35 while (list != &pnp_cards) {
38 struct pnp_card *card = global_to_pnp_card(list); 36 struct pnp_card *card = global_to_pnp_card(list);
37
39 if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0)) 38 if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0))
40 return card; 39 return card;
41 list = list->next; 40 list = list->next;
@@ -43,12 +42,12 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
43 return NULL; 42 return NULL;
44} 43}
45 44
46struct pnp_dev *pnp_find_dev(struct pnp_card *card, 45struct pnp_dev *pnp_find_dev(struct pnp_card *card, unsigned short vendor,
47 unsigned short vendor,
48 unsigned short function, struct pnp_dev *from) 46 unsigned short function, struct pnp_dev *from)
49{ 47{
50 char id[8]; 48 char id[8];
51 char any[8]; 49 char any[8];
50
52 pnp_convert_id(id, vendor, function); 51 pnp_convert_id(id, vendor, function);
53 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID); 52 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
54 if (card == NULL) { /* look for a logical device from all cards */ 53 if (card == NULL) { /* look for a logical device from all cards */
@@ -60,8 +59,9 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
60 59
61 while (list != &pnp_global) { 60 while (list != &pnp_global) {
62 struct pnp_dev *dev = global_to_pnp_dev(list); 61 struct pnp_dev *dev = global_to_pnp_dev(list);
63 if (compare_pnp_id(dev->id, id) 62
64 || (memcmp(id, any, 7) == 0)) 63 if (compare_pnp_id(dev->id, id) ||
64 (memcmp(id, any, 7) == 0))
65 return dev; 65 return dev;
66 list = list->next; 66 list = list->next;
67 } 67 }
@@ -76,6 +76,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
76 } 76 }
77 while (list != &card->devices) { 77 while (list != &card->devices) {
78 struct pnp_dev *dev = card_to_pnp_dev(list); 78 struct pnp_dev *dev = card_to_pnp_dev(list);
79
79 if (compare_pnp_id(dev->id, id)) 80 if (compare_pnp_id(dev->id, id))
80 return dev; 81 return dev;
81 list = list->next; 82 list = list->next;
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 0d690a7c0d24..b4e2aa995b53 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -252,7 +252,6 @@ static inline void isapnp_set_rdp(void)
252 * Perform an isolation. The port selection code now tries to avoid 252 * Perform an isolation. The port selection code now tries to avoid
253 * "dangerous to read" ports. 253 * "dangerous to read" ports.
254 */ 254 */
255
256static int __init isapnp_isolate_rdp_select(void) 255static int __init isapnp_isolate_rdp_select(void)
257{ 256{
258 isapnp_wait(); 257 isapnp_wait();
@@ -281,7 +280,6 @@ static int __init isapnp_isolate_rdp_select(void)
281/* 280/*
282 * Isolate (assign uniqued CSN) to all ISA PnP devices. 281 * Isolate (assign uniqued CSN) to all ISA PnP devices.
283 */ 282 */
284
285static int __init isapnp_isolate(void) 283static int __init isapnp_isolate(void)
286{ 284{
287 unsigned char checksum = 0x6a; 285 unsigned char checksum = 0x6a;
@@ -352,7 +350,6 @@ static int __init isapnp_isolate(void)
352/* 350/*
353 * Read one tag from stream. 351 * Read one tag from stream.
354 */ 352 */
355
356static int __init isapnp_read_tag(unsigned char *type, unsigned short *size) 353static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
357{ 354{
358 unsigned char tag, tmp[2]; 355 unsigned char tag, tmp[2];
@@ -380,7 +377,6 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
380/* 377/*
381 * Skip specified number of bytes from stream. 378 * Skip specified number of bytes from stream.
382 */ 379 */
383
384static void __init isapnp_skip_bytes(int count) 380static void __init isapnp_skip_bytes(int count)
385{ 381{
386 isapnp_peek(NULL, count); 382 isapnp_peek(NULL, count);
@@ -389,11 +385,11 @@ static void __init isapnp_skip_bytes(int count)
389/* 385/*
390 * Parse EISA id. 386 * Parse EISA id.
391 */ 387 */
392
393static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor, 388static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
394 unsigned short device) 389 unsigned short device)
395{ 390{
396 struct pnp_id *id; 391 struct pnp_id *id;
392
397 if (!dev) 393 if (!dev)
398 return; 394 return;
399 id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 395 id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
@@ -411,7 +407,6 @@ static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
411/* 407/*
412 * Parse logical device tag. 408 * Parse logical device tag.
413 */ 409 */
414
415static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card, 410static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
416 int size, int number) 411 int size, int number)
417{ 412{
@@ -440,7 +435,6 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
440/* 435/*
441 * Add IRQ resource to resources list. 436 * Add IRQ resource to resources list.
442 */ 437 */
443
444static void __init isapnp_parse_irq_resource(struct pnp_option *option, 438static void __init isapnp_parse_irq_resource(struct pnp_option *option,
445 int size) 439 int size)
446{ 440{
@@ -459,13 +453,11 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
459 else 453 else
460 irq->flags = IORESOURCE_IRQ_HIGHEDGE; 454 irq->flags = IORESOURCE_IRQ_HIGHEDGE;
461 pnp_register_irq_resource(option, irq); 455 pnp_register_irq_resource(option, irq);
462 return;
463} 456}
464 457
465/* 458/*
466 * Add DMA resource to resources list. 459 * Add DMA resource to resources list.
467 */ 460 */
468
469static void __init isapnp_parse_dma_resource(struct pnp_option *option, 461static void __init isapnp_parse_dma_resource(struct pnp_option *option,
470 int size) 462 int size)
471{ 463{
@@ -479,13 +471,11 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option,
479 dma->map = tmp[0]; 471 dma->map = tmp[0];
480 dma->flags = tmp[1]; 472 dma->flags = tmp[1];
481 pnp_register_dma_resource(option, dma); 473 pnp_register_dma_resource(option, dma);
482 return;
483} 474}
484 475
485/* 476/*
486 * Add port resource to resources list. 477 * Add port resource to resources list.
487 */ 478 */
488
489static void __init isapnp_parse_port_resource(struct pnp_option *option, 479static void __init isapnp_parse_port_resource(struct pnp_option *option,
490 int size) 480 int size)
491{ 481{
@@ -502,13 +492,11 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
502 port->size = tmp[6]; 492 port->size = tmp[6];
503 port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0; 493 port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
504 pnp_register_port_resource(option, port); 494 pnp_register_port_resource(option, port);
505 return;
506} 495}
507 496
508/* 497/*
509 * Add fixed port resource to resources list. 498 * Add fixed port resource to resources list.
510 */ 499 */
511
512static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option, 500static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
513 int size) 501 int size)
514{ 502{
@@ -524,13 +512,11 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
524 port->align = 0; 512 port->align = 0;
525 port->flags = PNP_PORT_FLAG_FIXED; 513 port->flags = PNP_PORT_FLAG_FIXED;
526 pnp_register_port_resource(option, port); 514 pnp_register_port_resource(option, port);
527 return;
528} 515}
529 516
530/* 517/*
531 * Add memory resource to resources list. 518 * Add memory resource to resources list.
532 */ 519 */
533
534static void __init isapnp_parse_mem_resource(struct pnp_option *option, 520static void __init isapnp_parse_mem_resource(struct pnp_option *option,
535 int size) 521 int size)
536{ 522{
@@ -547,13 +533,11 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
547 mem->size = ((tmp[8] << 8) | tmp[7]) << 8; 533 mem->size = ((tmp[8] << 8) | tmp[7]) << 8;
548 mem->flags = tmp[0]; 534 mem->flags = tmp[0];
549 pnp_register_mem_resource(option, mem); 535 pnp_register_mem_resource(option, mem);
550 return;
551} 536}
552 537
553/* 538/*
554 * Add 32-bit memory resource to resources list. 539 * Add 32-bit memory resource to resources list.
555 */ 540 */
556
557static void __init isapnp_parse_mem32_resource(struct pnp_option *option, 541static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
558 int size) 542 int size)
559{ 543{
@@ -577,7 +561,6 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
577/* 561/*
578 * Add 32-bit fixed memory resource to resources list. 562 * Add 32-bit fixed memory resource to resources list.
579 */ 563 */
580
581static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option, 564static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
582 int size) 565 int size)
583{ 566{
@@ -599,7 +582,6 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
599/* 582/*
600 * Parse card name for ISA PnP device. 583 * Parse card name for ISA PnP device.
601 */ 584 */
602
603static void __init 585static void __init
604isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size) 586isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
605{ 587{
@@ -619,7 +601,6 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
619/* 601/*
620 * Parse resource map for logical device. 602 * Parse resource map for logical device.
621 */ 603 */
622
623static int __init isapnp_create_device(struct pnp_card *card, 604static int __init isapnp_create_device(struct pnp_card *card,
624 unsigned short size) 605 unsigned short size)
625{ 606{
@@ -627,6 +608,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
627 unsigned char type, tmp[17]; 608 unsigned char type, tmp[17];
628 struct pnp_option *option; 609 struct pnp_option *option;
629 struct pnp_dev *dev; 610 struct pnp_dev *dev;
611
630 if ((dev = isapnp_parse_device(card, size, number++)) == NULL) 612 if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
631 return 1; 613 return 1;
632 option = pnp_register_independent_option(dev); 614 option = pnp_register_independent_option(dev);
@@ -761,7 +743,6 @@ static int __init isapnp_create_device(struct pnp_card *card,
761/* 743/*
762 * Parse resource map for ISA PnP card. 744 * Parse resource map for ISA PnP card.
763 */ 745 */
764
765static void __init isapnp_parse_resource_map(struct pnp_card *card) 746static void __init isapnp_parse_resource_map(struct pnp_card *card)
766{ 747{
767 unsigned char type, tmp[17]; 748 unsigned char type, tmp[17];
@@ -816,7 +797,6 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
816/* 797/*
817 * Compute ISA PnP checksum for first eight bytes. 798 * Compute ISA PnP checksum for first eight bytes.
818 */ 799 */
819
820static unsigned char __init isapnp_checksum(unsigned char *data) 800static unsigned char __init isapnp_checksum(unsigned char *data)
821{ 801{
822 int i, j; 802 int i, j;
@@ -839,11 +819,11 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
839/* 819/*
840 * Parse EISA id for ISA PnP card. 820 * Parse EISA id for ISA PnP card.
841 */ 821 */
842
843static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor, 822static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
844 unsigned short device) 823 unsigned short device)
845{ 824{
846 struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 825 struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
826
847 if (!id) 827 if (!id)
848 return; 828 return;
849 sprintf(id->id, "%c%c%c%x%x%x%x", 829 sprintf(id->id, "%c%c%c%x%x%x%x",
@@ -858,7 +838,6 @@ static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
858/* 838/*
859 * Build device list for all present ISA PnP devices. 839 * Build device list for all present ISA PnP devices.
860 */ 840 */
861
862static int __init isapnp_build_device_list(void) 841static int __init isapnp_build_device_list(void)
863{ 842{
864 int csn; 843 int csn;
@@ -911,6 +890,7 @@ static int __init isapnp_build_device_list(void)
911int isapnp_present(void) 890int isapnp_present(void)
912{ 891{
913 struct pnp_card *card; 892 struct pnp_card *card;
893
914 pnp_for_each_card(card) { 894 pnp_for_each_card(card) {
915 if (card->protocol == &isapnp_protocol) 895 if (card->protocol == &isapnp_protocol)
916 return 1; 896 return 1;
@@ -953,7 +933,7 @@ int isapnp_cfg_end(void)
953} 933}
954 934
955/* 935/*
956 * Inititialization. 936 * Initialization.
957 */ 937 */
958 938
959EXPORT_SYMBOL(isapnp_protocol); 939EXPORT_SYMBOL(isapnp_protocol);
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index fba4b072e6bd..3fbc0f9ffc26 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -2,7 +2,6 @@
2 * ISA Plug & Play support 2 * ISA Plug & Play support
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz> 3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 * 4 *
5 *
6 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; either version 2 of the License, or
@@ -16,7 +15,6 @@
16 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */ 18 */
21 19
22#include <linux/module.h> 20#include <linux/module.h>
@@ -139,11 +137,12 @@ static int __exit isapnp_proc_detach_bus(struct pnp_card *bus)
139 remove_proc_entry(name, isapnp_proc_bus_dir); 137 remove_proc_entry(name, isapnp_proc_bus_dir);
140 return 0; 138 return 0;
141} 139}
142#endif /* MODULE */ 140#endif /* MODULE */
143 141
144int __init isapnp_proc_init(void) 142int __init isapnp_proc_init(void)
145{ 143{
146 struct pnp_dev *dev; 144 struct pnp_dev *dev;
145
147 isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus); 146 isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
148 protocol_for_each_dev(&isapnp_protocol, dev) { 147 protocol_for_each_dev(&isapnp_protocol, dev) {
149 isapnp_proc_attach_device(dev); 148 isapnp_proc_attach_device(dev);
@@ -167,4 +166,4 @@ int __exit isapnp_proc_done(void)
167 remove_proc_entry("isapnp", proc_bus); 166 remove_proc_entry("isapnp", proc_bus);
168 return 0; 167 return 0;
169} 168}
170#endif /* MODULE */ 169#endif /* MODULE */
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);
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 423c8e7e322d..6a2a3c2f4d5e 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -34,9 +34,9 @@ static int num = 0;
34 * used by the kernel (PCI root, ...), as it is harmless and there were 34 * used by the kernel (PCI root, ...), as it is harmless and there were
35 * already present in pnpbios. But there is an exception for devices that 35 * already present in pnpbios. But there is an exception for devices that
36 * have irqs (PIC, Timer) because we call acpi_register_gsi. 36 * have irqs (PIC, Timer) because we call acpi_register_gsi.
37 * Finaly only devices that have a CRS method need to be in this list. 37 * Finally, only devices that have a CRS method need to be in this list.
38 */ 38 */
39static __initdata struct acpi_device_id excluded_id_list[] = { 39static struct __initdata acpi_device_id excluded_id_list[] = {
40 {"PNP0C09", 0}, /* EC */ 40 {"PNP0C09", 0}, /* EC */
41 {"PNP0C0F", 0}, /* Link device */ 41 {"PNP0C0F", 0}, /* Link device */
42 {"PNP0000", 0}, /* PIC */ 42 {"PNP0000", 0}, /* PIC */
@@ -88,6 +88,7 @@ static int pnpacpi_get_resources(struct pnp_dev *dev,
88 struct pnp_resource_table *res) 88 struct pnp_resource_table *res)
89{ 89{
90 acpi_status status; 90 acpi_status status;
91
91 status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data, 92 status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data,
92 &dev->res); 93 &dev->res);
93 return ACPI_FAILURE(status) ? -ENODEV : 0; 94 return ACPI_FAILURE(status) ? -ENODEV : 0;
@@ -141,9 +142,9 @@ static int pnpacpi_resume(struct pnp_dev *dev)
141} 142}
142 143
143static struct pnp_protocol pnpacpi_protocol = { 144static struct pnp_protocol pnpacpi_protocol = {
144 .name = "Plug and Play ACPI", 145 .name = "Plug and Play ACPI",
145 .get = pnpacpi_get_resources, 146 .get = pnpacpi_get_resources,
146 .set = pnpacpi_set_resources, 147 .set = pnpacpi_set_resources,
147 .disable = pnpacpi_disable_resources, 148 .disable = pnpacpi_disable_resources,
148 .suspend = pnpacpi_suspend, 149 .suspend = pnpacpi_suspend,
149 .resume = pnpacpi_resume, 150 .resume = pnpacpi_resume,
@@ -168,7 +169,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
168 return -ENOMEM; 169 return -ENOMEM;
169 } 170 }
170 dev->data = device->handle; 171 dev->data = device->handle;
171 /* .enabled means if the device can decode the resources */ 172 /* .enabled means the device can decode the resources */
172 dev->active = device->status.enabled; 173 dev->active = device->status.enabled;
173 status = acpi_get_handle(device->handle, "_SRS", &temp); 174 status = acpi_get_handle(device->handle, "_SRS", &temp);
174 if (ACPI_SUCCESS(status)) 175 if (ACPI_SUCCESS(status))
@@ -200,8 +201,8 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
200 201
201 if (dev->active) { 202 if (dev->active) {
202 /* parse allocated resource */ 203 /* parse allocated resource */
203 status = 204 status = pnpacpi_parse_allocated_resource(device->handle,
204 pnpacpi_parse_allocated_resource(device->handle, &dev->res); 205 &dev->res);
205 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { 206 if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
206 pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s", 207 pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
207 dev_id->id); 208 dev_id->id);
@@ -294,7 +295,7 @@ static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle)
294 * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling. 295 * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling.
295 */ 296 */
296static struct acpi_bus_type __initdata acpi_pnp_bus = { 297static struct acpi_bus_type __initdata acpi_pnp_bus = {
297 .bus = &pnp_bus_type, 298 .bus = &pnp_bus_type,
298 .find_device = acpi_pnp_find_device, 299 .find_device = acpi_pnp_find_device,
299}; 300};
300 301
@@ -327,7 +328,3 @@ static int __init pnpacpi_setup(char *str)
327} 328}
328 329
329__setup("pnpacpi=", pnpacpi_setup); 330__setup("pnpacpi=", pnpacpi_setup);
330
331#if 0
332EXPORT_SYMBOL(pnpacpi_protocol);
333#endif
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 2f0d66886404..ce5027feb3da 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -71,9 +71,9 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity)
71 } 71 }
72} 72}
73 73
74static void 74static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
75pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, 75 u32 gsi, int triggering,
76 int triggering, int polarity, int shareable) 76 int polarity, int shareable)
77{ 77{
78 int i = 0; 78 int i = 0;
79 int irq; 79 int irq;
@@ -146,11 +146,12 @@ static int dma_flags(int type, int bus_master, int transfer)
146 return flags; 146 return flags;
147} 147}
148 148
149static void 149static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
150pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma, 150 u32 dma, int type,
151 int type, int bus_master, int transfer) 151 int bus_master, int transfer)
152{ 152{
153 int i = 0; 153 int i = 0;
154
154 while (i < PNP_MAX_DMA && 155 while (i < PNP_MAX_DMA &&
155 !(res->dma_resource[i].flags & IORESOURCE_UNSET)) 156 !(res->dma_resource[i].flags & IORESOURCE_UNSET))
156 i++; 157 i++;
@@ -167,11 +168,11 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma,
167 } 168 }
168} 169}
169 170
170static void 171static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
171pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, 172 u64 io, u64 len, int io_decode)
172 u64 io, u64 len, int io_decode)
173{ 173{
174 int i = 0; 174 int i = 0;
175
175 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && 176 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
176 i < PNP_MAX_PORT) 177 i < PNP_MAX_PORT)
177 i++; 178 i++;
@@ -188,11 +189,12 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
188 } 189 }
189} 190}
190 191
191static void 192static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
192pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, 193 u64 mem, u64 len,
193 u64 mem, u64 len, int write_protect) 194 int write_protect)
194{ 195{
195 int i = 0; 196 int i = 0;
197
196 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && 198 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
197 (i < PNP_MAX_MEM)) 199 (i < PNP_MAX_MEM))
198 i++; 200 i++;
@@ -210,9 +212,8 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
210 } 212 }
211} 213}
212 214
213static void 215static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
214pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, 216 struct acpi_resource *res)
215 struct acpi_resource *res)
216{ 217{
217 struct acpi_resource_address64 addr, *p = &addr; 218 struct acpi_resource_address64 addr, *p = &addr;
218 acpi_status status; 219 acpi_status status;
@@ -229,16 +230,13 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
229 230
230 if (p->resource_type == ACPI_MEMORY_RANGE) 231 if (p->resource_type == ACPI_MEMORY_RANGE)
231 pnpacpi_parse_allocated_memresource(res_table, 232 pnpacpi_parse_allocated_memresource(res_table,
232 p->minimum, 233 p->minimum, p->address_length,
233 p->address_length, 234 p->info.mem.write_protect);
234 p->info.mem.write_protect);
235 else if (p->resource_type == ACPI_IO_RANGE) 235 else if (p->resource_type == ACPI_IO_RANGE)
236 pnpacpi_parse_allocated_ioresource(res_table, 236 pnpacpi_parse_allocated_ioresource(res_table,
237 p->minimum, 237 p->minimum, p->address_length,
238 p->address_length, 238 p->granularity == 0xfff ? ACPI_DECODE_10 :
239 p->granularity == 239 ACPI_DECODE_16);
240 0xfff ? ACPI_DECODE_10 :
241 ACPI_DECODE_16);
242} 240}
243 241
244static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 242static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
@@ -256,34 +254,27 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
256 */ 254 */
257 for (i = 0; i < res->data.irq.interrupt_count; i++) { 255 for (i = 0; i < res->data.irq.interrupt_count; i++) {
258 pnpacpi_parse_allocated_irqresource(res_table, 256 pnpacpi_parse_allocated_irqresource(res_table,
259 res->data.irq. 257 res->data.irq.interrupts[i],
260 interrupts[i], 258 res->data.irq.triggering,
261 res->data.irq. 259 res->data.irq.polarity,
262 triggering, 260 res->data.irq.sharable);
263 res->data.irq.
264 polarity,
265 res->data.irq.
266 sharable);
267 } 261 }
268 break; 262 break;
269 263
270 case ACPI_RESOURCE_TYPE_DMA: 264 case ACPI_RESOURCE_TYPE_DMA:
271 if (res->data.dma.channel_count > 0) 265 if (res->data.dma.channel_count > 0)
272 pnpacpi_parse_allocated_dmaresource(res_table, 266 pnpacpi_parse_allocated_dmaresource(res_table,
273 res->data.dma. 267 res->data.dma.channels[0],
274 channels[0], 268 res->data.dma.type,
275 res->data.dma.type, 269 res->data.dma.bus_master,
276 res->data.dma. 270 res->data.dma.transfer);
277 bus_master,
278 res->data.dma.
279 transfer);
280 break; 271 break;
281 272
282 case ACPI_RESOURCE_TYPE_IO: 273 case ACPI_RESOURCE_TYPE_IO:
283 pnpacpi_parse_allocated_ioresource(res_table, 274 pnpacpi_parse_allocated_ioresource(res_table,
284 res->data.io.minimum, 275 res->data.io.minimum,
285 res->data.io.address_length, 276 res->data.io.address_length,
286 res->data.io.io_decode); 277 res->data.io.io_decode);
287 break; 278 break;
288 279
289 case ACPI_RESOURCE_TYPE_START_DEPENDENT: 280 case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -292,10 +283,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
292 283
293 case ACPI_RESOURCE_TYPE_FIXED_IO: 284 case ACPI_RESOURCE_TYPE_FIXED_IO:
294 pnpacpi_parse_allocated_ioresource(res_table, 285 pnpacpi_parse_allocated_ioresource(res_table,
295 res->data.fixed_io.address, 286 res->data.fixed_io.address,
296 res->data.fixed_io. 287 res->data.fixed_io.address_length,
297 address_length, 288 ACPI_DECODE_10);
298 ACPI_DECODE_10);
299 break; 289 break;
300 290
301 case ACPI_RESOURCE_TYPE_VENDOR: 291 case ACPI_RESOURCE_TYPE_VENDOR:
@@ -306,28 +296,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
306 296
307 case ACPI_RESOURCE_TYPE_MEMORY24: 297 case ACPI_RESOURCE_TYPE_MEMORY24:
308 pnpacpi_parse_allocated_memresource(res_table, 298 pnpacpi_parse_allocated_memresource(res_table,
309 res->data.memory24.minimum, 299 res->data.memory24.minimum,
310 res->data.memory24. 300 res->data.memory24.address_length,
311 address_length, 301 res->data.memory24.write_protect);
312 res->data.memory24.
313 write_protect);
314 break; 302 break;
315 case ACPI_RESOURCE_TYPE_MEMORY32: 303 case ACPI_RESOURCE_TYPE_MEMORY32:
316 pnpacpi_parse_allocated_memresource(res_table, 304 pnpacpi_parse_allocated_memresource(res_table,
317 res->data.memory32.minimum, 305 res->data.memory32.minimum,
318 res->data.memory32. 306 res->data.memory32.address_length,
319 address_length, 307 res->data.memory32.write_protect);
320 res->data.memory32.
321 write_protect);
322 break; 308 break;
323 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: 309 case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
324 pnpacpi_parse_allocated_memresource(res_table, 310 pnpacpi_parse_allocated_memresource(res_table,
325 res->data.fixed_memory32. 311 res->data.fixed_memory32.address,
326 address, 312 res->data.fixed_memory32.address_length,
327 res->data.fixed_memory32. 313 res->data.fixed_memory32.write_protect);
328 address_length,
329 res->data.fixed_memory32.
330 write_protect);
331 break; 314 break;
332 case ACPI_RESOURCE_TYPE_ADDRESS16: 315 case ACPI_RESOURCE_TYPE_ADDRESS16:
333 case ACPI_RESOURCE_TYPE_ADDRESS32: 316 case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -346,18 +329,10 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
346 329
347 for (i = 0; i < res->data.extended_irq.interrupt_count; i++) { 330 for (i = 0; i < res->data.extended_irq.interrupt_count; i++) {
348 pnpacpi_parse_allocated_irqresource(res_table, 331 pnpacpi_parse_allocated_irqresource(res_table,
349 res->data. 332 res->data.extended_irq.interrupts[i],
350 extended_irq. 333 res->data.extended_irq.triggering,
351 interrupts[i], 334 res->data.extended_irq.polarity,
352 res->data. 335 res->data.extended_irq.sharable);
353 extended_irq.
354 triggering,
355 res->data.
356 extended_irq.
357 polarity,
358 res->data.
359 extended_irq.
360 sharable);
361 } 336 }
362 break; 337 break;
363 338
@@ -400,7 +375,6 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option,
400 dma->flags = dma_flags(p->type, p->bus_master, p->transfer); 375 dma->flags = dma_flags(p->type, p->bus_master, p->transfer);
401 376
402 pnp_register_dma_resource(option, dma); 377 pnp_register_dma_resource(option, dma);
403 return;
404} 378}
405 379
406static void pnpacpi_parse_irq_option(struct pnp_option *option, 380static void pnpacpi_parse_irq_option(struct pnp_option *option,
@@ -421,7 +395,6 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
421 irq->flags = irq_flags(p->triggering, p->polarity); 395 irq->flags = irq_flags(p->triggering, p->polarity);
422 396
423 pnp_register_irq_resource(option, irq); 397 pnp_register_irq_resource(option, irq);
424 return;
425} 398}
426 399
427static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, 400static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
@@ -442,12 +415,10 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
442 irq->flags = irq_flags(p->triggering, p->polarity); 415 irq->flags = irq_flags(p->triggering, p->polarity);
443 416
444 pnp_register_irq_resource(option, irq); 417 pnp_register_irq_resource(option, irq);
445 return;
446} 418}
447 419
448static void 420static void pnpacpi_parse_port_option(struct pnp_option *option,
449pnpacpi_parse_port_option(struct pnp_option *option, 421 struct acpi_resource_io *io)
450 struct acpi_resource_io *io)
451{ 422{
452 struct pnp_port *port; 423 struct pnp_port *port;
453 424
@@ -463,12 +434,10 @@ pnpacpi_parse_port_option(struct pnp_option *option,
463 port->flags = ACPI_DECODE_16 == io->io_decode ? 434 port->flags = ACPI_DECODE_16 == io->io_decode ?
464 PNP_PORT_FLAG_16BITADDR : 0; 435 PNP_PORT_FLAG_16BITADDR : 0;
465 pnp_register_port_resource(option, port); 436 pnp_register_port_resource(option, port);
466 return;
467} 437}
468 438
469static void 439static void pnpacpi_parse_fixed_port_option(struct pnp_option *option,
470pnpacpi_parse_fixed_port_option(struct pnp_option *option, 440 struct acpi_resource_fixed_io *io)
471 struct acpi_resource_fixed_io *io)
472{ 441{
473 struct pnp_port *port; 442 struct pnp_port *port;
474 443
@@ -482,12 +451,10 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
482 port->align = 0; 451 port->align = 0;
483 port->flags = PNP_PORT_FLAG_FIXED; 452 port->flags = PNP_PORT_FLAG_FIXED;
484 pnp_register_port_resource(option, port); 453 pnp_register_port_resource(option, port);
485 return;
486} 454}
487 455
488static void 456static void pnpacpi_parse_mem24_option(struct pnp_option *option,
489pnpacpi_parse_mem24_option(struct pnp_option *option, 457 struct acpi_resource_memory24 *p)
490 struct acpi_resource_memory24 *p)
491{ 458{
492 struct pnp_mem *mem; 459 struct pnp_mem *mem;
493 460
@@ -505,12 +472,10 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
505 IORESOURCE_MEM_WRITEABLE : 0; 472 IORESOURCE_MEM_WRITEABLE : 0;
506 473
507 pnp_register_mem_resource(option, mem); 474 pnp_register_mem_resource(option, mem);
508 return;
509} 475}
510 476
511static void 477static void pnpacpi_parse_mem32_option(struct pnp_option *option,
512pnpacpi_parse_mem32_option(struct pnp_option *option, 478 struct acpi_resource_memory32 *p)
513 struct acpi_resource_memory32 *p)
514{ 479{
515 struct pnp_mem *mem; 480 struct pnp_mem *mem;
516 481
@@ -528,12 +493,10 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
528 IORESOURCE_MEM_WRITEABLE : 0; 493 IORESOURCE_MEM_WRITEABLE : 0;
529 494
530 pnp_register_mem_resource(option, mem); 495 pnp_register_mem_resource(option, mem);
531 return;
532} 496}
533 497
534static void 498static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
535pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, 499 struct acpi_resource_fixed_memory32 *p)
536 struct acpi_resource_fixed_memory32 *p)
537{ 500{
538 struct pnp_mem *mem; 501 struct pnp_mem *mem;
539 502
@@ -550,11 +513,10 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
550 IORESOURCE_MEM_WRITEABLE : 0; 513 IORESOURCE_MEM_WRITEABLE : 0;
551 514
552 pnp_register_mem_resource(option, mem); 515 pnp_register_mem_resource(option, mem);
553 return;
554} 516}
555 517
556static void 518static void pnpacpi_parse_address_option(struct pnp_option *option,
557pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) 519 struct acpi_resource *r)
558{ 520{
559 struct acpi_resource_address64 addr, *p = &addr; 521 struct acpi_resource_address64 addr, *p = &addr;
560 acpi_status status; 522 acpi_status status;
@@ -635,7 +597,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
635 priority = PNP_RES_PRIORITY_INVALID; 597 priority = PNP_RES_PRIORITY_INVALID;
636 break; 598 break;
637 } 599 }
638 /* TBD: Considering performace/robustness bits */ 600 /* TBD: Consider performance/robustness bits */
639 option = pnp_register_dependent_option(dev, priority); 601 option = pnp_register_dependent_option(dev, priority);
640 if (!option) 602 if (!option)
641 return AE_ERROR; 603 return AE_ERROR;
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index d546f79d4d3b..5dba68fe33f5 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
+++ b/drivers/pnp/pnpbios/bioscalls.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * bioscalls.c - the lowlevel layer of the PnPBIOS driver 2 * bioscalls.c - the lowlevel layer of the PnPBIOS driver
3 *
4 */ 3 */
5 4
6#include <linux/types.h> 5#include <linux/types.h>
@@ -52,7 +51,8 @@ __asm__(".text \n"
52 " pushl %eax \n" 51 " pushl %eax \n"
53 " lcallw *pnp_bios_callpoint\n" 52 " lcallw *pnp_bios_callpoint\n"
54 " addl $16, %esp \n" 53 " addl $16, %esp \n"
55 " lret \n" ".previous \n"); 54 " lret \n"
55 ".previous \n");
56 56
57#define Q2_SET_SEL(cpu, selname, address, size) \ 57#define Q2_SET_SEL(cpu, selname, address, size) \
58do { \ 58do { \
@@ -125,7 +125,8 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
125 "popl %%es\n\t" 125 "popl %%es\n\t"
126 "popl %%ds\n\t" 126 "popl %%ds\n\t"
127 "popl %%esi\n\t" 127 "popl %%esi\n\t"
128 "popl %%edi\n\t" "popl %%ebp\n\t":"=a"(status) 128 "popl %%edi\n\t"
129 "popl %%ebp\n\t":"=a"(status)
129 :"0"((func) | (((u32) arg1) << 16)), 130 :"0"((func) | (((u32) arg1) << 16)),
130 "b"((arg2) | (((u32) arg3) << 16)), 131 "b"((arg2) | (((u32) arg3) << 16)),
131 "c"((arg4) | (((u32) arg5) << 16)), 132 "c"((arg4) | (((u32) arg5) << 16)),
@@ -253,12 +254,12 @@ void pnpbios_print_status(const char *module, u16 status)
253static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data) 254static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
254{ 255{
255 u16 status; 256 u16 status;
257
256 if (!pnp_bios_present()) 258 if (!pnp_bios_present())
257 return PNP_FUNCTION_NOT_SUPPORTED; 259 return PNP_FUNCTION_NOT_SUPPORTED;
258 status = 260 status = call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2,
259 call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, PNP_TS1, 261 PNP_TS1, PNP_DS, 0, 0, data,
260 PNP_DS, 0, 0, data, sizeof(struct pnp_dev_node_info), 262 sizeof(struct pnp_dev_node_info), NULL, 0);
261 NULL, 0);
262 data->no_nodes &= 0xff; 263 data->no_nodes &= 0xff;
263 return status; 264 return status;
264} 265}
@@ -266,6 +267,7 @@ static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
266int pnp_bios_dev_node_info(struct pnp_dev_node_info *data) 267int pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
267{ 268{
268 int status = __pnp_bios_dev_node_info(data); 269 int status = __pnp_bios_dev_node_info(data);
270
269 if (status) 271 if (status)
270 pnpbios_print_status("dev_node_info", status); 272 pnpbios_print_status("dev_node_info", status);
271 return status; 273 return status;
@@ -285,27 +287,28 @@ int pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
285 * or volatile current (0) config 287 * or volatile current (0) config
286 * Output: *nodenum=next node or 0xff if no more nodes 288 * Output: *nodenum=next node or 0xff if no more nodes
287 */ 289 */
288static int __pnp_bios_get_dev_node(u8 * nodenum, char boot, 290static int __pnp_bios_get_dev_node(u8 *nodenum, char boot,
289 struct pnp_bios_node *data) 291 struct pnp_bios_node *data)
290{ 292{
291 u16 status; 293 u16 status;
292 u16 tmp_nodenum; 294 u16 tmp_nodenum;
295
293 if (!pnp_bios_present()) 296 if (!pnp_bios_present())
294 return PNP_FUNCTION_NOT_SUPPORTED; 297 return PNP_FUNCTION_NOT_SUPPORTED;
295 if (!boot && pnpbios_dont_use_current_config) 298 if (!boot && pnpbios_dont_use_current_config)
296 return PNP_FUNCTION_NOT_SUPPORTED; 299 return PNP_FUNCTION_NOT_SUPPORTED;
297 tmp_nodenum = *nodenum; 300 tmp_nodenum = *nodenum;
298 status = 301 status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2,
299 call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, 302 boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum,
300 boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum, 303 sizeof(tmp_nodenum), data, 65536);
301 sizeof(tmp_nodenum), data, 65536);
302 *nodenum = tmp_nodenum; 304 *nodenum = tmp_nodenum;
303 return status; 305 return status;
304} 306}
305 307
306int pnp_bios_get_dev_node(u8 * nodenum, char boot, struct pnp_bios_node *data) 308int pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data)
307{ 309{
308 int status; 310 int status;
311
309 status = __pnp_bios_get_dev_node(nodenum, boot, data); 312 status = __pnp_bios_get_dev_node(nodenum, boot, data);
310 if (status) 313 if (status)
311 pnpbios_print_status("get_dev_node", status); 314 pnpbios_print_status("get_dev_node", status);
@@ -322,19 +325,21 @@ static int __pnp_bios_set_dev_node(u8 nodenum, char boot,
322 struct pnp_bios_node *data) 325 struct pnp_bios_node *data)
323{ 326{
324 u16 status; 327 u16 status;
328
325 if (!pnp_bios_present()) 329 if (!pnp_bios_present())
326 return PNP_FUNCTION_NOT_SUPPORTED; 330 return PNP_FUNCTION_NOT_SUPPORTED;
327 if (!boot && pnpbios_dont_use_current_config) 331 if (!boot && pnpbios_dont_use_current_config)
328 return PNP_FUNCTION_NOT_SUPPORTED; 332 return PNP_FUNCTION_NOT_SUPPORTED;
329 status = 333 status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1,
330 call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, 334 boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL,
331 boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL, 0); 335 0);
332 return status; 336 return status;
333} 337}
334 338
335int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data) 339int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
336{ 340{
337 int status; 341 int status;
342
338 status = __pnp_bios_set_dev_node(nodenum, boot, data); 343 status = __pnp_bios_set_dev_node(nodenum, boot, data);
339 if (status) { 344 if (status) {
340 pnpbios_print_status("set_dev_node", status); 345 pnpbios_print_status("set_dev_node", status);
@@ -348,68 +353,21 @@ int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
348 return status; 353 return status;
349} 354}
350 355
351#if needed
352/*
353 * Call PnP BIOS with function 0x03, "get event"
354 */
355static int pnp_bios_get_event(u16 * event)
356{
357 u16 status;
358 if (!pnp_bios_present())
359 return PNP_FUNCTION_NOT_SUPPORTED;
360 status = call_pnp_bios(PNP_GET_EVENT, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
361 event, sizeof(u16), NULL, 0);
362 return status;
363}
364#endif
365
366#if needed
367/*
368 * Call PnP BIOS with function 0x04, "send message"
369 */
370static int pnp_bios_send_message(u16 message)
371{
372 u16 status;
373 if (!pnp_bios_present())
374 return PNP_FUNCTION_NOT_SUPPORTED;
375 status =
376 call_pnp_bios(PNP_SEND_MESSAGE, message, PNP_DS, 0, 0, 0, 0, 0, 0,
377 0, 0, 0);
378 return status;
379}
380#endif
381
382/* 356/*
383 * Call PnP BIOS with function 0x05, "get docking station information" 357 * Call PnP BIOS with function 0x05, "get docking station information"
384 */ 358 */
385int pnp_bios_dock_station_info(struct pnp_docking_station_info *data) 359int pnp_bios_dock_station_info(struct pnp_docking_station_info *data)
386{ 360{
387 u16 status; 361 u16 status;
388 if (!pnp_bios_present())
389 return PNP_FUNCTION_NOT_SUPPORTED;
390 status =
391 call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1,
392 PNP_DS, 0, 0, 0, 0, data,
393 sizeof(struct pnp_docking_station_info), NULL, 0);
394 return status;
395}
396 362
397#if needed
398/*
399 * Call PnP BIOS with function 0x09, "set statically allocated resource
400 * information"
401 */
402static int pnp_bios_set_stat_res(char *info)
403{
404 u16 status;
405 if (!pnp_bios_present()) 363 if (!pnp_bios_present())
406 return PNP_FUNCTION_NOT_SUPPORTED; 364 return PNP_FUNCTION_NOT_SUPPORTED;
407 status = 365 status = call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1,
408 call_pnp_bios(PNP_SET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 366 PNP_DS, 0, 0, 0, 0, data,
409 0, 0, 0, 0, info, *((u16 *) info), 0, 0); 367 sizeof(struct pnp_docking_station_info), NULL,
368 0);
410 return status; 369 return status;
411} 370}
412#endif
413 371
414/* 372/*
415 * Call PnP BIOS with function 0x0a, "get statically allocated resource 373 * Call PnP BIOS with function 0x0a, "get statically allocated resource
@@ -418,57 +376,43 @@ static int pnp_bios_set_stat_res(char *info)
418static int __pnp_bios_get_stat_res(char *info) 376static int __pnp_bios_get_stat_res(char *info)
419{ 377{
420 u16 status; 378 u16 status;
379
421 if (!pnp_bios_present()) 380 if (!pnp_bios_present())
422 return PNP_FUNCTION_NOT_SUPPORTED; 381 return PNP_FUNCTION_NOT_SUPPORTED;
423 status = 382 status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1,
424 call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 383 PNP_DS, 0, 0, 0, 0, info, 65536, NULL, 0);
425 0, 0, 0, 0, info, 65536, NULL, 0);
426 return status; 384 return status;
427} 385}
428 386
429int pnp_bios_get_stat_res(char *info) 387int pnp_bios_get_stat_res(char *info)
430{ 388{
431 int status; 389 int status;
390
432 status = __pnp_bios_get_stat_res(info); 391 status = __pnp_bios_get_stat_res(info);
433 if (status) 392 if (status)
434 pnpbios_print_status("get_stat_res", status); 393 pnpbios_print_status("get_stat_res", status);
435 return status; 394 return status;
436} 395}
437 396
438#if needed
439/*
440 * Call PnP BIOS with function 0x0b, "get APM id table"
441 */
442static int pnp_bios_apm_id_table(char *table, u16 * size)
443{
444 u16 status;
445 if (!pnp_bios_present())
446 return PNP_FUNCTION_NOT_SUPPORTED;
447 status =
448 call_pnp_bios(PNP_GET_APM_ID_TABLE, 0, PNP_TS2, 0, PNP_TS1, PNP_DS,
449 0, 0, table, *size, size, sizeof(u16));
450 return status;
451}
452#endif
453
454/* 397/*
455 * Call PnP BIOS with function 0x40, "get isa pnp configuration structure" 398 * Call PnP BIOS with function 0x40, "get isa pnp configuration structure"
456 */ 399 */
457static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) 400static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
458{ 401{
459 u16 status; 402 u16 status;
403
460 if (!pnp_bios_present()) 404 if (!pnp_bios_present())
461 return PNP_FUNCTION_NOT_SUPPORTED; 405 return PNP_FUNCTION_NOT_SUPPORTED;
462 status = 406 status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS,
463 call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, 407 0, 0, 0, 0, data,
464 0, 0, 0, data, sizeof(struct pnp_isa_config_struc), 408 sizeof(struct pnp_isa_config_struc), NULL, 0);
465 NULL, 0);
466 return status; 409 return status;
467} 410}
468 411
469int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data) 412int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
470{ 413{
471 int status; 414 int status;
415
472 status = __pnp_bios_isapnp_config(data); 416 status = __pnp_bios_isapnp_config(data);
473 if (status) 417 if (status)
474 pnpbios_print_status("isapnp_config", status); 418 pnpbios_print_status("isapnp_config", status);
@@ -481,18 +425,19 @@ int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
481static int __pnp_bios_escd_info(struct escd_info_struc *data) 425static int __pnp_bios_escd_info(struct escd_info_struc *data)
482{ 426{
483 u16 status; 427 u16 status;
428
484 if (!pnp_bios_present()) 429 if (!pnp_bios_present())
485 return ESCD_FUNCTION_NOT_SUPPORTED; 430 return ESCD_FUNCTION_NOT_SUPPORTED;
486 status = 431 status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4,
487 call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, PNP_TS1, 432 PNP_TS1, PNP_DS, data,
488 PNP_DS, data, sizeof(struct escd_info_struc), NULL, 433 sizeof(struct escd_info_struc), NULL, 0);
489 0);
490 return status; 434 return status;
491} 435}
492 436
493int pnp_bios_escd_info(struct escd_info_struc *data) 437int pnp_bios_escd_info(struct escd_info_struc *data)
494{ 438{
495 int status; 439 int status;
440
496 status = __pnp_bios_escd_info(data); 441 status = __pnp_bios_escd_info(data);
497 if (status) 442 if (status)
498 pnpbios_print_status("escd_info", status); 443 pnpbios_print_status("escd_info", status);
@@ -506,46 +451,28 @@ int pnp_bios_escd_info(struct escd_info_struc *data)
506static int __pnp_bios_read_escd(char *data, u32 nvram_base) 451static int __pnp_bios_read_escd(char *data, u32 nvram_base)
507{ 452{
508 u16 status; 453 u16 status;
454
509 if (!pnp_bios_present()) 455 if (!pnp_bios_present())
510 return ESCD_FUNCTION_NOT_SUPPORTED; 456 return ESCD_FUNCTION_NOT_SUPPORTED;
511 status = 457 status = call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0,
512 call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0, 458 0, data, 65536, __va(nvram_base), 65536);
513 data, 65536, __va(nvram_base), 65536);
514 return status; 459 return status;
515} 460}
516 461
517int pnp_bios_read_escd(char *data, u32 nvram_base) 462int pnp_bios_read_escd(char *data, u32 nvram_base)
518{ 463{
519 int status; 464 int status;
465
520 status = __pnp_bios_read_escd(data, nvram_base); 466 status = __pnp_bios_read_escd(data, nvram_base);
521 if (status) 467 if (status)
522 pnpbios_print_status("read_escd", status); 468 pnpbios_print_status("read_escd", status);
523 return status; 469 return status;
524} 470}
525 471
526#if needed
527/*
528 * Call PnP BIOS function 0x43, "write ESCD"
529 */
530static int pnp_bios_write_escd(char *data, u32 nvram_base)
531{
532 u16 status;
533 if (!pnp_bios_present())
534 return ESCD_FUNCTION_NOT_SUPPORTED;
535 status =
536 call_pnp_bios(PNP_WRITE_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0,
537 data, 65536, __va(nvram_base), 65536);
538 return status;
539}
540#endif
541
542/*
543 * Initialization
544 */
545
546void pnpbios_calls_init(union pnp_bios_install_struct *header) 472void pnpbios_calls_init(union pnp_bios_install_struct *header)
547{ 473{
548 int i; 474 int i;
475
549 spin_lock_init(&pnp_bios_lock); 476 spin_lock_init(&pnp_bios_lock);
550 pnp_bios_callpoint.offset = header->fields.pm16offset; 477 pnp_bios_callpoint.offset = header->fields.pm16offset;
551 pnp_bios_callpoint.segment = PNP_CS16; 478 pnp_bios_callpoint.segment = PNP_CS16;
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 21289cb13a33..3692a099b45f 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -100,25 +100,24 @@ static struct completion unload_sem;
100/* 100/*
101 * (Much of this belongs in a shared routine somewhere) 101 * (Much of this belongs in a shared routine somewhere)
102 */ 102 */
103
104static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) 103static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
105{ 104{
106 char *argv[3], **envp, *buf, *scratch; 105 char *argv[3], **envp, *buf, *scratch;
107 int i = 0, value; 106 int i = 0, value;
108 107
109 if (!current->fs->root) { 108 if (!current->fs->root)
110 return -EAGAIN; 109 return -EAGAIN;
111 } 110 if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL)))
112 if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL))) {
113 return -ENOMEM; 111 return -ENOMEM;
114 }
115 if (!(buf = kzalloc(256, GFP_KERNEL))) { 112 if (!(buf = kzalloc(256, GFP_KERNEL))) {
116 kfree(envp); 113 kfree(envp);
117 return -ENOMEM; 114 return -ENOMEM;
118 } 115 }
119 116
120 /* FIXME: if there are actual users of this, it should be integrated into 117 /* FIXME: if there are actual users of this, it should be
121 * the driver core and use the usual infrastructure like sysfs and uevents */ 118 * integrated into the driver core and use the usual infrastructure
119 * like sysfs and uevents
120 */
122 argv[0] = "/sbin/pnpbios"; 121 argv[0] = "/sbin/pnpbios";
123 argv[1] = "dock"; 122 argv[1] = "dock";
124 argv[2] = NULL; 123 argv[2] = NULL;
@@ -146,7 +145,7 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
146 info->location_id, info->serial, info->capabilities); 145 info->location_id, info->serial, info->capabilities);
147 envp[i] = NULL; 146 envp[i] = NULL;
148 147
149 value = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); 148 value = call_usermodehelper(argv [0], argv, envp, UMH_WAIT_EXEC);
150 kfree(buf); 149 kfree(buf);
151 kfree(envp); 150 kfree(envp);
152 return 0; 151 return 0;
@@ -159,6 +158,7 @@ static int pnp_dock_thread(void *unused)
159{ 158{
160 static struct pnp_docking_station_info now; 159 static struct pnp_docking_station_info now;
161 int docked = -1, d = 0; 160 int docked = -1, d = 0;
161
162 set_freezable(); 162 set_freezable();
163 while (!unloading) { 163 while (!unloading) {
164 int status; 164 int status;
@@ -203,7 +203,7 @@ static int pnp_dock_thread(void *unused)
203 complete_and_exit(&unload_sem, 0); 203 complete_and_exit(&unload_sem, 0);
204} 204}
205 205
206#endif /* CONFIG_HOTPLUG */ 206#endif /* CONFIG_HOTPLUG */
207 207
208static int pnpbios_get_resources(struct pnp_dev *dev, 208static int pnpbios_get_resources(struct pnp_dev *dev,
209 struct pnp_resource_table *res) 209 struct pnp_resource_table *res)
@@ -211,7 +211,6 @@ static int pnpbios_get_resources(struct pnp_dev *dev,
211 u8 nodenum = dev->number; 211 u8 nodenum = dev->number;
212 struct pnp_bios_node *node; 212 struct pnp_bios_node *node;
213 213
214 /* just in case */
215 if (!pnpbios_is_dynamic(dev)) 214 if (!pnpbios_is_dynamic(dev))
216 return -EPERM; 215 return -EPERM;
217 216
@@ -235,7 +234,6 @@ static int pnpbios_set_resources(struct pnp_dev *dev,
235 struct pnp_bios_node *node; 234 struct pnp_bios_node *node;
236 int ret; 235 int ret;
237 236
238 /* just in case */
239 if (!pnpbios_is_dynamic(dev)) 237 if (!pnpbios_is_dynamic(dev))
240 return -EPERM; 238 return -EPERM;
241 239
@@ -263,6 +261,7 @@ static void pnpbios_zero_data_stream(struct pnp_bios_node *node)
263 unsigned char *end = (char *)(node->data + node->size); 261 unsigned char *end = (char *)(node->data + node->size);
264 unsigned int len; 262 unsigned int len;
265 int i; 263 int i;
264
266 while ((char *)p < (char *)end) { 265 while ((char *)p < (char *)end) {
267 if (p[0] & 0x80) { /* large tag */ 266 if (p[0] & 0x80) { /* large tag */
268 len = (p[2] << 8) | p[1]; 267 len = (p[2] << 8) | p[1];
@@ -287,7 +286,6 @@ static int pnpbios_disable_resources(struct pnp_dev *dev)
287 u8 nodenum = dev->number; 286 u8 nodenum = dev->number;
288 int ret; 287 int ret;
289 288
290 /* just in case */
291 if (dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev)) 289 if (dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
292 return -EPERM; 290 return -EPERM;
293 291
@@ -418,8 +416,8 @@ static void __init build_devlist(void)
418 * 416 *
419 */ 417 */
420 418
421static int pnpbios_disabled; /* = 0 */ 419static int pnpbios_disabled;
422int pnpbios_dont_use_current_config; /* = 0 */ 420int pnpbios_dont_use_current_config;
423 421
424#ifndef MODULE 422#ifndef MODULE
425static int __init pnpbios_setup(char *str) 423static int __init pnpbios_setup(char *str)
@@ -551,7 +549,7 @@ static int __init pnpbios_init(void)
551 printk(KERN_INFO "PnPBIOS: Disabled by ACPI PNP\n"); 549 printk(KERN_INFO "PnPBIOS: Disabled by ACPI PNP\n");
552 return -ENODEV; 550 return -ENODEV;
553 } 551 }
554#endif /* CONFIG_ACPI */ 552#endif /* CONFIG_ACPI */
555 553
556 /* scan the system for pnpbios support */ 554 /* scan the system for pnpbios support */
557 if (!pnpbios_probe_system()) 555 if (!pnpbios_probe_system())
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index b7e1d23e8a4e..9c8c07701b65 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -18,9 +18,6 @@
18 * The other files are human-readable. 18 * The other files are human-readable.
19 */ 19 */
20 20
21//#include <pcmcia/config.h>
22//#include <pcmcia/k_compat.h>
23
24#include <linux/module.h> 21#include <linux/module.h>
25#include <linux/kernel.h> 22#include <linux/kernel.h>
26#include <linux/slab.h> 23#include <linux/slab.h>
@@ -297,6 +294,4 @@ void __exit pnpbios_proc_exit(void)
297 remove_proc_entry("devices", proc_pnp); 294 remove_proc_entry("devices", proc_pnp);
298 remove_proc_entry("boot", proc_pnp); 295 remove_proc_entry("boot", proc_pnp);
299 remove_proc_entry("pnp", proc_bus); 296 remove_proc_entry("pnp", proc_bus);
300
301 return;
302} 297}
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 54c34d4d4f44..04ecd7b67230 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -1,6 +1,5 @@
1/* 1/*
2 * rsparser.c - parses and encodes pnpbios resource data streams 2 * rsparser.c - parses and encodes pnpbios resource data streams
3 *
4 */ 3 */
5 4
6#include <linux/ctype.h> 5#include <linux/ctype.h>
@@ -15,7 +14,7 @@
15inline void pcibios_penalize_isa_irq(int irq, int active) 14inline void pcibios_penalize_isa_irq(int irq, int active)
16{ 15{
17} 16}
18#endif /* CONFIG_PCI */ 17#endif /* CONFIG_PCI */
19 18
20#include "pnpbios.h" 19#include "pnpbios.h"
21 20
@@ -54,10 +53,11 @@ inline void pcibios_penalize_isa_irq(int irq, int active)
54 * Allocated Resources 53 * Allocated Resources
55 */ 54 */
56 55
57static void 56static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res,
58pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, int irq) 57 int irq)
59{ 58{
60 int i = 0; 59 int i = 0;
60
61 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) 61 while (!(res->irq_resource[i].flags & IORESOURCE_UNSET)
62 && i < PNP_MAX_IRQ) 62 && i < PNP_MAX_IRQ)
63 i++; 63 i++;
@@ -73,10 +73,11 @@ pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, int irq)
73 } 73 }
74} 74}
75 75
76static void 76static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res,
77pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, int dma) 77 int dma)
78{ 78{
79 int i = 0; 79 int i = 0;
80
80 while (i < PNP_MAX_DMA && 81 while (i < PNP_MAX_DMA &&
81 !(res->dma_resource[i].flags & IORESOURCE_UNSET)) 82 !(res->dma_resource[i].flags & IORESOURCE_UNSET))
82 i++; 83 i++;
@@ -91,11 +92,11 @@ pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, int dma)
91 } 92 }
92} 93}
93 94
94static void 95static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res,
95pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, int io, 96 int io, int len)
96 int len)
97{ 97{
98 int i = 0; 98 int i = 0;
99
99 while (!(res->port_resource[i].flags & IORESOURCE_UNSET) 100 while (!(res->port_resource[i].flags & IORESOURCE_UNSET)
100 && i < PNP_MAX_PORT) 101 && i < PNP_MAX_PORT)
101 i++; 102 i++;
@@ -110,11 +111,11 @@ pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, int io,
110 } 111 }
111} 112}
112 113
113static void 114static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res,
114pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, int mem, 115 int mem, int len)
115 int len)
116{ 116{
117 int i = 0; 117 int i = 0;
118
118 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) 119 while (!(res->mem_resource[i].flags & IORESOURCE_UNSET)
119 && i < PNP_MAX_MEM) 120 && i < PNP_MAX_MEM)
120 i++; 121 i++;
@@ -261,10 +262,11 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
261 * Resource Configuration Options 262 * Resource Configuration Options
262 */ 263 */
263 264
264static void 265static void pnpbios_parse_mem_option(unsigned char *p, int size,
265pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option) 266 struct pnp_option *option)
266{ 267{
267 struct pnp_mem *mem; 268 struct pnp_mem *mem;
269
268 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 270 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
269 if (!mem) 271 if (!mem)
270 return; 272 return;
@@ -274,14 +276,13 @@ pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option)
274 mem->size = ((p[11] << 8) | p[10]) << 8; 276 mem->size = ((p[11] << 8) | p[10]) << 8;
275 mem->flags = p[3]; 277 mem->flags = p[3];
276 pnp_register_mem_resource(option, mem); 278 pnp_register_mem_resource(option, mem);
277 return;
278} 279}
279 280
280static void 281static void pnpbios_parse_mem32_option(unsigned char *p, int size,
281pnpbios_parse_mem32_option(unsigned char *p, int size, 282 struct pnp_option *option)
282 struct pnp_option *option)
283{ 283{
284 struct pnp_mem *mem; 284 struct pnp_mem *mem;
285
285 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 286 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
286 if (!mem) 287 if (!mem)
287 return; 288 return;
@@ -291,12 +292,10 @@ pnpbios_parse_mem32_option(unsigned char *p, int size,
291 mem->size = (p[19] << 24) | (p[18] << 16) | (p[17] << 8) | p[16]; 292 mem->size = (p[19] << 24) | (p[18] << 16) | (p[17] << 8) | p[16];
292 mem->flags = p[3]; 293 mem->flags = p[3];
293 pnp_register_mem_resource(option, mem); 294 pnp_register_mem_resource(option, mem);
294 return;
295} 295}
296 296
297static void 297static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size,
298pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, 298 struct pnp_option *option)
299 struct pnp_option *option)
300{ 299{
301 struct pnp_mem *mem; 300 struct pnp_mem *mem;
302 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 301 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
@@ -307,11 +306,10 @@ pnpbios_parse_fixed_mem32_option(unsigned char *p, int size,
307 mem->align = 0; 306 mem->align = 0;
308 mem->flags = p[3]; 307 mem->flags = p[3];
309 pnp_register_mem_resource(option, mem); 308 pnp_register_mem_resource(option, mem);
310 return;
311} 309}
312 310
313static void 311static void pnpbios_parse_irq_option(unsigned char *p, int size,
314pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option) 312 struct pnp_option *option)
315{ 313{
316 struct pnp_irq *irq; 314 struct pnp_irq *irq;
317 unsigned long bits; 315 unsigned long bits;
@@ -326,26 +324,26 @@ pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option)
326 else 324 else
327 irq->flags = IORESOURCE_IRQ_HIGHEDGE; 325 irq->flags = IORESOURCE_IRQ_HIGHEDGE;
328 pnp_register_irq_resource(option, irq); 326 pnp_register_irq_resource(option, irq);
329 return;
330} 327}
331 328
332static void 329static void pnpbios_parse_dma_option(unsigned char *p, int size,
333pnpbios_parse_dma_option(unsigned char *p, int size, struct pnp_option *option) 330 struct pnp_option *option)
334{ 331{
335 struct pnp_dma *dma; 332 struct pnp_dma *dma;
333
336 dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); 334 dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL);
337 if (!dma) 335 if (!dma)
338 return; 336 return;
339 dma->map = p[1]; 337 dma->map = p[1];
340 dma->flags = p[2]; 338 dma->flags = p[2];
341 pnp_register_dma_resource(option, dma); 339 pnp_register_dma_resource(option, dma);
342 return;
343} 340}
344 341
345static void 342static void pnpbios_parse_port_option(unsigned char *p, int size,
346pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option) 343 struct pnp_option *option)
347{ 344{
348 struct pnp_port *port; 345 struct pnp_port *port;
346
349 port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); 347 port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
350 if (!port) 348 if (!port)
351 return; 349 return;
@@ -355,14 +353,13 @@ pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option)
355 port->size = p[7]; 353 port->size = p[7];
356 port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0; 354 port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0;
357 pnp_register_port_resource(option, port); 355 pnp_register_port_resource(option, port);
358 return;
359} 356}
360 357
361static void 358static void pnpbios_parse_fixed_port_option(unsigned char *p, int size,
362pnpbios_parse_fixed_port_option(unsigned char *p, int size, 359 struct pnp_option *option)
363 struct pnp_option *option)
364{ 360{
365 struct pnp_port *port; 361 struct pnp_port *port;
362
366 port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); 363 port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
367 if (!port) 364 if (!port)
368 return; 365 return;
@@ -371,7 +368,6 @@ pnpbios_parse_fixed_port_option(unsigned char *p, int size,
371 port->align = 0; 368 port->align = 0;
372 port->flags = PNP_PORT_FLAG_FIXED; 369 port->flags = PNP_PORT_FLAG_FIXED;
373 pnp_register_port_resource(option, port); 370 pnp_register_port_resource(option, port);
374 return;
375} 371}
376 372
377static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p, 373static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p,
@@ -498,7 +494,6 @@ static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p,
498 494
499#define HEX(id,a) hex[((id)>>a) & 15] 495#define HEX(id,a) hex[((id)>>a) & 15]
500#define CHAR(id,a) (0x40 + (((id)>>a) & 31)) 496#define CHAR(id,a) (0x40 + (((id)>>a) & 31))
501//
502 497
503void pnpid32_to_pnpid(u32 id, char *str) 498void pnpid32_to_pnpid(u32 id, char *str)
504{ 499{
@@ -513,11 +508,8 @@ void pnpid32_to_pnpid(u32 id, char *str)
513 str[5] = HEX(id, 4); 508 str[5] = HEX(id, 4);
514 str[6] = HEX(id, 0); 509 str[6] = HEX(id, 0);
515 str[7] = '\0'; 510 str[7] = '\0';
516
517 return;
518} 511}
519 512
520//
521#undef CHAR 513#undef CHAR
522#undef HEX 514#undef HEX
523 515
@@ -598,19 +590,20 @@ static void pnpbios_encode_mem(unsigned char *p, struct resource *res)
598{ 590{
599 unsigned long base = res->start; 591 unsigned long base = res->start;
600 unsigned long len = res->end - res->start + 1; 592 unsigned long len = res->end - res->start + 1;
593
601 p[4] = (base >> 8) & 0xff; 594 p[4] = (base >> 8) & 0xff;
602 p[5] = ((base >> 8) >> 8) & 0xff; 595 p[5] = ((base >> 8) >> 8) & 0xff;
603 p[6] = (base >> 8) & 0xff; 596 p[6] = (base >> 8) & 0xff;
604 p[7] = ((base >> 8) >> 8) & 0xff; 597 p[7] = ((base >> 8) >> 8) & 0xff;
605 p[10] = (len >> 8) & 0xff; 598 p[10] = (len >> 8) & 0xff;
606 p[11] = ((len >> 8) >> 8) & 0xff; 599 p[11] = ((len >> 8) >> 8) & 0xff;
607 return;
608} 600}
609 601
610static void pnpbios_encode_mem32(unsigned char *p, struct resource *res) 602static void pnpbios_encode_mem32(unsigned char *p, struct resource *res)
611{ 603{
612 unsigned long base = res->start; 604 unsigned long base = res->start;
613 unsigned long len = res->end - res->start + 1; 605 unsigned long len = res->end - res->start + 1;
606
614 p[4] = base & 0xff; 607 p[4] = base & 0xff;
615 p[5] = (base >> 8) & 0xff; 608 p[5] = (base >> 8) & 0xff;
616 p[6] = (base >> 16) & 0xff; 609 p[6] = (base >> 16) & 0xff;
@@ -623,13 +616,13 @@ static void pnpbios_encode_mem32(unsigned char *p, struct resource *res)
623 p[17] = (len >> 8) & 0xff; 616 p[17] = (len >> 8) & 0xff;
624 p[18] = (len >> 16) & 0xff; 617 p[18] = (len >> 16) & 0xff;
625 p[19] = (len >> 24) & 0xff; 618 p[19] = (len >> 24) & 0xff;
626 return;
627} 619}
628 620
629static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res) 621static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res)
630{ 622{
631 unsigned long base = res->start; 623 unsigned long base = res->start;
632 unsigned long len = res->end - res->start + 1; 624 unsigned long len = res->end - res->start + 1;
625
633 p[4] = base & 0xff; 626 p[4] = base & 0xff;
634 p[5] = (base >> 8) & 0xff; 627 p[5] = (base >> 8) & 0xff;
635 p[6] = (base >> 16) & 0xff; 628 p[6] = (base >> 16) & 0xff;
@@ -638,46 +631,45 @@ static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res)
638 p[9] = (len >> 8) & 0xff; 631 p[9] = (len >> 8) & 0xff;
639 p[10] = (len >> 16) & 0xff; 632 p[10] = (len >> 16) & 0xff;
640 p[11] = (len >> 24) & 0xff; 633 p[11] = (len >> 24) & 0xff;
641 return;
642} 634}
643 635
644static void pnpbios_encode_irq(unsigned char *p, struct resource *res) 636static void pnpbios_encode_irq(unsigned char *p, struct resource *res)
645{ 637{
646 unsigned long map = 0; 638 unsigned long map = 0;
639
647 map = 1 << res->start; 640 map = 1 << res->start;
648 p[1] = map & 0xff; 641 p[1] = map & 0xff;
649 p[2] = (map >> 8) & 0xff; 642 p[2] = (map >> 8) & 0xff;
650 return;
651} 643}
652 644
653static void pnpbios_encode_dma(unsigned char *p, struct resource *res) 645static void pnpbios_encode_dma(unsigned char *p, struct resource *res)
654{ 646{
655 unsigned long map = 0; 647 unsigned long map = 0;
648
656 map = 1 << res->start; 649 map = 1 << res->start;
657 p[1] = map & 0xff; 650 p[1] = map & 0xff;
658 return;
659} 651}
660 652
661static void pnpbios_encode_port(unsigned char *p, struct resource *res) 653static void pnpbios_encode_port(unsigned char *p, struct resource *res)
662{ 654{
663 unsigned long base = res->start; 655 unsigned long base = res->start;
664 unsigned long len = res->end - res->start + 1; 656 unsigned long len = res->end - res->start + 1;
657
665 p[2] = base & 0xff; 658 p[2] = base & 0xff;
666 p[3] = (base >> 8) & 0xff; 659 p[3] = (base >> 8) & 0xff;
667 p[4] = base & 0xff; 660 p[4] = base & 0xff;
668 p[5] = (base >> 8) & 0xff; 661 p[5] = (base >> 8) & 0xff;
669 p[7] = len & 0xff; 662 p[7] = len & 0xff;
670 return;
671} 663}
672 664
673static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) 665static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res)
674{ 666{
675 unsigned long base = res->start; 667 unsigned long base = res->start;
676 unsigned long len = res->end - res->start + 1; 668 unsigned long len = res->end - res->start + 1;
669
677 p[1] = base & 0xff; 670 p[1] = base & 0xff;
678 p[2] = (base >> 8) & 0xff; 671 p[2] = (base >> 8) & 0xff;
679 p[3] = len & 0xff; 672 p[3] = len & 0xff;
680 return;
681} 673}
682 674
683static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p, 675static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p,
@@ -792,6 +784,7 @@ int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node *node)
792{ 784{
793 unsigned char *p = (char *)node->data; 785 unsigned char *p = (char *)node->data;
794 unsigned char *end = (char *)(node->data + node->size); 786 unsigned char *end = (char *)(node->data + node->size);
787
795 p = pnpbios_parse_allocated_resource_data(p, end, &dev->res); 788 p = pnpbios_parse_allocated_resource_data(p, end, &dev->res);
796 if (!p) 789 if (!p)
797 return -EIO; 790 return -EIO;
@@ -804,24 +797,24 @@ int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node *node)
804 return 0; 797 return 0;
805} 798}
806 799
807int 800int pnpbios_read_resources_from_node(struct pnp_resource_table *res,
808pnpbios_read_resources_from_node(struct pnp_resource_table *res, 801 struct pnp_bios_node *node)
809 struct pnp_bios_node *node)
810{ 802{
811 unsigned char *p = (char *)node->data; 803 unsigned char *p = (char *)node->data;
812 unsigned char *end = (char *)(node->data + node->size); 804 unsigned char *end = (char *)(node->data + node->size);
805
813 p = pnpbios_parse_allocated_resource_data(p, end, res); 806 p = pnpbios_parse_allocated_resource_data(p, end, res);
814 if (!p) 807 if (!p)
815 return -EIO; 808 return -EIO;
816 return 0; 809 return 0;
817} 810}
818 811
819int 812int pnpbios_write_resources_to_node(struct pnp_resource_table *res,
820pnpbios_write_resources_to_node(struct pnp_resource_table *res, 813 struct pnp_bios_node *node)
821 struct pnp_bios_node *node)
822{ 814{
823 unsigned char *p = (char *)node->data; 815 unsigned char *p = (char *)node->data;
824 unsigned char *end = (char *)(node->data + node->size); 816 unsigned char *end = (char *)(node->data + node->size);
817
825 p = pnpbios_encode_allocated_resource_data(p, end, res); 818 p = pnpbios_encode_allocated_resource_data(p, end, res);
826 if (!p) 819 if (!p)
827 return -EIO; 820 return -EIO;
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 8e7d7738f296..90755d4cdb9f 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -105,7 +105,6 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
105 if (changed) 105 if (changed)
106 printk(KERN_INFO 106 printk(KERN_INFO
107 "pnp: SB audio device quirk - increasing port range\n"); 107 "pnp: SB audio device quirk - increasing port range\n");
108 return;
109} 108}
110 109
111static int quirk_smc_fir_enabled(struct pnp_dev *dev) 110static int quirk_smc_fir_enabled(struct pnp_dev *dev)
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index 635b11a0cf82..ea6ec14a0559 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.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/module.h> 8#include <linux/module.h>
@@ -20,10 +19,10 @@
20#include <linux/pnp.h> 19#include <linux/pnp.h>
21#include "base.h" 20#include "base.h"
22 21
23static int pnp_reserve_irq[16] = {[0...15] = -1 }; /* reserve (don't use) some IRQ */ 22static int pnp_reserve_irq[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some IRQ */
24static int pnp_reserve_dma[8] = {[0...7] = -1 }; /* reserve (don't use) some DMA */ 23static int pnp_reserve_dma[8] = {[0 ... 7] = -1 }; /* reserve (don't use) some DMA */
25static int pnp_reserve_io[16] = {[0...15] = -1 }; /* reserve (don't use) some I/O region */ 24static int pnp_reserve_io[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some I/O region */
26static int pnp_reserve_mem[16] = {[0...15] = -1 }; /* reserve (don't use) some memory region */ 25static int pnp_reserve_mem[16] = {[0 ... 15] = -1 }; /* reserve (don't use) some memory region */
27 26
28/* 27/*
29 * option registration 28 * option registration
@@ -33,7 +32,6 @@ static struct pnp_option *pnp_build_option(int priority)
33{ 32{
34 struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option)); 33 struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
35 34
36 /* check if pnp_alloc ran out of memory */
37 if (!option) 35 if (!option)
38 return NULL; 36 return NULL;
39 37
@@ -48,6 +46,7 @@ static struct pnp_option *pnp_build_option(int priority)
48struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) 46struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
49{ 47{
50 struct pnp_option *option; 48 struct pnp_option *option;
49
51 if (!dev) 50 if (!dev)
52 return NULL; 51 return NULL;
53 52
@@ -64,6 +63,7 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
64 int priority) 63 int priority)
65{ 64{
66 struct pnp_option *option; 65 struct pnp_option *option;
66
67 if (!dev) 67 if (!dev)
68 return NULL; 68 return NULL;
69 69
@@ -82,6 +82,7 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
82int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) 82int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
83{ 83{
84 struct pnp_irq *ptr; 84 struct pnp_irq *ptr;
85
85 if (!option) 86 if (!option)
86 return -EINVAL; 87 return -EINVAL;
87 if (!data) 88 if (!data)
@@ -110,6 +111,7 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
110int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) 111int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
111{ 112{
112 struct pnp_dma *ptr; 113 struct pnp_dma *ptr;
114
113 if (!option) 115 if (!option)
114 return -EINVAL; 116 return -EINVAL;
115 if (!data) 117 if (!data)
@@ -129,6 +131,7 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
129int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) 131int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
130{ 132{
131 struct pnp_port *ptr; 133 struct pnp_port *ptr;
134
132 if (!option) 135 if (!option)
133 return -EINVAL; 136 return -EINVAL;
134 if (!data) 137 if (!data)
@@ -148,6 +151,7 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
148int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) 151int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
149{ 152{
150 struct pnp_mem *ptr; 153 struct pnp_mem *ptr;
154
151 if (!option) 155 if (!option)
152 return -EINVAL; 156 return -EINVAL;
153 if (!data) 157 if (!data)
@@ -240,6 +244,7 @@ int pnp_check_port(struct pnp_dev *dev, int idx)
240 int tmp; 244 int tmp;
241 struct pnp_dev *tdev; 245 struct pnp_dev *tdev;
242 resource_size_t *port, *end, *tport, *tend; 246 resource_size_t *port, *end, *tport, *tend;
247
243 port = &dev->res.port_resource[idx].start; 248 port = &dev->res.port_resource[idx].start;
244 end = &dev->res.port_resource[idx].end; 249 end = &dev->res.port_resource[idx].end;
245 250
@@ -297,6 +302,7 @@ int pnp_check_mem(struct pnp_dev *dev, int idx)
297 int tmp; 302 int tmp;
298 struct pnp_dev *tdev; 303 struct pnp_dev *tdev;
299 resource_size_t *addr, *end, *taddr, *tend; 304 resource_size_t *addr, *end, *taddr, *tend;
305
300 addr = &dev->res.mem_resource[idx].start; 306 addr = &dev->res.mem_resource[idx].start;
301 end = &dev->res.mem_resource[idx].end; 307 end = &dev->res.mem_resource[idx].end;
302 308
@@ -474,22 +480,12 @@ int pnp_check_dma(struct pnp_dev *dev, int idx)
474 480
475 return 1; 481 return 1;
476#else 482#else
477 /* IA64 hasn't legacy DMA */ 483 /* IA64 does not have legacy DMA */
478 return 0; 484 return 0;
479#endif 485#endif
480} 486}
481 487
482#if 0
483EXPORT_SYMBOL(pnp_register_dependent_option);
484EXPORT_SYMBOL(pnp_register_independent_option);
485EXPORT_SYMBOL(pnp_register_irq_resource);
486EXPORT_SYMBOL(pnp_register_dma_resource);
487EXPORT_SYMBOL(pnp_register_port_resource);
488EXPORT_SYMBOL(pnp_register_mem_resource);
489#endif /* 0 */
490
491/* format is: pnp_reserve_irq=irq1[,irq2] .... */ 488/* format is: pnp_reserve_irq=irq1[,irq2] .... */
492
493static int __init pnp_setup_reserve_irq(char *str) 489static int __init pnp_setup_reserve_irq(char *str)
494{ 490{
495 int i; 491 int i;
@@ -503,7 +499,6 @@ static int __init pnp_setup_reserve_irq(char *str)
503__setup("pnp_reserve_irq=", pnp_setup_reserve_irq); 499__setup("pnp_reserve_irq=", pnp_setup_reserve_irq);
504 500
505/* format is: pnp_reserve_dma=dma1[,dma2] .... */ 501/* format is: pnp_reserve_dma=dma1[,dma2] .... */
506
507static int __init pnp_setup_reserve_dma(char *str) 502static int __init pnp_setup_reserve_dma(char *str)
508{ 503{
509 int i; 504 int i;
@@ -517,7 +512,6 @@ static int __init pnp_setup_reserve_dma(char *str)
517__setup("pnp_reserve_dma=", pnp_setup_reserve_dma); 512__setup("pnp_reserve_dma=", pnp_setup_reserve_dma);
518 513
519/* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */ 514/* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */
520
521static int __init pnp_setup_reserve_io(char *str) 515static int __init pnp_setup_reserve_io(char *str)
522{ 516{
523 int i; 517 int i;
@@ -531,7 +525,6 @@ static int __init pnp_setup_reserve_io(char *str)
531__setup("pnp_reserve_io=", pnp_setup_reserve_io); 525__setup("pnp_reserve_io=", pnp_setup_reserve_io);
532 526
533/* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */ 527/* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */
534
535static int __init pnp_setup_reserve_mem(char *str) 528static int __init pnp_setup_reserve_mem(char *str)
536{ 529{
537 int i; 530 int i;
diff --git a/drivers/pnp/support.c b/drivers/pnp/support.c
index 525db2e7d6c7..13c608f5fb30 100644
--- a/drivers/pnp/support.c
+++ b/drivers/pnp/support.c
@@ -1,8 +1,7 @@
1/* 1/*
2 * support.c - provides standard pnp functions for the use of pnp protocol drivers, 2 * support.c - standard functions for the use of pnp protocol drivers
3 * 3 *
4 * Copyright 2003 Adam Belay <ambx1@neo.rr.com> 4 * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
5 *
6 */ 5 */
7 6
8#include <linux/module.h> 7#include <linux/module.h>
@@ -11,11 +10,10 @@
11#include "base.h" 10#include "base.h"
12 11
13/** 12/**
14 * pnp_is_active - Determines if a device is active based on its current resources 13 * pnp_is_active - Determines if a device is active based on its current
14 * resources
15 * @dev: pointer to the desired PnP device 15 * @dev: pointer to the desired PnP device
16 *
17 */ 16 */
18
19int pnp_is_active(struct pnp_dev *dev) 17int pnp_is_active(struct pnp_dev *dev)
20{ 18{
21 if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 && 19 if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index 8d71008accba..a06f980b3ac9 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -45,8 +45,7 @@ static void reserve_range(const char *pnpid, resource_size_t start,
45 * example do reserve stuff they know about too, so we may well 45 * example do reserve stuff they know about too, so we may well
46 * have double reservations. 46 * have double reservations.
47 */ 47 */
48 printk(KERN_INFO 48 printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
49 "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
50 pnpid, port ? "ioport" : "iomem", 49 pnpid, port ? "ioport" : "iomem",
51 (unsigned long long)start, (unsigned long long)end, 50 (unsigned long long)start, (unsigned long long)end,
52 NULL != res ? "has been" : "could not be"); 51 NULL != res ? "has been" : "could not be");
@@ -85,8 +84,6 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
85 reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), 84 reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
86 pnp_mem_end(dev, i), 0); 85 pnp_mem_end(dev, i), 0);
87 } 86 }
88
89 return;
90} 87}
91 88
92static int system_pnp_probe(struct pnp_dev *dev, 89static int system_pnp_probe(struct pnp_dev *dev,
@@ -97,11 +94,10 @@ static int system_pnp_probe(struct pnp_dev *dev,
97} 94}
98 95
99static struct pnp_driver system_pnp_driver = { 96static struct pnp_driver system_pnp_driver = {
100 .name = "system", 97 .name = "system",
101 .id_table = pnp_dev_table, 98 .id_table = pnp_dev_table,
102 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, 99 .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
103 .probe = system_pnp_probe, 100 .probe = system_pnp_probe,
104 .remove = NULL,
105}; 101};
106 102
107static int __init pnp_system_init(void) 103static int __init pnp_system_init(void)