aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/isapnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/isapnp')
-rw-r--r--drivers/pnp/isapnp/compat.c30
-rw-r--r--drivers/pnp/isapnp/core.c302
-rw-r--r--drivers/pnp/isapnp/proc.c14
3 files changed, 199 insertions, 147 deletions
diff --git a/drivers/pnp/isapnp/compat.c b/drivers/pnp/isapnp/compat.c
index 0697ab88a9ac..aaf45e3ebee2 100644
--- a/drivers/pnp/isapnp/compat.c
+++ b/drivers/pnp/isapnp/compat.c
@@ -5,28 +5,26 @@
5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
6 * 6 *
7 */ 7 */
8 8
9/* TODO: see if more isapnp functions are needed here */ 9/* TODO: see if more isapnp functions are needed here */
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/isapnp.h> 12#include <linux/isapnp.h>
13#include <linux/string.h> 13#include <linux/string.h>
14 14
15static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short device) 15static void pnp_convert_id(char *buf, unsigned short vendor,
16 unsigned short device)
16{ 17{
17 sprintf(buf, "%c%c%c%x%x%x%x", 18 sprintf(buf, "%c%c%c%x%x%x%x",
18 'A' + ((vendor >> 2) & 0x3f) - 1, 19 'A' + ((vendor >> 2) & 0x3f) - 1,
19 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, 20 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
20 'A' + ((vendor >> 8) & 0x1f) - 1, 21 'A' + ((vendor >> 8) & 0x1f) - 1,
21 (device >> 4) & 0x0f, 22 (device >> 4) & 0x0f,
22 device & 0x0f, 23 device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
23 (device >> 12) & 0x0f,
24 (device >> 8) & 0x0f);
25} 24}
26 25
27struct pnp_card *pnp_find_card(unsigned short vendor, 26struct pnp_card *pnp_find_card(unsigned short vendor,
28 unsigned short device, 27 unsigned short device, struct pnp_card *from)
29 struct pnp_card *from)
30{ 28{
31 char id[8]; 29 char id[8];
32 char any[8]; 30 char any[8];
@@ -38,7 +36,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
38 36
39 while (list != &pnp_cards) { 37 while (list != &pnp_cards) {
40 struct pnp_card *card = global_to_pnp_card(list); 38 struct pnp_card *card = global_to_pnp_card(list);
41 if (compare_pnp_id(card->id,id) || (memcmp(id,any,7)==0)) 39 if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0))
42 return card; 40 return card;
43 list = list->next; 41 list = list->next;
44 } 42 }
@@ -47,8 +45,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
47 45
48struct pnp_dev *pnp_find_dev(struct pnp_card *card, 46struct pnp_dev *pnp_find_dev(struct pnp_card *card,
49 unsigned short vendor, 47 unsigned short vendor,
50 unsigned short function, 48 unsigned short function, struct pnp_dev *from)
51 struct pnp_dev *from)
52{ 49{
53 char id[8]; 50 char id[8];
54 char any[8]; 51 char any[8];
@@ -63,7 +60,8 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
63 60
64 while (list != &pnp_global) { 61 while (list != &pnp_global) {
65 struct pnp_dev *dev = global_to_pnp_dev(list); 62 struct pnp_dev *dev = global_to_pnp_dev(list);
66 if (compare_pnp_id(dev->id,id) || (memcmp(id,any,7)==0)) 63 if (compare_pnp_id(dev->id, id)
64 || (memcmp(id, any, 7) == 0))
67 return dev; 65 return dev;
68 list = list->next; 66 list = list->next;
69 } 67 }
@@ -78,7 +76,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
78 } 76 }
79 while (list != &card->devices) { 77 while (list != &card->devices) {
80 struct pnp_dev *dev = card_to_pnp_dev(list); 78 struct pnp_dev *dev = card_to_pnp_dev(list);
81 if (compare_pnp_id(dev->id,id)) 79 if (compare_pnp_id(dev->id, id))
82 return dev; 80 return dev;
83 list = list->next; 81 list = list->next;
84 } 82 }
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 914d00c423ad..0d690a7c0d24 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -51,10 +51,10 @@
51#define ISAPNP_DEBUG 51#define ISAPNP_DEBUG
52#endif 52#endif
53 53
54int isapnp_disable; /* Disable ISA PnP */ 54int isapnp_disable; /* Disable ISA PnP */
55static int isapnp_rdp; /* Read Data Port */ 55static int isapnp_rdp; /* Read Data Port */
56static int isapnp_reset = 1; /* reset all PnP cards (deactivate) */ 56static int isapnp_reset = 1; /* reset all PnP cards (deactivate) */
57static int isapnp_verbose = 1; /* verbose mode */ 57static int isapnp_verbose = 1; /* verbose mode */
58 58
59MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); 59MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
60MODULE_DESCRIPTION("Generic ISA Plug & Play support"); 60MODULE_DESCRIPTION("Generic ISA Plug & Play support");
@@ -126,7 +126,7 @@ static unsigned short isapnp_read_word(unsigned char idx)
126 unsigned short val; 126 unsigned short val;
127 127
128 val = isapnp_read_byte(idx); 128 val = isapnp_read_byte(idx);
129 val = (val << 8) + isapnp_read_byte(idx+1); 129 val = (val << 8) + isapnp_read_byte(idx + 1);
130 return val; 130 return val;
131} 131}
132 132
@@ -139,7 +139,7 @@ void isapnp_write_byte(unsigned char idx, unsigned char val)
139static void isapnp_write_word(unsigned char idx, unsigned short val) 139static void isapnp_write_word(unsigned char idx, unsigned short val)
140{ 140{
141 isapnp_write_byte(idx, val >> 8); 141 isapnp_write_byte(idx, val >> 8);
142 isapnp_write_byte(idx+1, val); 142 isapnp_write_byte(idx + 1, val);
143} 143}
144 144
145static void isapnp_key(void) 145static void isapnp_key(void)
@@ -193,7 +193,7 @@ static void isapnp_deactivate(unsigned char logdev)
193static void __init isapnp_peek(unsigned char *data, int bytes) 193static void __init isapnp_peek(unsigned char *data, int bytes)
194{ 194{
195 int i, j; 195 int i, j;
196 unsigned char d=0; 196 unsigned char d = 0;
197 197
198 for (i = 1; i <= bytes; i++) { 198 for (i = 1; i <= bytes; i++) {
199 for (j = 0; j < 20; j++) { 199 for (j = 0; j < 20; j++) {
@@ -220,19 +220,18 @@ static int isapnp_next_rdp(void)
220{ 220{
221 int rdp = isapnp_rdp; 221 int rdp = isapnp_rdp;
222 static int old_rdp = 0; 222 static int old_rdp = 0;
223 223
224 if(old_rdp) 224 if (old_rdp) {
225 {
226 release_region(old_rdp, 1); 225 release_region(old_rdp, 1);
227 old_rdp = 0; 226 old_rdp = 0;
228 } 227 }
229 while (rdp <= 0x3ff) { 228 while (rdp <= 0x3ff) {
230 /* 229 /*
231 * We cannot use NE2000 probe spaces for ISAPnP or we 230 * We cannot use NE2000 probe spaces for ISAPnP or we
232 * will lock up machines. 231 * will lock up machines.
233 */ 232 */
234 if ((rdp < 0x280 || rdp > 0x380) && request_region(rdp, 1, "ISAPnP")) 233 if ((rdp < 0x280 || rdp > 0x380)
235 { 234 && request_region(rdp, 1, "ISAPnP")) {
236 isapnp_rdp = rdp; 235 isapnp_rdp = rdp;
237 old_rdp = rdp; 236 old_rdp = rdp;
238 return 0; 237 return 0;
@@ -305,7 +304,9 @@ static int __init isapnp_isolate(void)
305 udelay(250); 304 udelay(250);
306 if (data == 0x55aa) 305 if (data == 0x55aa)
307 bit = 0x01; 306 bit = 0x01;
308 checksum = ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7) | (checksum >> 1); 307 checksum =
308 ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7)
309 | (checksum >> 1);
309 bit = 0x00; 310 bit = 0x00;
310 } 311 }
311 for (i = 65; i <= 72; i++) { 312 for (i = 65; i <= 72; i++) {
@@ -357,7 +358,7 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
357 unsigned char tag, tmp[2]; 358 unsigned char tag, tmp[2];
358 359
359 isapnp_peek(&tag, 1); 360 isapnp_peek(&tag, 1);
360 if (tag == 0) /* invalid tag */ 361 if (tag == 0) /* invalid tag */
361 return -1; 362 return -1;
362 if (tag & 0x80) { /* large item */ 363 if (tag & 0x80) { /* large item */
363 *type = tag; 364 *type = tag;
@@ -368,7 +369,8 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
368 *size = tag & 0x07; 369 *size = tag & 0x07;
369 } 370 }
370#if 0 371#if 0
371 printk(KERN_DEBUG "tag = 0x%x, type = 0x%x, size = %i\n", tag, *type, *size); 372 printk(KERN_DEBUG "tag = 0x%x, type = 0x%x, size = %i\n", tag, *type,
373 *size);
372#endif 374#endif
373 if (*type == 0xff && *size == 0xffff) /* probably invalid data */ 375 if (*type == 0xff && *size == 0xffff) /* probably invalid data */
374 return -1; 376 return -1;
@@ -388,22 +390,21 @@ static void __init isapnp_skip_bytes(int count)
388 * Parse EISA id. 390 * Parse EISA id.
389 */ 391 */
390 392
391static void isapnp_parse_id(struct pnp_dev * dev, unsigned short vendor, unsigned short device) 393static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
394 unsigned short device)
392{ 395{
393 struct pnp_id * id; 396 struct pnp_id *id;
394 if (!dev) 397 if (!dev)
395 return; 398 return;
396 id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 399 id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
397 if (!id) 400 if (!id)
398 return; 401 return;
399 sprintf(id->id, "%c%c%c%x%x%x%x", 402 sprintf(id->id, "%c%c%c%x%x%x%x",
400 'A' + ((vendor >> 2) & 0x3f) - 1, 403 'A' + ((vendor >> 2) & 0x3f) - 1,
401 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, 404 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
402 'A' + ((vendor >> 8) & 0x1f) - 1, 405 'A' + ((vendor >> 8) & 0x1f) - 1,
403 (device >> 4) & 0x0f, 406 (device >> 4) & 0x0f,
404 device & 0x0f, 407 device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
405 (device >> 12) & 0x0f,
406 (device >> 8) & 0x0f);
407 pnp_add_id(id, dev); 408 pnp_add_id(id, dev);
408} 409}
409 410
@@ -411,7 +412,8 @@ static void isapnp_parse_id(struct pnp_dev * dev, unsigned short vendor, unsigne
411 * Parse logical device tag. 412 * Parse logical device tag.
412 */ 413 */
413 414
414static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int size, int number) 415static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
416 int size, int number)
415{ 417{
416 unsigned char tmp[6]; 418 unsigned char tmp[6];
417 struct pnp_dev *dev; 419 struct pnp_dev *dev;
@@ -435,13 +437,12 @@ static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int si
435 return dev; 437 return dev;
436} 438}
437 439
438
439/* 440/*
440 * Add IRQ resource to resources list. 441 * Add IRQ resource to resources list.
441 */ 442 */
442 443
443static void __init isapnp_parse_irq_resource(struct pnp_option *option, 444static void __init isapnp_parse_irq_resource(struct pnp_option *option,
444 int size) 445 int size)
445{ 446{
446 unsigned char tmp[3]; 447 unsigned char tmp[3];
447 struct pnp_irq *irq; 448 struct pnp_irq *irq;
@@ -466,7 +467,7 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
466 */ 467 */
467 468
468static void __init isapnp_parse_dma_resource(struct pnp_option *option, 469static void __init isapnp_parse_dma_resource(struct pnp_option *option,
469 int size) 470 int size)
470{ 471{
471 unsigned char tmp[2]; 472 unsigned char tmp[2];
472 struct pnp_dma *dma; 473 struct pnp_dma *dma;
@@ -486,7 +487,7 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option,
486 */ 487 */
487 488
488static void __init isapnp_parse_port_resource(struct pnp_option *option, 489static void __init isapnp_parse_port_resource(struct pnp_option *option,
489 int size) 490 int size)
490{ 491{
491 unsigned char tmp[7]; 492 unsigned char tmp[7];
492 struct pnp_port *port; 493 struct pnp_port *port;
@@ -500,7 +501,7 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
500 port->align = tmp[5]; 501 port->align = tmp[5];
501 port->size = tmp[6]; 502 port->size = tmp[6];
502 port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0; 503 port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
503 pnp_register_port_resource(option,port); 504 pnp_register_port_resource(option, port);
504 return; 505 return;
505} 506}
506 507
@@ -509,7 +510,7 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
509 */ 510 */
510 511
511static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option, 512static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
512 int size) 513 int size)
513{ 514{
514 unsigned char tmp[3]; 515 unsigned char tmp[3];
515 struct pnp_port *port; 516 struct pnp_port *port;
@@ -522,7 +523,7 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
522 port->size = tmp[2]; 523 port->size = tmp[2];
523 port->align = 0; 524 port->align = 0;
524 port->flags = PNP_PORT_FLAG_FIXED; 525 port->flags = PNP_PORT_FLAG_FIXED;
525 pnp_register_port_resource(option,port); 526 pnp_register_port_resource(option, port);
526 return; 527 return;
527} 528}
528 529
@@ -531,7 +532,7 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
531 */ 532 */
532 533
533static void __init isapnp_parse_mem_resource(struct pnp_option *option, 534static void __init isapnp_parse_mem_resource(struct pnp_option *option,
534 int size) 535 int size)
535{ 536{
536 unsigned char tmp[9]; 537 unsigned char tmp[9];
537 struct pnp_mem *mem; 538 struct pnp_mem *mem;
@@ -545,7 +546,7 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
545 mem->align = (tmp[6] << 8) | tmp[5]; 546 mem->align = (tmp[6] << 8) | tmp[5];
546 mem->size = ((tmp[8] << 8) | tmp[7]) << 8; 547 mem->size = ((tmp[8] << 8) | tmp[7]) << 8;
547 mem->flags = tmp[0]; 548 mem->flags = tmp[0];
548 pnp_register_mem_resource(option,mem); 549 pnp_register_mem_resource(option, mem);
549 return; 550 return;
550} 551}
551 552
@@ -554,7 +555,7 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
554 */ 555 */
555 556
556static void __init isapnp_parse_mem32_resource(struct pnp_option *option, 557static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
557 int size) 558 int size)
558{ 559{
559 unsigned char tmp[17]; 560 unsigned char tmp[17];
560 struct pnp_mem *mem; 561 struct pnp_mem *mem;
@@ -565,10 +566,12 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
565 return; 566 return;
566 mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; 567 mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
567 mem->max = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; 568 mem->max = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
568 mem->align = (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9]; 569 mem->align =
569 mem->size = (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13]; 570 (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9];
571 mem->size =
572 (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13];
570 mem->flags = tmp[0]; 573 mem->flags = tmp[0];
571 pnp_register_mem_resource(option,mem); 574 pnp_register_mem_resource(option, mem);
572} 575}
573 576
574/* 577/*
@@ -576,7 +579,7 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
576 */ 579 */
577 580
578static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option, 581static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
579 int size) 582 int size)
580{ 583{
581 unsigned char tmp[9]; 584 unsigned char tmp[9];
582 struct pnp_mem *mem; 585 struct pnp_mem *mem;
@@ -585,28 +588,30 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
585 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 588 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
586 if (!mem) 589 if (!mem)
587 return; 590 return;
588 mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; 591 mem->min = mem->max =
592 (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
589 mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5]; 593 mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
590 mem->align = 0; 594 mem->align = 0;
591 mem->flags = tmp[0]; 595 mem->flags = tmp[0];
592 pnp_register_mem_resource(option,mem); 596 pnp_register_mem_resource(option, mem);
593} 597}
594 598
595/* 599/*
596 * Parse card name for ISA PnP device. 600 * Parse card name for ISA PnP device.
597 */ 601 */
598 602
599static void __init 603static void __init
600isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size) 604isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
601{ 605{
602 if (name[0] == '\0') { 606 if (name[0] == '\0') {
603 unsigned short size1 = *size >= name_max ? (name_max - 1) : *size; 607 unsigned short size1 =
608 *size >= name_max ? (name_max - 1) : *size;
604 isapnp_peek(name, size1); 609 isapnp_peek(name, size1);
605 name[size1] = '\0'; 610 name[size1] = '\0';
606 *size -= size1; 611 *size -= size1;
607 612
608 /* clean whitespace from end of string */ 613 /* clean whitespace from end of string */
609 while (size1 > 0 && name[--size1] == ' ') 614 while (size1 > 0 && name[--size1] == ' ')
610 name[size1] = '\0'; 615 name[size1] = '\0';
611 } 616 }
612} 617}
@@ -629,17 +634,19 @@ static int __init isapnp_create_device(struct pnp_card *card,
629 kfree(dev); 634 kfree(dev);
630 return 1; 635 return 1;
631 } 636 }
632 pnp_add_card_device(card,dev); 637 pnp_add_card_device(card, dev);
633 638
634 while (1) { 639 while (1) {
635 if (isapnp_read_tag(&type, &size)<0) 640 if (isapnp_read_tag(&type, &size) < 0)
636 return 1; 641 return 1;
637 if (skip && type != _STAG_LOGDEVID && type != _STAG_END) 642 if (skip && type != _STAG_LOGDEVID && type != _STAG_END)
638 goto __skip; 643 goto __skip;
639 switch (type) { 644 switch (type) {
640 case _STAG_LOGDEVID: 645 case _STAG_LOGDEVID:
641 if (size >= 5 && size <= 6) { 646 if (size >= 5 && size <= 6) {
642 if ((dev = isapnp_parse_device(card, size, number++)) == NULL) 647 if ((dev =
648 isapnp_parse_device(card, size,
649 number++)) == NULL)
643 return 1; 650 return 1;
644 size = 0; 651 size = 0;
645 skip = 0; 652 skip = 0;
@@ -648,7 +655,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
648 kfree(dev); 655 kfree(dev);
649 return 1; 656 return 1;
650 } 657 }
651 pnp_add_card_device(card,dev); 658 pnp_add_card_device(card, dev);
652 } else { 659 } else {
653 skip = 1; 660 skip = 1;
654 } 661 }
@@ -658,7 +665,8 @@ static int __init isapnp_create_device(struct pnp_card *card,
658 case _STAG_COMPATDEVID: 665 case _STAG_COMPATDEVID:
659 if (size == 4 && compat < DEVICE_COUNT_COMPATIBLE) { 666 if (size == 4 && compat < DEVICE_COUNT_COMPATIBLE) {
660 isapnp_peek(tmp, 4); 667 isapnp_peek(tmp, 4);
661 isapnp_parse_id(dev,(tmp[1] << 8) | tmp[0], (tmp[3] << 8) | tmp[2]); 668 isapnp_parse_id(dev, (tmp[1] << 8) | tmp[0],
669 (tmp[3] << 8) | tmp[2]);
662 compat++; 670 compat++;
663 size = 0; 671 size = 0;
664 } 672 }
@@ -684,7 +692,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
684 priority = 0x100 | tmp[0]; 692 priority = 0x100 | tmp[0];
685 size = 0; 693 size = 0;
686 } 694 }
687 option = pnp_register_dependent_option(dev,priority); 695 option = pnp_register_dependent_option(dev, priority);
688 if (!option) 696 if (!option)
689 return 1; 697 return 1;
690 break; 698 break;
@@ -739,11 +747,13 @@ static int __init isapnp_create_device(struct pnp_card *card,
739 isapnp_skip_bytes(size); 747 isapnp_skip_bytes(size);
740 return 1; 748 return 1;
741 default: 749 default:
742 printk(KERN_ERR "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", type, dev->number, card->number); 750 printk(KERN_ERR
751 "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n",
752 type, dev->number, card->number);
743 } 753 }
744 __skip: 754 __skip:
745 if (size > 0) 755 if (size > 0)
746 isapnp_skip_bytes(size); 756 isapnp_skip_bytes(size);
747 } 757 }
748 return 0; 758 return 0;
749} 759}
@@ -758,7 +768,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
758 unsigned short size; 768 unsigned short size;
759 769
760 while (1) { 770 while (1) {
761 if (isapnp_read_tag(&type, &size)<0) 771 if (isapnp_read_tag(&type, &size) < 0)
762 return; 772 return;
763 switch (type) { 773 switch (type) {
764 case _STAG_PNPVERNO: 774 case _STAG_PNPVERNO:
@@ -771,7 +781,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
771 break; 781 break;
772 case _STAG_LOGDEVID: 782 case _STAG_LOGDEVID:
773 if (size >= 5 && size <= 6) { 783 if (size >= 5 && size <= 6) {
774 if (isapnp_create_device(card, size)==1) 784 if (isapnp_create_device(card, size) == 1)
775 return; 785 return;
776 size = 0; 786 size = 0;
777 } 787 }
@@ -779,7 +789,8 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
779 case _STAG_VENDOR: 789 case _STAG_VENDOR:
780 break; 790 break;
781 case _LTAG_ANSISTR: 791 case _LTAG_ANSISTR:
782 isapnp_parse_name(card->name, sizeof(card->name), &size); 792 isapnp_parse_name(card->name, sizeof(card->name),
793 &size);
783 break; 794 break;
784 case _LTAG_UNICODESTR: 795 case _LTAG_UNICODESTR:
785 /* silently ignore */ 796 /* silently ignore */
@@ -792,11 +803,13 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
792 isapnp_skip_bytes(size); 803 isapnp_skip_bytes(size);
793 return; 804 return;
794 default: 805 default:
795 printk(KERN_ERR "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", type, card->number); 806 printk(KERN_ERR
807 "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n",
808 type, card->number);
796 } 809 }
797 __skip: 810 __skip:
798 if (size > 0) 811 if (size > 0)
799 isapnp_skip_bytes(size); 812 isapnp_skip_bytes(size);
800 } 813 }
801} 814}
802 815
@@ -815,7 +828,9 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
815 bit = 0; 828 bit = 0;
816 if (b & (1 << j)) 829 if (b & (1 << j))
817 bit = 1; 830 bit = 1;
818 checksum = ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7) | (checksum >> 1); 831 checksum =
832 ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7)
833 | (checksum >> 1);
819 } 834 }
820 } 835 }
821 return checksum; 836 return checksum;
@@ -825,20 +840,19 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
825 * Parse EISA id for ISA PnP card. 840 * Parse EISA id for ISA PnP card.
826 */ 841 */
827 842
828static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device) 843static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
844 unsigned short device)
829{ 845{
830 struct pnp_id * id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 846 struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
831 if (!id) 847 if (!id)
832 return; 848 return;
833 sprintf(id->id, "%c%c%c%x%x%x%x", 849 sprintf(id->id, "%c%c%c%x%x%x%x",
834 'A' + ((vendor >> 2) & 0x3f) - 1, 850 'A' + ((vendor >> 2) & 0x3f) - 1,
835 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, 851 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
836 'A' + ((vendor >> 8) & 0x1f) - 1, 852 'A' + ((vendor >> 8) & 0x1f) - 1,
837 (device >> 4) & 0x0f, 853 (device >> 4) & 0x0f,
838 device & 0x0f, 854 device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
839 (device >> 12) & 0x0f, 855 pnp_add_card_id(id, card);
840 (device >> 8) & 0x0f);
841 pnp_add_card_id(id,card);
842} 856}
843 857
844/* 858/*
@@ -858,22 +872,29 @@ static int __init isapnp_build_device_list(void)
858 isapnp_peek(header, 9); 872 isapnp_peek(header, 9);
859 checksum = isapnp_checksum(header); 873 checksum = isapnp_checksum(header);
860#if 0 874#if 0
861 printk(KERN_DEBUG "vendor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", 875 printk(KERN_DEBUG
862 header[0], header[1], header[2], header[3], 876 "vendor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
863 header[4], header[5], header[6], header[7], header[8]); 877 header[0], header[1], header[2], header[3], header[4],
878 header[5], header[6], header[7], header[8]);
864 printk(KERN_DEBUG "checksum = 0x%x\n", checksum); 879 printk(KERN_DEBUG "checksum = 0x%x\n", checksum);
865#endif 880#endif
866 if ((card = kzalloc(sizeof(struct pnp_card), GFP_KERNEL)) == NULL) 881 if ((card =
882 kzalloc(sizeof(struct pnp_card), GFP_KERNEL)) == NULL)
867 continue; 883 continue;
868 884
869 card->number = csn; 885 card->number = csn;
870 INIT_LIST_HEAD(&card->devices); 886 INIT_LIST_HEAD(&card->devices);
871 isapnp_parse_card_id(card, (header[1] << 8) | header[0], (header[3] << 8) | header[2]); 887 isapnp_parse_card_id(card, (header[1] << 8) | header[0],
872 card->serial = (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | header[4]; 888 (header[3] << 8) | header[2]);
889 card->serial =
890 (header[7] << 24) | (header[6] << 16) | (header[5] << 8) |
891 header[4];
873 isapnp_checksum_value = 0x00; 892 isapnp_checksum_value = 0x00;
874 isapnp_parse_resource_map(card); 893 isapnp_parse_resource_map(card);
875 if (isapnp_checksum_value != 0x00) 894 if (isapnp_checksum_value != 0x00)
876 printk(KERN_ERR "isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value); 895 printk(KERN_ERR
896 "isapnp: checksum for device %i is not valid (0x%x)\n",
897 csn, isapnp_checksum_value);
877 card->checksum = isapnp_checksum_value; 898 card->checksum = isapnp_checksum_value;
878 card->protocol = &isapnp_protocol; 899 card->protocol = &isapnp_protocol;
879 900
@@ -911,13 +932,13 @@ int isapnp_cfg_begin(int csn, int logdev)
911 /* it is possible to set RDP only in the isolation phase */ 932 /* it is possible to set RDP only in the isolation phase */
912 /* Jens Thoms Toerring <Jens.Toerring@physik.fu-berlin.de> */ 933 /* Jens Thoms Toerring <Jens.Toerring@physik.fu-berlin.de> */
913 isapnp_write_byte(0x02, 0x04); /* clear CSN of card */ 934 isapnp_write_byte(0x02, 0x04); /* clear CSN of card */
914 mdelay(2); /* is this necessary? */ 935 mdelay(2); /* is this necessary? */
915 isapnp_wake(csn); /* bring card into sleep state */ 936 isapnp_wake(csn); /* bring card into sleep state */
916 isapnp_wake(0); /* bring card into isolation state */ 937 isapnp_wake(0); /* bring card into isolation state */
917 isapnp_set_rdp(); /* reset the RDP port */ 938 isapnp_set_rdp(); /* reset the RDP port */
918 udelay(1000); /* delay 1000us */ 939 udelay(1000); /* delay 1000us */
919 isapnp_write_byte(0x06, csn); /* reset CSN to previous value */ 940 isapnp_write_byte(0x06, csn); /* reset CSN to previous value */
920 udelay(250); /* is this necessary? */ 941 udelay(250); /* is this necessary? */
921#endif 942#endif
922 if (logdev >= 0) 943 if (logdev >= 0)
923 isapnp_device(logdev); 944 isapnp_device(logdev);
@@ -931,12 +952,10 @@ int isapnp_cfg_end(void)
931 return 0; 952 return 0;
932} 953}
933 954
934
935/* 955/*
936 * Inititialization. 956 * Inititialization.
937 */ 957 */
938 958
939
940EXPORT_SYMBOL(isapnp_protocol); 959EXPORT_SYMBOL(isapnp_protocol);
941EXPORT_SYMBOL(isapnp_present); 960EXPORT_SYMBOL(isapnp_present);
942EXPORT_SYMBOL(isapnp_cfg_begin); 961EXPORT_SYMBOL(isapnp_cfg_begin);
@@ -946,7 +965,8 @@ EXPORT_SYMBOL(isapnp_read_byte);
946#endif 965#endif
947EXPORT_SYMBOL(isapnp_write_byte); 966EXPORT_SYMBOL(isapnp_write_byte);
948 967
949static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table *res) 968static int isapnp_read_resources(struct pnp_dev *dev,
969 struct pnp_resource_table *res)
950{ 970{
951 int tmp, ret; 971 int tmp, ret;
952 972
@@ -960,31 +980,37 @@ static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table
960 res->port_resource[tmp].flags = IORESOURCE_IO; 980 res->port_resource[tmp].flags = IORESOURCE_IO;
961 } 981 }
962 for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) { 982 for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
963 ret = isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8; 983 ret =
984 isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8;
964 if (!ret) 985 if (!ret)
965 continue; 986 continue;
966 res->mem_resource[tmp].start = ret; 987 res->mem_resource[tmp].start = ret;
967 res->mem_resource[tmp].flags = IORESOURCE_MEM; 988 res->mem_resource[tmp].flags = IORESOURCE_MEM;
968 } 989 }
969 for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) { 990 for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
970 ret = (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> 8); 991 ret =
992 (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >>
993 8);
971 if (!ret) 994 if (!ret)
972 continue; 995 continue;
973 res->irq_resource[tmp].start = res->irq_resource[tmp].end = ret; 996 res->irq_resource[tmp].start =
997 res->irq_resource[tmp].end = ret;
974 res->irq_resource[tmp].flags = IORESOURCE_IRQ; 998 res->irq_resource[tmp].flags = IORESOURCE_IRQ;
975 } 999 }
976 for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) { 1000 for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
977 ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp); 1001 ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp);
978 if (ret == 4) 1002 if (ret == 4)
979 continue; 1003 continue;
980 res->dma_resource[tmp].start = res->dma_resource[tmp].end = ret; 1004 res->dma_resource[tmp].start =
1005 res->dma_resource[tmp].end = ret;
981 res->dma_resource[tmp].flags = IORESOURCE_DMA; 1006 res->dma_resource[tmp].flags = IORESOURCE_DMA;
982 } 1007 }
983 } 1008 }
984 return 0; 1009 return 0;
985} 1010}
986 1011
987static int isapnp_get_resources(struct pnp_dev *dev, struct pnp_resource_table * res) 1012static int isapnp_get_resources(struct pnp_dev *dev,
1013 struct pnp_resource_table *res)
988{ 1014{
989 int ret; 1015 int ret;
990 pnp_init_resource_table(res); 1016 pnp_init_resource_table(res);
@@ -994,24 +1020,44 @@ static int isapnp_get_resources(struct pnp_dev *dev, struct pnp_resource_table *
994 return ret; 1020 return ret;
995} 1021}
996 1022
997static int isapnp_set_resources(struct pnp_dev *dev, struct pnp_resource_table * res) 1023static int isapnp_set_resources(struct pnp_dev *dev,
1024 struct pnp_resource_table *res)
998{ 1025{
999 int tmp; 1026 int tmp;
1000 1027
1001 isapnp_cfg_begin(dev->card->number, dev->number); 1028 isapnp_cfg_begin(dev->card->number, dev->number);
1002 dev->active = 1; 1029 dev->active = 1;
1003 for (tmp = 0; tmp < PNP_MAX_PORT && (res->port_resource[tmp].flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; tmp++) 1030 for (tmp = 0;
1004 isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), res->port_resource[tmp].start); 1031 tmp < PNP_MAX_PORT
1005 for (tmp = 0; tmp < PNP_MAX_IRQ && (res->irq_resource[tmp].flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; tmp++) { 1032 && (res->port_resource[tmp].
1033 flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO;
1034 tmp++)
1035 isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1),
1036 res->port_resource[tmp].start);
1037 for (tmp = 0;
1038 tmp < PNP_MAX_IRQ
1039 && (res->irq_resource[tmp].
1040 flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ;
1041 tmp++) {
1006 int irq = res->irq_resource[tmp].start; 1042 int irq = res->irq_resource[tmp].start;
1007 if (irq == 2) 1043 if (irq == 2)
1008 irq = 9; 1044 irq = 9;
1009 isapnp_write_byte(ISAPNP_CFG_IRQ+(tmp<<1), irq); 1045 isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq);
1010 } 1046 }
1011 for (tmp = 0; tmp < PNP_MAX_DMA && (res->dma_resource[tmp].flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; tmp++) 1047 for (tmp = 0;
1012 isapnp_write_byte(ISAPNP_CFG_DMA+tmp, res->dma_resource[tmp].start); 1048 tmp < PNP_MAX_DMA
1013 for (tmp = 0; tmp < PNP_MAX_MEM && (res->mem_resource[tmp].flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; tmp++) 1049 && (res->dma_resource[tmp].
1014 isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<3), (res->mem_resource[tmp].start >> 8) & 0xffff); 1050 flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA;
1051 tmp++)
1052 isapnp_write_byte(ISAPNP_CFG_DMA + tmp,
1053 res->dma_resource[tmp].start);
1054 for (tmp = 0;
1055 tmp < PNP_MAX_MEM
1056 && (res->mem_resource[tmp].
1057 flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM;
1058 tmp++)
1059 isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3),
1060 (res->mem_resource[tmp].start >> 8) & 0xffff);
1015 /* FIXME: We aren't handling 32bit mems properly here */ 1061 /* FIXME: We aren't handling 32bit mems properly here */
1016 isapnp_activate(dev->number); 1062 isapnp_activate(dev->number);
1017 isapnp_cfg_end(); 1063 isapnp_cfg_end();
@@ -1030,9 +1076,9 @@ static int isapnp_disable_resources(struct pnp_dev *dev)
1030} 1076}
1031 1077
1032struct pnp_protocol isapnp_protocol = { 1078struct pnp_protocol isapnp_protocol = {
1033 .name = "ISA Plug and Play", 1079 .name = "ISA Plug and Play",
1034 .get = isapnp_get_resources, 1080 .get = isapnp_get_resources,
1035 .set = isapnp_set_resources, 1081 .set = isapnp_set_resources,
1036 .disable = isapnp_disable_resources, 1082 .disable = isapnp_disable_resources,
1037}; 1083};
1038 1084
@@ -1053,31 +1099,36 @@ static int __init isapnp_init(void)
1053#endif 1099#endif
1054#ifdef ISAPNP_REGION_OK 1100#ifdef ISAPNP_REGION_OK
1055 if (!request_region(_PIDXR, 1, "isapnp index")) { 1101 if (!request_region(_PIDXR, 1, "isapnp index")) {
1056 printk(KERN_ERR "isapnp: Index Register 0x%x already used\n", _PIDXR); 1102 printk(KERN_ERR "isapnp: Index Register 0x%x already used\n",
1103 _PIDXR);
1057 return -EBUSY; 1104 return -EBUSY;
1058 } 1105 }
1059#endif 1106#endif
1060 if (!request_region(_PNPWRP, 1, "isapnp write")) { 1107 if (!request_region(_PNPWRP, 1, "isapnp write")) {
1061 printk(KERN_ERR "isapnp: Write Data Register 0x%x already used\n", _PNPWRP); 1108 printk(KERN_ERR
1109 "isapnp: Write Data Register 0x%x already used\n",
1110 _PNPWRP);
1062#ifdef ISAPNP_REGION_OK 1111#ifdef ISAPNP_REGION_OK
1063 release_region(_PIDXR, 1); 1112 release_region(_PIDXR, 1);
1064#endif 1113#endif
1065 return -EBUSY; 1114 return -EBUSY;
1066 } 1115 }
1067 1116
1068 if(pnp_register_protocol(&isapnp_protocol)<0) 1117 if (pnp_register_protocol(&isapnp_protocol) < 0)
1069 return -EBUSY; 1118 return -EBUSY;
1070 1119
1071 /* 1120 /*
1072 * Print a message. The existing ISAPnP code is hanging machines 1121 * Print a message. The existing ISAPnP code is hanging machines
1073 * so let the user know where. 1122 * so let the user know where.
1074 */ 1123 */
1075 1124
1076 printk(KERN_INFO "isapnp: Scanning for PnP cards...\n"); 1125 printk(KERN_INFO "isapnp: Scanning for PnP cards...\n");
1077 if (isapnp_rdp >= 0x203 && isapnp_rdp <= 0x3ff) { 1126 if (isapnp_rdp >= 0x203 && isapnp_rdp <= 0x3ff) {
1078 isapnp_rdp |= 3; 1127 isapnp_rdp |= 3;
1079 if (!request_region(isapnp_rdp, 1, "isapnp read")) { 1128 if (!request_region(isapnp_rdp, 1, "isapnp read")) {
1080 printk(KERN_ERR "isapnp: Read Data Register 0x%x already used\n", isapnp_rdp); 1129 printk(KERN_ERR
1130 "isapnp: Read Data Register 0x%x already used\n",
1131 isapnp_rdp);
1081#ifdef ISAPNP_REGION_OK 1132#ifdef ISAPNP_REGION_OK
1082 release_region(_PIDXR, 1); 1133 release_region(_PIDXR, 1);
1083#endif 1134#endif
@@ -1089,14 +1140,14 @@ static int __init isapnp_init(void)
1089 isapnp_detected = 1; 1140 isapnp_detected = 1;
1090 if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) { 1141 if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) {
1091 cards = isapnp_isolate(); 1142 cards = isapnp_isolate();
1092 if (cards < 0 || 1143 if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
1093 (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
1094#ifdef ISAPNP_REGION_OK 1144#ifdef ISAPNP_REGION_OK
1095 release_region(_PIDXR, 1); 1145 release_region(_PIDXR, 1);
1096#endif 1146#endif
1097 release_region(_PNPWRP, 1); 1147 release_region(_PNPWRP, 1);
1098 isapnp_detected = 0; 1148 isapnp_detected = 0;
1099 printk(KERN_INFO "isapnp: No Plug & Play device found\n"); 1149 printk(KERN_INFO
1150 "isapnp: No Plug & Play device found\n");
1100 return 0; 1151 return 0;
1101 } 1152 }
1102 request_region(isapnp_rdp, 1, "isapnp read"); 1153 request_region(isapnp_rdp, 1, "isapnp read");
@@ -1104,19 +1155,23 @@ static int __init isapnp_init(void)
1104 isapnp_build_device_list(); 1155 isapnp_build_device_list();
1105 cards = 0; 1156 cards = 0;
1106 1157
1107 protocol_for_each_card(&isapnp_protocol,card) { 1158 protocol_for_each_card(&isapnp_protocol, card) {
1108 cards++; 1159 cards++;
1109 if (isapnp_verbose) { 1160 if (isapnp_verbose) {
1110 printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown"); 1161 printk(KERN_INFO "isapnp: Card '%s'\n",
1162 card->name[0] ? card->name : "Unknown");
1111 if (isapnp_verbose < 2) 1163 if (isapnp_verbose < 2)
1112 continue; 1164 continue;
1113 card_for_each_dev(card,dev) { 1165 card_for_each_dev(card, dev) {
1114 printk(KERN_INFO "isapnp: Device '%s'\n", dev->name[0]?dev->name:"Unknown"); 1166 printk(KERN_INFO "isapnp: Device '%s'\n",
1167 dev->name[0] ? dev->name : "Unknown");
1115 } 1168 }
1116 } 1169 }
1117 } 1170 }
1118 if (cards) { 1171 if (cards) {
1119 printk(KERN_INFO "isapnp: %i Plug & Play card%s detected total\n", cards, cards>1?"s":""); 1172 printk(KERN_INFO
1173 "isapnp: %i Plug & Play card%s detected total\n", cards,
1174 cards > 1 ? "s" : "");
1120 } else { 1175 } else {
1121 printk(KERN_INFO "isapnp: No Plug & Play card found\n"); 1176 printk(KERN_INFO "isapnp: No Plug & Play card found\n");
1122 } 1177 }
@@ -1141,11 +1196,10 @@ __setup("noisapnp", isapnp_setup_disable);
1141 1196
1142static int __init isapnp_setup_isapnp(char *str) 1197static int __init isapnp_setup_isapnp(char *str)
1143{ 1198{
1144 (void)((get_option(&str,&isapnp_rdp) == 2) && 1199 (void)((get_option(&str, &isapnp_rdp) == 2) &&
1145 (get_option(&str,&isapnp_reset) == 2) && 1200 (get_option(&str, &isapnp_reset) == 2) &&
1146 (get_option(&str,&isapnp_verbose) == 2)); 1201 (get_option(&str, &isapnp_verbose) == 2));
1147 return 1; 1202 return 1;
1148} 1203}
1149 1204
1150__setup("isapnp=", isapnp_setup_isapnp); 1205__setup("isapnp=", isapnp_setup_isapnp);
1151
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index 40b724ebe23b..fba4b072e6bd 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -54,7 +54,8 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
54 return (file->f_pos = new); 54 return (file->f_pos = new);
55} 55}
56 56
57static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) 57static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
58 size_t nbytes, loff_t * ppos)
58{ 59{
59 struct inode *ino = file->f_path.dentry->d_inode; 60 struct inode *ino = file->f_path.dentry->d_inode;
60 struct proc_dir_entry *dp = PDE(ino); 61 struct proc_dir_entry *dp = PDE(ino);
@@ -74,7 +75,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t
74 return -EINVAL; 75 return -EINVAL;
75 76
76 isapnp_cfg_begin(dev->card->number, dev->number); 77 isapnp_cfg_begin(dev->card->number, dev->number);
77 for ( ; pos < 256 && cnt > 0; pos++, buf++, cnt--) { 78 for (; pos < 256 && cnt > 0; pos++, buf++, cnt--) {
78 unsigned char val; 79 unsigned char val;
79 val = isapnp_read_byte(pos); 80 val = isapnp_read_byte(pos);
80 __put_user(val, buf); 81 __put_user(val, buf);
@@ -85,10 +86,9 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t
85 return nbytes; 86 return nbytes;
86} 87}
87 88
88static const struct file_operations isapnp_proc_bus_file_operations = 89static const struct file_operations isapnp_proc_bus_file_operations = {
89{ 90 .llseek = isapnp_proc_bus_lseek,
90 .llseek = isapnp_proc_bus_lseek, 91 .read = isapnp_proc_bus_read,
91 .read = isapnp_proc_bus_read,
92}; 92};
93 93
94static int isapnp_proc_attach_device(struct pnp_dev *dev) 94static int isapnp_proc_attach_device(struct pnp_dev *dev)
@@ -145,7 +145,7 @@ int __init isapnp_proc_init(void)
145{ 145{
146 struct pnp_dev *dev; 146 struct pnp_dev *dev;
147 isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus); 147 isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
148 protocol_for_each_dev(&isapnp_protocol,dev) { 148 protocol_for_each_dev(&isapnp_protocol, dev) {
149 isapnp_proc_attach_device(dev); 149 isapnp_proc_attach_device(dev);
150 } 150 }
151 return 0; 151 return 0;