Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PNP: fix up after Lindent

These are manual fixups after running Lindent. No functional change.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Bjorn Helgaas and committed by
Linus Torvalds
07d4e9af 9dd78466

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