diff options
Diffstat (limited to 'drivers/pnp/isapnp/compat.c')
-rw-r--r-- | drivers/pnp/isapnp/compat.c | 23 |
1 files changed, 12 insertions, 11 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 | ||
26 | struct pnp_card *pnp_find_card(unsigned short vendor, | 23 | struct 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 | ||
46 | struct pnp_dev *pnp_find_dev(struct pnp_card *card, | 45 | struct 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; |