aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/isapnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/isapnp')
-rw-r--r--drivers/pnp/isapnp/compat.c23
-rw-r--r--drivers/pnp/isapnp/core.c30
-rw-r--r--drivers/pnp/isapnp/proc.c7
3 files changed, 20 insertions, 40 deletions
diff --git a/drivers/pnp/isapnp/compat.c b/drivers/pnp/isapnp/compat.c
index aaf45e3ebee2..10bdcc4d4f7b 100644
--- a/drivers/pnp/isapnp/compat.c
+++ b/drivers/pnp/isapnp/compat.c
@@ -3,11 +3,8 @@
3 * the old isapnp APIs. If possible use the new APIs instead. 3 * the old isapnp APIs. If possible use the new APIs instead.
4 * 4 *
5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
6 *
7 */ 6 */
8 7
9/* TODO: see if more isapnp functions are needed here */
10
11#include <linux/module.h> 8#include <linux/module.h>
12#include <linux/isapnp.h> 9#include <linux/isapnp.h>
13#include <linux/string.h> 10#include <linux/string.h>
@@ -19,16 +16,17 @@ static void pnp_convert_id(char *buf, unsigned short vendor,
19 'A' + ((vendor >> 2) & 0x3f) - 1, 16 'A' + ((vendor >> 2) & 0x3f) - 1,
20 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1, 17 'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
21 'A' + ((vendor >> 8) & 0x1f) - 1, 18 'A' + ((vendor >> 8) & 0x1f) - 1,
22 (device >> 4) & 0x0f, 19 (device >> 4) & 0x0f, device & 0x0f,
23 device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f); 20 (device >> 12) & 0x0f, (device >> 8) & 0x0f);
24} 21}
25 22
26struct pnp_card *pnp_find_card(unsigned short vendor, 23struct pnp_card *pnp_find_card(unsigned short vendor, unsigned short device,
27 unsigned short device, struct pnp_card *from) 24 struct pnp_card *from)
28{ 25{
29 char id[8]; 26 char id[8];
30 char any[8]; 27 char any[8];
31 struct list_head *list; 28 struct list_head *list;
29
32 pnp_convert_id(id, vendor, device); 30 pnp_convert_id(id, vendor, device);
33 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID); 31 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
34 32
@@ -36,6 +34,7 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
36 34
37 while (list != &pnp_cards) { 35 while (list != &pnp_cards) {
38 struct pnp_card *card = global_to_pnp_card(list); 36 struct pnp_card *card = global_to_pnp_card(list);
37
39 if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0)) 38 if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0))
40 return card; 39 return card;
41 list = list->next; 40 list = list->next;
@@ -43,12 +42,12 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
43 return NULL; 42 return NULL;
44} 43}
45 44
46struct pnp_dev *pnp_find_dev(struct pnp_card *card, 45struct pnp_dev *pnp_find_dev(struct pnp_card *card, unsigned short vendor,
47 unsigned short vendor,
48 unsigned short function, struct pnp_dev *from) 46 unsigned short function, struct pnp_dev *from)
49{ 47{
50 char id[8]; 48 char id[8];
51 char any[8]; 49 char any[8];
50
52 pnp_convert_id(id, vendor, function); 51 pnp_convert_id(id, vendor, function);
53 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID); 52 pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
54 if (card == NULL) { /* look for a logical device from all cards */ 53 if (card == NULL) { /* look for a logical device from all cards */
@@ -60,8 +59,9 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
60 59
61 while (list != &pnp_global) { 60 while (list != &pnp_global) {
62 struct pnp_dev *dev = global_to_pnp_dev(list); 61 struct pnp_dev *dev = global_to_pnp_dev(list);
63 if (compare_pnp_id(dev->id, id) 62
64 || (memcmp(id, any, 7) == 0)) 63 if (compare_pnp_id(dev->id, id) ||
64 (memcmp(id, any, 7) == 0))
65 return dev; 65 return dev;
66 list = list->next; 66 list = list->next;
67 } 67 }
@@ -76,6 +76,7 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
76 } 76 }
77 while (list != &card->devices) { 77 while (list != &card->devices) {
78 struct pnp_dev *dev = card_to_pnp_dev(list); 78 struct pnp_dev *dev = card_to_pnp_dev(list);
79
79 if (compare_pnp_id(dev->id, id)) 80 if (compare_pnp_id(dev->id, id))
80 return dev; 81 return dev;
81 list = list->next; 82 list = list->next;
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 0d690a7c0d24..b4e2aa995b53 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -252,7 +252,6 @@ static inline void isapnp_set_rdp(void)
252 * Perform an isolation. The port selection code now tries to avoid 252 * Perform an isolation. The port selection code now tries to avoid
253 * "dangerous to read" ports. 253 * "dangerous to read" ports.
254 */ 254 */
255
256static int __init isapnp_isolate_rdp_select(void) 255static int __init isapnp_isolate_rdp_select(void)
257{ 256{
258 isapnp_wait(); 257 isapnp_wait();
@@ -281,7 +280,6 @@ static int __init isapnp_isolate_rdp_select(void)
281/* 280/*
282 * Isolate (assign uniqued CSN) to all ISA PnP devices. 281 * Isolate (assign uniqued CSN) to all ISA PnP devices.
283 */ 282 */
284
285static int __init isapnp_isolate(void) 283static int __init isapnp_isolate(void)
286{ 284{
287 unsigned char checksum = 0x6a; 285 unsigned char checksum = 0x6a;
@@ -352,7 +350,6 @@ static int __init isapnp_isolate(void)
352/* 350/*
353 * Read one tag from stream. 351 * Read one tag from stream.
354 */ 352 */
355
356static int __init isapnp_read_tag(unsigned char *type, unsigned short *size) 353static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
357{ 354{
358 unsigned char tag, tmp[2]; 355 unsigned char tag, tmp[2];
@@ -380,7 +377,6 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
380/* 377/*
381 * Skip specified number of bytes from stream. 378 * Skip specified number of bytes from stream.
382 */ 379 */
383
384static void __init isapnp_skip_bytes(int count) 380static void __init isapnp_skip_bytes(int count)
385{ 381{
386 isapnp_peek(NULL, count); 382 isapnp_peek(NULL, count);
@@ -389,11 +385,11 @@ static void __init isapnp_skip_bytes(int count)
389/* 385/*
390 * Parse EISA id. 386 * Parse EISA id.
391 */ 387 */
392
393static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor, 388static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
394 unsigned short device) 389 unsigned short device)
395{ 390{
396 struct pnp_id *id; 391 struct pnp_id *id;
392
397 if (!dev) 393 if (!dev)
398 return; 394 return;
399 id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 395 id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
@@ -411,7 +407,6 @@ static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
411/* 407/*
412 * Parse logical device tag. 408 * Parse logical device tag.
413 */ 409 */
414
415static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card, 410static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
416 int size, int number) 411 int size, int number)
417{ 412{
@@ -440,7 +435,6 @@ static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
440/* 435/*
441 * Add IRQ resource to resources list. 436 * Add IRQ resource to resources list.
442 */ 437 */
443
444static void __init isapnp_parse_irq_resource(struct pnp_option *option, 438static void __init isapnp_parse_irq_resource(struct pnp_option *option,
445 int size) 439 int size)
446{ 440{
@@ -459,13 +453,11 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
459 else 453 else
460 irq->flags = IORESOURCE_IRQ_HIGHEDGE; 454 irq->flags = IORESOURCE_IRQ_HIGHEDGE;
461 pnp_register_irq_resource(option, irq); 455 pnp_register_irq_resource(option, irq);
462 return;
463} 456}
464 457
465/* 458/*
466 * Add DMA resource to resources list. 459 * Add DMA resource to resources list.
467 */ 460 */
468
469static void __init isapnp_parse_dma_resource(struct pnp_option *option, 461static void __init isapnp_parse_dma_resource(struct pnp_option *option,
470 int size) 462 int size)
471{ 463{
@@ -479,13 +471,11 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option,
479 dma->map = tmp[0]; 471 dma->map = tmp[0];
480 dma->flags = tmp[1]; 472 dma->flags = tmp[1];
481 pnp_register_dma_resource(option, dma); 473 pnp_register_dma_resource(option, dma);
482 return;
483} 474}
484 475
485/* 476/*
486 * Add port resource to resources list. 477 * Add port resource to resources list.
487 */ 478 */
488
489static void __init isapnp_parse_port_resource(struct pnp_option *option, 479static void __init isapnp_parse_port_resource(struct pnp_option *option,
490 int size) 480 int size)
491{ 481{
@@ -502,13 +492,11 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
502 port->size = tmp[6]; 492 port->size = tmp[6];
503 port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0; 493 port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
504 pnp_register_port_resource(option, port); 494 pnp_register_port_resource(option, port);
505 return;
506} 495}
507 496
508/* 497/*
509 * Add fixed port resource to resources list. 498 * Add fixed port resource to resources list.
510 */ 499 */
511
512static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option, 500static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
513 int size) 501 int size)
514{ 502{
@@ -524,13 +512,11 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
524 port->align = 0; 512 port->align = 0;
525 port->flags = PNP_PORT_FLAG_FIXED; 513 port->flags = PNP_PORT_FLAG_FIXED;
526 pnp_register_port_resource(option, port); 514 pnp_register_port_resource(option, port);
527 return;
528} 515}
529 516
530/* 517/*
531 * Add memory resource to resources list. 518 * Add memory resource to resources list.
532 */ 519 */
533
534static void __init isapnp_parse_mem_resource(struct pnp_option *option, 520static void __init isapnp_parse_mem_resource(struct pnp_option *option,
535 int size) 521 int size)
536{ 522{
@@ -547,13 +533,11 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
547 mem->size = ((tmp[8] << 8) | tmp[7]) << 8; 533 mem->size = ((tmp[8] << 8) | tmp[7]) << 8;
548 mem->flags = tmp[0]; 534 mem->flags = tmp[0];
549 pnp_register_mem_resource(option, mem); 535 pnp_register_mem_resource(option, mem);
550 return;
551} 536}
552 537
553/* 538/*
554 * Add 32-bit memory resource to resources list. 539 * Add 32-bit memory resource to resources list.
555 */ 540 */
556
557static void __init isapnp_parse_mem32_resource(struct pnp_option *option, 541static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
558 int size) 542 int size)
559{ 543{
@@ -577,7 +561,6 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
577/* 561/*
578 * Add 32-bit fixed memory resource to resources list. 562 * Add 32-bit fixed memory resource to resources list.
579 */ 563 */
580
581static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option, 564static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
582 int size) 565 int size)
583{ 566{
@@ -599,7 +582,6 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
599/* 582/*
600 * Parse card name for ISA PnP device. 583 * Parse card name for ISA PnP device.
601 */ 584 */
602
603static void __init 585static void __init
604isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size) 586isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
605{ 587{
@@ -619,7 +601,6 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
619/* 601/*
620 * Parse resource map for logical device. 602 * Parse resource map for logical device.
621 */ 603 */
622
623static int __init isapnp_create_device(struct pnp_card *card, 604static int __init isapnp_create_device(struct pnp_card *card,
624 unsigned short size) 605 unsigned short size)
625{ 606{
@@ -627,6 +608,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
627 unsigned char type, tmp[17]; 608 unsigned char type, tmp[17];
628 struct pnp_option *option; 609 struct pnp_option *option;
629 struct pnp_dev *dev; 610 struct pnp_dev *dev;
611
630 if ((dev = isapnp_parse_device(card, size, number++)) == NULL) 612 if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
631 return 1; 613 return 1;
632 option = pnp_register_independent_option(dev); 614 option = pnp_register_independent_option(dev);
@@ -761,7 +743,6 @@ static int __init isapnp_create_device(struct pnp_card *card,
761/* 743/*
762 * Parse resource map for ISA PnP card. 744 * Parse resource map for ISA PnP card.
763 */ 745 */
764
765static void __init isapnp_parse_resource_map(struct pnp_card *card) 746static void __init isapnp_parse_resource_map(struct pnp_card *card)
766{ 747{
767 unsigned char type, tmp[17]; 748 unsigned char type, tmp[17];
@@ -816,7 +797,6 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
816/* 797/*
817 * Compute ISA PnP checksum for first eight bytes. 798 * Compute ISA PnP checksum for first eight bytes.
818 */ 799 */
819
820static unsigned char __init isapnp_checksum(unsigned char *data) 800static unsigned char __init isapnp_checksum(unsigned char *data)
821{ 801{
822 int i, j; 802 int i, j;
@@ -839,11 +819,11 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
839/* 819/*
840 * Parse EISA id for ISA PnP card. 820 * Parse EISA id for ISA PnP card.
841 */ 821 */
842
843static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor, 822static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
844 unsigned short device) 823 unsigned short device)
845{ 824{
846 struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); 825 struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
826
847 if (!id) 827 if (!id)
848 return; 828 return;
849 sprintf(id->id, "%c%c%c%x%x%x%x", 829 sprintf(id->id, "%c%c%c%x%x%x%x",
@@ -858,7 +838,6 @@ static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
858/* 838/*
859 * Build device list for all present ISA PnP devices. 839 * Build device list for all present ISA PnP devices.
860 */ 840 */
861
862static int __init isapnp_build_device_list(void) 841static int __init isapnp_build_device_list(void)
863{ 842{
864 int csn; 843 int csn;
@@ -911,6 +890,7 @@ static int __init isapnp_build_device_list(void)
911int isapnp_present(void) 890int isapnp_present(void)
912{ 891{
913 struct pnp_card *card; 892 struct pnp_card *card;
893
914 pnp_for_each_card(card) { 894 pnp_for_each_card(card) {
915 if (card->protocol == &isapnp_protocol) 895 if (card->protocol == &isapnp_protocol)
916 return 1; 896 return 1;
@@ -953,7 +933,7 @@ int isapnp_cfg_end(void)
953} 933}
954 934
955/* 935/*
956 * Inititialization. 936 * Initialization.
957 */ 937 */
958 938
959EXPORT_SYMBOL(isapnp_protocol); 939EXPORT_SYMBOL(isapnp_protocol);
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index fba4b072e6bd..3fbc0f9ffc26 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -2,7 +2,6 @@
2 * ISA Plug & Play support 2 * ISA Plug & Play support
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz> 3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 * 4 *
5 *
6 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; either version 2 of the License, or
@@ -16,7 +15,6 @@
16 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 */ 18 */
21 19
22#include <linux/module.h> 20#include <linux/module.h>
@@ -139,11 +137,12 @@ static int __exit isapnp_proc_detach_bus(struct pnp_card *bus)
139 remove_proc_entry(name, isapnp_proc_bus_dir); 137 remove_proc_entry(name, isapnp_proc_bus_dir);
140 return 0; 138 return 0;
141} 139}
142#endif /* MODULE */ 140#endif /* MODULE */
143 141
144int __init isapnp_proc_init(void) 142int __init isapnp_proc_init(void)
145{ 143{
146 struct pnp_dev *dev; 144 struct pnp_dev *dev;
145
147 isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus); 146 isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
148 protocol_for_each_dev(&isapnp_protocol, dev) { 147 protocol_for_each_dev(&isapnp_protocol, dev) {
149 isapnp_proc_attach_device(dev); 148 isapnp_proc_attach_device(dev);
@@ -167,4 +166,4 @@ int __exit isapnp_proc_done(void)
167 remove_proc_entry("isapnp", proc_bus); 166 remove_proc_entry("isapnp", proc_bus);
168 return 0; 167 return 0;
169} 168}
170#endif /* MODULE */ 169#endif /* MODULE */