diff options
Diffstat (limited to 'drivers/pnp/isapnp/compat.c')
-rw-r--r-- | drivers/pnp/isapnp/compat.c | 30 |
1 files changed, 14 insertions, 16 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 | ||
15 | static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short device) | 15 | static 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 | ||
27 | struct pnp_card *pnp_find_card(unsigned short vendor, | 26 | struct 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 | ||
48 | struct pnp_dev *pnp_find_dev(struct pnp_card *card, | 46 | struct 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 | } |