diff options
author | Len Brown <len.brown@intel.com> | 2007-08-24 22:20:22 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-08-24 22:20:22 -0400 |
commit | a6729753a7219181cd704028d3533951e96a49bd (patch) | |
tree | f9b954c8447c320f4d83055f21eb1e6202d39e25 /drivers | |
parent | 4548a9dbe01eb2a357ad290abdbc21a3814dd568 (diff) | |
parent | b173491339b9ae7f1322241ce6228c1268513a39 (diff) |
Pull pnp into release branch
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/card.c | 16 | ||||
-rw-r--r-- | drivers/pnp/core.c | 7 | ||||
-rw-r--r-- | drivers/pnp/driver.c | 6 | ||||
-rw-r--r-- | drivers/pnp/interface.c | 9 | ||||
-rw-r--r-- | drivers/pnp/isapnp/core.c | 24 | ||||
-rw-r--r-- | drivers/pnp/isapnp/proc.c | 45 | ||||
-rw-r--r-- | drivers/pnp/manager.c | 27 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 4 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 23 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 44 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/proc.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 9 | ||||
-rw-r--r-- | drivers/pnp/resource.c | 26 |
13 files changed, 42 insertions, 200 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index b6a4f02b01d1..6c0440c20e31 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c | |||
@@ -25,13 +25,13 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv, | |||
25 | int found; | 25 | int found; |
26 | struct pnp_dev *dev; | 26 | struct pnp_dev *dev; |
27 | 27 | ||
28 | if (i == PNP_MAX_DEVICES | 28 | if (i == PNP_MAX_DEVICES || |
29 | || !*drv_id->devs[i].id) | 29 | !*drv_id->devs[i].id) |
30 | return drv_id; | 30 | return drv_id; |
31 | found = 0; | 31 | found = 0; |
32 | card_for_each_dev(card, dev) { | 32 | card_for_each_dev(card, dev) { |
33 | if (compare_pnp_id | 33 | if (compare_pnp_id(dev->id, |
34 | (dev->id, drv_id->devs[i].id)) { | 34 | drv_id->devs[i].id)) { |
35 | found = 1; | 35 | found = 1; |
36 | break; | 36 | break; |
37 | } | 37 | } |
@@ -183,7 +183,7 @@ static int pnp_interface_attach_card(struct pnp_card *card) | |||
183 | 183 | ||
184 | return 0; | 184 | return 0; |
185 | 185 | ||
186 | err_name: | 186 | err_name: |
187 | device_remove_file(&card->dev, &dev_attr_name); | 187 | device_remove_file(&card->dev, &dev_attr_name); |
188 | return rc; | 188 | return rc; |
189 | } | 189 | } |
@@ -321,10 +321,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, | |||
321 | pos = pos->next; | 321 | pos = pos->next; |
322 | } | 322 | } |
323 | 323 | ||
324 | done: | 324 | done: |
325 | return NULL; | 325 | return NULL; |
326 | 326 | ||
327 | found: | 327 | found: |
328 | dev->card_link = clink; | 328 | dev->card_link = clink; |
329 | dev->dev.driver = &drv->link.driver; | 329 | dev->dev.driver = &drv->link.driver; |
330 | if (pnp_bus_type.probe(&dev->dev)) | 330 | if (pnp_bus_type.probe(&dev->dev)) |
@@ -334,7 +334,7 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, | |||
334 | 334 | ||
335 | return dev; | 335 | return dev; |
336 | 336 | ||
337 | err_out: | 337 | err_out: |
338 | dev->dev.driver = NULL; | 338 | dev->dev.driver = NULL; |
339 | dev->card_link = NULL; | 339 | dev->card_link = NULL; |
340 | return NULL; | 340 | return NULL; |
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index 61066fdb9e6d..d5964feb14de 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c | |||
@@ -52,9 +52,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol) | |||
52 | int nodenum; | 52 | int nodenum; |
53 | struct list_head *pos; | 53 | struct list_head *pos; |
54 | 54 | ||
55 | if (!protocol) | ||
56 | return -EINVAL; | ||
57 | |||
58 | INIT_LIST_HEAD(&protocol->devices); | 55 | INIT_LIST_HEAD(&protocol->devices); |
59 | INIT_LIST_HEAD(&protocol->cards); | 56 | INIT_LIST_HEAD(&protocol->cards); |
60 | nodenum = 0; | 57 | nodenum = 0; |
@@ -94,8 +91,6 @@ static void pnp_free_ids(struct pnp_dev *dev) | |||
94 | struct pnp_id *id; | 91 | struct pnp_id *id; |
95 | struct pnp_id *next; | 92 | struct pnp_id *next; |
96 | 93 | ||
97 | if (!dev) | ||
98 | return; | ||
99 | id = dev->id; | 94 | id = dev->id; |
100 | while (id) { | 95 | while (id) { |
101 | next = id->next; | 96 | next = id->next; |
@@ -143,7 +138,7 @@ int __pnp_add_device(struct pnp_dev *dev) | |||
143 | */ | 138 | */ |
144 | int pnp_add_device(struct pnp_dev *dev) | 139 | int pnp_add_device(struct pnp_dev *dev) |
145 | { | 140 | { |
146 | if (!dev || !dev->protocol || dev->card) | 141 | if (dev->card) |
147 | return -EINVAL; | 142 | return -EINVAL; |
148 | dev->dev.parent = &dev->protocol->dev; | 143 | dev->dev.parent = &dev->protocol->dev; |
149 | sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, | 144 | sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 30b8f6f3258a..2fa64a6b25c8 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -118,7 +118,7 @@ static int pnp_device_probe(struct device *dev) | |||
118 | goto fail; | 118 | goto fail; |
119 | return error; | 119 | return error; |
120 | 120 | ||
121 | fail: | 121 | fail: |
122 | pnp_device_detach(pnp_dev); | 122 | pnp_device_detach(pnp_dev); |
123 | return error; | 123 | return error; |
124 | } | 124 | } |
@@ -232,10 +232,6 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) | |||
232 | { | 232 | { |
233 | struct pnp_id *ptr; | 233 | struct pnp_id *ptr; |
234 | 234 | ||
235 | if (!id) | ||
236 | return -EINVAL; | ||
237 | if (!dev) | ||
238 | return -EINVAL; | ||
239 | id->next = NULL; | 235 | id->next = NULL; |
240 | ptr = dev->id; | 236 | ptr = dev->id; |
241 | while (ptr && ptr->next) | 237 | while (ptr && ptr->next) |
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index fe6684e13e82..a0cfb75bbb8d 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -459,7 +459,8 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
459 | up(&pnp_res_mutex); | 459 | up(&pnp_res_mutex); |
460 | goto done; | 460 | goto done; |
461 | } | 461 | } |
462 | done: | 462 | |
463 | done: | ||
463 | if (retval < 0) | 464 | if (retval < 0) |
464 | return retval; | 465 | return retval; |
465 | return count; | 466 | return count; |
@@ -499,10 +500,10 @@ int pnp_interface_attach_device(struct pnp_dev *dev) | |||
499 | 500 | ||
500 | return 0; | 501 | return 0; |
501 | 502 | ||
502 | err_res: | 503 | err_res: |
503 | device_remove_file(&dev->dev, &dev_attr_resources); | 504 | device_remove_file(&dev->dev, &dev_attr_resources); |
504 | err_opt: | 505 | err_opt: |
505 | device_remove_file(&dev->dev, &dev_attr_options); | 506 | device_remove_file(&dev->dev, &dev_attr_options); |
506 | err: | 507 | err: |
507 | return rc; | 508 | return rc; |
508 | } | 509 | } |
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index b4e2aa995b53..b035d60a1dcc 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -47,9 +47,6 @@ | |||
47 | #if 0 | 47 | #if 0 |
48 | #define ISAPNP_REGION_OK | 48 | #define ISAPNP_REGION_OK |
49 | #endif | 49 | #endif |
50 | #if 0 | ||
51 | #define ISAPNP_DEBUG | ||
52 | #endif | ||
53 | 50 | ||
54 | int isapnp_disable; /* Disable ISA PnP */ | 51 | int isapnp_disable; /* Disable ISA PnP */ |
55 | static int isapnp_rdp; /* Read Data Port */ | 52 | static int isapnp_rdp; /* Read Data Port */ |
@@ -93,7 +90,6 @@ MODULE_LICENSE("GPL"); | |||
93 | 90 | ||
94 | static unsigned char isapnp_checksum_value; | 91 | static unsigned char isapnp_checksum_value; |
95 | static DEFINE_MUTEX(isapnp_cfg_mutex); | 92 | static DEFINE_MUTEX(isapnp_cfg_mutex); |
96 | static int isapnp_detected; | ||
97 | static int isapnp_csn_count; | 93 | static int isapnp_csn_count; |
98 | 94 | ||
99 | /* some prototypes */ | 95 | /* some prototypes */ |
@@ -335,7 +331,7 @@ static int __init isapnp_isolate(void) | |||
335 | } else if (iteration > 1) { | 331 | } else if (iteration > 1) { |
336 | break; | 332 | break; |
337 | } | 333 | } |
338 | __next: | 334 | __next: |
339 | if (csn == 255) | 335 | if (csn == 255) |
340 | break; | 336 | break; |
341 | checksum = 0x6a; | 337 | checksum = 0x6a; |
@@ -733,7 +729,7 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
733 | "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", | 729 | "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", |
734 | type, dev->number, card->number); | 730 | type, dev->number, card->number); |
735 | } | 731 | } |
736 | __skip: | 732 | __skip: |
737 | if (size > 0) | 733 | if (size > 0) |
738 | isapnp_skip_bytes(size); | 734 | isapnp_skip_bytes(size); |
739 | } | 735 | } |
@@ -788,7 +784,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card) | |||
788 | "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", | 784 | "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", |
789 | type, card->number); | 785 | type, card->number); |
790 | } | 786 | } |
791 | __skip: | 787 | __skip: |
792 | if (size > 0) | 788 | if (size > 0) |
793 | isapnp_skip_bytes(size); | 789 | isapnp_skip_bytes(size); |
794 | } | 790 | } |
@@ -940,9 +936,6 @@ EXPORT_SYMBOL(isapnp_protocol); | |||
940 | EXPORT_SYMBOL(isapnp_present); | 936 | EXPORT_SYMBOL(isapnp_present); |
941 | EXPORT_SYMBOL(isapnp_cfg_begin); | 937 | EXPORT_SYMBOL(isapnp_cfg_begin); |
942 | EXPORT_SYMBOL(isapnp_cfg_end); | 938 | EXPORT_SYMBOL(isapnp_cfg_end); |
943 | #if 0 | ||
944 | EXPORT_SYMBOL(isapnp_read_byte); | ||
945 | #endif | ||
946 | EXPORT_SYMBOL(isapnp_write_byte); | 939 | EXPORT_SYMBOL(isapnp_write_byte); |
947 | 940 | ||
948 | static int isapnp_read_resources(struct pnp_dev *dev, | 941 | static int isapnp_read_resources(struct pnp_dev *dev, |
@@ -993,6 +986,7 @@ static int isapnp_get_resources(struct pnp_dev *dev, | |||
993 | struct pnp_resource_table *res) | 986 | struct pnp_resource_table *res) |
994 | { | 987 | { |
995 | int ret; | 988 | int ret; |
989 | |||
996 | pnp_init_resource_table(res); | 990 | pnp_init_resource_table(res); |
997 | isapnp_cfg_begin(dev->card->number, dev->number); | 991 | isapnp_cfg_begin(dev->card->number, dev->number); |
998 | ret = isapnp_read_resources(dev, res); | 992 | ret = isapnp_read_resources(dev, res); |
@@ -1046,7 +1040,7 @@ static int isapnp_set_resources(struct pnp_dev *dev, | |||
1046 | 1040 | ||
1047 | static int isapnp_disable_resources(struct pnp_dev *dev) | 1041 | static int isapnp_disable_resources(struct pnp_dev *dev) |
1048 | { | 1042 | { |
1049 | if (!dev || !dev->active) | 1043 | if (!dev->active) |
1050 | return -EINVAL; | 1044 | return -EINVAL; |
1051 | isapnp_cfg_begin(dev->card->number, dev->number); | 1045 | isapnp_cfg_begin(dev->card->number, dev->number); |
1052 | isapnp_deactivate(dev->number); | 1046 | isapnp_deactivate(dev->number); |
@@ -1069,7 +1063,6 @@ static int __init isapnp_init(void) | |||
1069 | struct pnp_dev *dev; | 1063 | struct pnp_dev *dev; |
1070 | 1064 | ||
1071 | if (isapnp_disable) { | 1065 | if (isapnp_disable) { |
1072 | isapnp_detected = 0; | ||
1073 | printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n"); | 1066 | printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n"); |
1074 | return 0; | 1067 | return 0; |
1075 | } | 1068 | } |
@@ -1117,7 +1110,6 @@ static int __init isapnp_init(void) | |||
1117 | } | 1110 | } |
1118 | isapnp_set_rdp(); | 1111 | isapnp_set_rdp(); |
1119 | } | 1112 | } |
1120 | isapnp_detected = 1; | ||
1121 | if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) { | 1113 | if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) { |
1122 | cards = isapnp_isolate(); | 1114 | cards = isapnp_isolate(); |
1123 | if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) { | 1115 | if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) { |
@@ -1125,7 +1117,6 @@ static int __init isapnp_init(void) | |||
1125 | release_region(_PIDXR, 1); | 1117 | release_region(_PIDXR, 1); |
1126 | #endif | 1118 | #endif |
1127 | release_region(_PNPWRP, 1); | 1119 | release_region(_PNPWRP, 1); |
1128 | isapnp_detected = 0; | ||
1129 | printk(KERN_INFO | 1120 | printk(KERN_INFO |
1130 | "isapnp: No Plug & Play device found\n"); | 1121 | "isapnp: No Plug & Play device found\n"); |
1131 | return 0; | 1122 | return 0; |
@@ -1148,13 +1139,12 @@ static int __init isapnp_init(void) | |||
1148 | } | 1139 | } |
1149 | } | 1140 | } |
1150 | } | 1141 | } |
1151 | if (cards) { | 1142 | if (cards) |
1152 | printk(KERN_INFO | 1143 | printk(KERN_INFO |
1153 | "isapnp: %i Plug & Play card%s detected total\n", cards, | 1144 | "isapnp: %i Plug & Play card%s detected total\n", cards, |
1154 | cards > 1 ? "s" : ""); | 1145 | cards > 1 ? "s" : ""); |
1155 | } else { | 1146 | else |
1156 | printk(KERN_INFO "isapnp: No Plug & Play card found\n"); | 1147 | printk(KERN_INFO "isapnp: No Plug & Play card found\n"); |
1157 | } | ||
1158 | 1148 | ||
1159 | isapnp_proc_init(); | 1149 | isapnp_proc_init(); |
1160 | return 0; | 1150 | return 0; |
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index 3fbc0f9ffc26..560ccb640816 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c | |||
@@ -112,33 +112,6 @@ static int isapnp_proc_attach_device(struct pnp_dev *dev) | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | #ifdef MODULE | ||
116 | static int __exit isapnp_proc_detach_device(struct pnp_dev *dev) | ||
117 | { | ||
118 | struct pnp_card *bus = dev->card; | ||
119 | struct proc_dir_entry *de; | ||
120 | char name[16]; | ||
121 | |||
122 | if (!(de = bus->procdir)) | ||
123 | return -EINVAL; | ||
124 | sprintf(name, "%02x", dev->number); | ||
125 | remove_proc_entry(name, de); | ||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static int __exit isapnp_proc_detach_bus(struct pnp_card *bus) | ||
130 | { | ||
131 | struct proc_dir_entry *de; | ||
132 | char name[16]; | ||
133 | |||
134 | if (!(de = bus->procdir)) | ||
135 | return -EINVAL; | ||
136 | sprintf(name, "%02x", bus->number); | ||
137 | remove_proc_entry(name, isapnp_proc_bus_dir); | ||
138 | return 0; | ||
139 | } | ||
140 | #endif /* MODULE */ | ||
141 | |||
142 | int __init isapnp_proc_init(void) | 115 | int __init isapnp_proc_init(void) |
143 | { | 116 | { |
144 | struct pnp_dev *dev; | 117 | struct pnp_dev *dev; |
@@ -149,21 +122,3 @@ int __init isapnp_proc_init(void) | |||
149 | } | 122 | } |
150 | return 0; | 123 | return 0; |
151 | } | 124 | } |
152 | |||
153 | #ifdef MODULE | ||
154 | int __exit isapnp_proc_done(void) | ||
155 | { | ||
156 | struct pnp_dev *dev; | ||
157 | struct pnp_bus *card; | ||
158 | |||
159 | isapnp_for_each_dev(dev) { | ||
160 | isapnp_proc_detach_device(dev); | ||
161 | } | ||
162 | isapnp_for_each_card(card) { | ||
163 | isapnp_proc_detach_bus(card); | ||
164 | } | ||
165 | if (isapnp_proc_bus_dir) | ||
166 | remove_proc_entry("isapnp", proc_bus); | ||
167 | return 0; | ||
168 | } | ||
169 | #endif /* MODULE */ | ||
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 3bda513a6bd3..0826287eef53 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -21,9 +21,6 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) | |||
21 | resource_size_t *start, *end; | 21 | resource_size_t *start, *end; |
22 | unsigned long *flags; | 22 | unsigned long *flags; |
23 | 23 | ||
24 | if (!dev || !rule) | ||
25 | return -EINVAL; | ||
26 | |||
27 | if (idx >= PNP_MAX_PORT) { | 24 | if (idx >= PNP_MAX_PORT) { |
28 | pnp_err | 25 | pnp_err |
29 | ("More than 4 ports is incompatible with pnp specifications."); | 26 | ("More than 4 ports is incompatible with pnp specifications."); |
@@ -66,9 +63,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) | |||
66 | resource_size_t *start, *end; | 63 | resource_size_t *start, *end; |
67 | unsigned long *flags; | 64 | unsigned long *flags; |
68 | 65 | ||
69 | if (!dev || !rule) | ||
70 | return -EINVAL; | ||
71 | |||
72 | if (idx >= PNP_MAX_MEM) { | 66 | if (idx >= PNP_MAX_MEM) { |
73 | pnp_err | 67 | pnp_err |
74 | ("More than 8 mems is incompatible with pnp specifications."); | 68 | ("More than 8 mems is incompatible with pnp specifications."); |
@@ -127,9 +121,6 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) | |||
127 | 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 | 121 | 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 |
128 | }; | 122 | }; |
129 | 123 | ||
130 | if (!dev || !rule) | ||
131 | return -EINVAL; | ||
132 | |||
133 | if (idx >= PNP_MAX_IRQ) { | 124 | if (idx >= PNP_MAX_IRQ) { |
134 | pnp_err | 125 | pnp_err |
135 | ("More than 2 irqs is incompatible with pnp specifications."); | 126 | ("More than 2 irqs is incompatible with pnp specifications."); |
@@ -181,9 +172,6 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | |||
181 | 1, 3, 5, 6, 7, 0, 2, 4 | 172 | 1, 3, 5, 6, 7, 0, 2, 4 |
182 | }; | 173 | }; |
183 | 174 | ||
184 | if (!dev || !rule) | ||
185 | return -EINVAL; | ||
186 | |||
187 | if (idx >= PNP_MAX_DMA) { | 175 | if (idx >= PNP_MAX_DMA) { |
188 | pnp_err | 176 | pnp_err |
189 | ("More than 2 dmas is incompatible with pnp specifications."); | 177 | ("More than 2 dmas is incompatible with pnp specifications."); |
@@ -390,7 +378,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) | |||
390 | up(&pnp_res_mutex); | 378 | up(&pnp_res_mutex); |
391 | return 1; | 379 | return 1; |
392 | 380 | ||
393 | fail: | 381 | fail: |
394 | pnp_clean_resource_table(&dev->res); | 382 | pnp_clean_resource_table(&dev->res); |
395 | up(&pnp_res_mutex); | 383 | up(&pnp_res_mutex); |
396 | return 0; | 384 | return 0; |
@@ -410,8 +398,6 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, | |||
410 | int i; | 398 | int i; |
411 | struct pnp_resource_table *bak; | 399 | struct pnp_resource_table *bak; |
412 | 400 | ||
413 | if (!dev || !res) | ||
414 | return -EINVAL; | ||
415 | if (!pnp_can_configure(dev)) | 401 | if (!pnp_can_configure(dev)) |
416 | return -ENODEV; | 402 | return -ENODEV; |
417 | bak = pnp_alloc(sizeof(struct pnp_resource_table)); | 403 | bak = pnp_alloc(sizeof(struct pnp_resource_table)); |
@@ -444,7 +430,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, | |||
444 | kfree(bak); | 430 | kfree(bak); |
445 | return 0; | 431 | return 0; |
446 | 432 | ||
447 | fail: | 433 | fail: |
448 | dev->res = *bak; | 434 | dev->res = *bak; |
449 | up(&pnp_res_mutex); | 435 | up(&pnp_res_mutex); |
450 | kfree(bak); | 436 | kfree(bak); |
@@ -460,9 +446,6 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
460 | struct pnp_option *dep; | 446 | struct pnp_option *dep; |
461 | int i = 1; | 447 | int i = 1; |
462 | 448 | ||
463 | if (!dev) | ||
464 | return -EINVAL; | ||
465 | |||
466 | if (!pnp_can_configure(dev)) { | 449 | if (!pnp_can_configure(dev)) { |
467 | pnp_dbg("Device %s does not support resource configuration.", | 450 | pnp_dbg("Device %s does not support resource configuration.", |
468 | dev->dev.bus_id); | 451 | dev->dev.bus_id); |
@@ -541,8 +524,6 @@ int pnp_activate_dev(struct pnp_dev *dev) | |||
541 | { | 524 | { |
542 | int error; | 525 | int error; |
543 | 526 | ||
544 | if (!dev) | ||
545 | return -EINVAL; | ||
546 | if (dev->active) | 527 | if (dev->active) |
547 | return 0; /* the device is already active */ | 528 | return 0; /* the device is already active */ |
548 | 529 | ||
@@ -568,8 +549,6 @@ int pnp_disable_dev(struct pnp_dev *dev) | |||
568 | { | 549 | { |
569 | int error; | 550 | int error; |
570 | 551 | ||
571 | if (!dev) | ||
572 | return -EINVAL; | ||
573 | if (!dev->active) | 552 | if (!dev->active) |
574 | return 0; /* the device is already disabled */ | 553 | return 0; /* the device is already disabled */ |
575 | 554 | ||
@@ -596,8 +575,6 @@ int pnp_disable_dev(struct pnp_dev *dev) | |||
596 | void pnp_resource_change(struct resource *resource, resource_size_t start, | 575 | void pnp_resource_change(struct resource *resource, resource_size_t start, |
597 | resource_size_t size) | 576 | resource_size_t size) |
598 | { | 577 | { |
599 | if (resource == NULL) | ||
600 | return; | ||
601 | resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); | 578 | resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); |
602 | resource->start = start; | 579 | resource->start = start; |
603 | resource->end = start + size - 1; | 580 | resource->end = start + size - 1; |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 616fc72190bf..a5a372222d69 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -248,9 +248,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
248 | num++; | 248 | num++; |
249 | 249 | ||
250 | return AE_OK; | 250 | return AE_OK; |
251 | err1: | 251 | err1: |
252 | kfree(dev_id); | 252 | kfree(dev_id); |
253 | err: | 253 | err: |
254 | kfree(dev); | 254 | kfree(dev); |
255 | return -EINVAL; | 255 | return -EINVAL; |
256 | } | 256 | } |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index ce5027feb3da..0e3b8d0ff06b 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -34,19 +34,17 @@ | |||
34 | */ | 34 | */ |
35 | static int irq_flags(int triggering, int polarity) | 35 | static int irq_flags(int triggering, int polarity) |
36 | { | 36 | { |
37 | int flag; | ||
38 | if (triggering == ACPI_LEVEL_SENSITIVE) { | 37 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
39 | if (polarity == ACPI_ACTIVE_LOW) | 38 | if (polarity == ACPI_ACTIVE_LOW) |
40 | flag = IORESOURCE_IRQ_LOWLEVEL; | 39 | return IORESOURCE_IRQ_LOWLEVEL; |
41 | else | 40 | else |
42 | flag = IORESOURCE_IRQ_HIGHLEVEL; | 41 | return IORESOURCE_IRQ_HIGHLEVEL; |
43 | } else { | 42 | } else { |
44 | if (polarity == ACPI_ACTIVE_LOW) | 43 | if (polarity == ACPI_ACTIVE_LOW) |
45 | flag = IORESOURCE_IRQ_LOWEDGE; | 44 | return IORESOURCE_IRQ_LOWEDGE; |
46 | else | 45 | else |
47 | flag = IORESOURCE_IRQ_HIGHEDGE; | 46 | return IORESOURCE_IRQ_HIGHEDGE; |
48 | } | 47 | } |
49 | return flag; | ||
50 | } | 48 | } |
51 | 49 | ||
52 | static void decode_irq_flags(int flag, int *triggering, int *polarity) | 50 | static void decode_irq_flags(int flag, int *triggering, int *polarity) |
@@ -242,8 +240,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res | |||
242 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 240 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
243 | void *data) | 241 | void *data) |
244 | { | 242 | { |
245 | struct pnp_resource_table *res_table = | 243 | struct pnp_resource_table *res_table = data; |
246 | (struct pnp_resource_table *)data; | ||
247 | int i; | 244 | int i; |
248 | 245 | ||
249 | switch (res->type) { | 246 | switch (res->type) { |
@@ -566,8 +563,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
566 | void *data) | 563 | void *data) |
567 | { | 564 | { |
568 | int priority = 0; | 565 | int priority = 0; |
569 | struct acpipnp_parse_option_s *parse_data = | 566 | struct acpipnp_parse_option_s *parse_data = data; |
570 | (struct acpipnp_parse_option_s *)data; | ||
571 | struct pnp_dev *dev = parse_data->dev; | 567 | struct pnp_dev *dev = parse_data->dev; |
572 | struct pnp_option *option = parse_data->option; | 568 | struct pnp_option *option = parse_data->option; |
573 | 569 | ||
@@ -705,7 +701,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res) | |||
705 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | 701 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, |
706 | void *data) | 702 | void *data) |
707 | { | 703 | { |
708 | int *res_cnt = (int *)data; | 704 | int *res_cnt = data; |
709 | 705 | ||
710 | if (pnpacpi_supported_resource(res)) | 706 | if (pnpacpi_supported_resource(res)) |
711 | (*res_cnt)++; | 707 | (*res_cnt)++; |
@@ -714,7 +710,7 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
714 | 710 | ||
715 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) | 711 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) |
716 | { | 712 | { |
717 | struct acpi_resource **resource = (struct acpi_resource **)data; | 713 | struct acpi_resource **resource = data; |
718 | 714 | ||
719 | if (pnpacpi_supported_resource(res)) { | 715 | if (pnpacpi_supported_resource(res)) { |
720 | (*resource)->type = res->type; | 716 | (*resource)->type = res->type; |
@@ -886,8 +882,7 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
886 | int i = 0; | 882 | int i = 0; |
887 | /* pnpacpi_build_resource_template allocates extra mem */ | 883 | /* pnpacpi_build_resource_template allocates extra mem */ |
888 | int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; | 884 | int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; |
889 | struct acpi_resource *resource = | 885 | struct acpi_resource *resource = buffer->pointer; |
890 | (struct acpi_resource *)buffer->pointer; | ||
891 | int port = 0, irq = 0, dma = 0, mem = 0; | 886 | int port = 0, irq = 0, dma = 0, mem = 0; |
892 | 887 | ||
893 | pnp_dbg("res cnt %d", res_cnt); | 888 | pnp_dbg("res cnt %d", res_cnt); |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 3692a099b45f..0691f473e9d4 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -419,7 +419,6 @@ static void __init build_devlist(void) | |||
419 | static int pnpbios_disabled; | 419 | static int pnpbios_disabled; |
420 | int pnpbios_dont_use_current_config; | 420 | int pnpbios_dont_use_current_config; |
421 | 421 | ||
422 | #ifndef MODULE | ||
423 | static int __init pnpbios_setup(char *str) | 422 | static int __init pnpbios_setup(char *str) |
424 | { | 423 | { |
425 | int invert; | 424 | int invert; |
@@ -443,7 +442,6 @@ static int __init pnpbios_setup(char *str) | |||
443 | } | 442 | } |
444 | 443 | ||
445 | __setup("pnpbios=", pnpbios_setup); | 444 | __setup("pnpbios=", pnpbios_setup); |
446 | #endif | ||
447 | 445 | ||
448 | /* PnP BIOS signature: "$PnP" */ | 446 | /* PnP BIOS signature: "$PnP" */ |
449 | #define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24)) | 447 | #define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24)) |
@@ -591,6 +589,7 @@ subsys_initcall(pnpbios_init); | |||
591 | static int __init pnpbios_thread_init(void) | 589 | static int __init pnpbios_thread_init(void) |
592 | { | 590 | { |
593 | struct task_struct *task; | 591 | struct task_struct *task; |
592 | |||
594 | #if defined(CONFIG_PPC_MERGE) | 593 | #if defined(CONFIG_PPC_MERGE) |
595 | if (check_legacy_ioport(PNPBIOS_BASE)) | 594 | if (check_legacy_ioport(PNPBIOS_BASE)) |
596 | return 0; | 595 | return 0; |
@@ -606,48 +605,7 @@ static int __init pnpbios_thread_init(void) | |||
606 | return 0; | 605 | return 0; |
607 | } | 606 | } |
608 | 607 | ||
609 | #ifndef MODULE | ||
610 | |||
611 | /* init/main.c calls pnpbios_init early */ | ||
612 | |||
613 | /* Start the kernel thread later: */ | 608 | /* Start the kernel thread later: */ |
614 | module_init(pnpbios_thread_init); | 609 | module_init(pnpbios_thread_init); |
615 | 610 | ||
616 | #else | ||
617 | |||
618 | /* | ||
619 | * N.B.: Building pnpbios as a module hasn't been fully implemented | ||
620 | */ | ||
621 | |||
622 | MODULE_LICENSE("GPL"); | ||
623 | |||
624 | static int __init pnpbios_init_all(void) | ||
625 | { | ||
626 | int r; | ||
627 | |||
628 | r = pnpbios_init(); | ||
629 | if (r) | ||
630 | return r; | ||
631 | r = pnpbios_thread_init(); | ||
632 | if (r) | ||
633 | return r; | ||
634 | return 0; | ||
635 | } | ||
636 | |||
637 | static void __exit pnpbios_exit(void) | ||
638 | { | ||
639 | #ifdef CONFIG_HOTPLUG | ||
640 | unloading = 1; | ||
641 | wait_for_completion(&unload_sem); | ||
642 | #endif | ||
643 | pnpbios_proc_exit(); | ||
644 | /* We ought to free resources here */ | ||
645 | return; | ||
646 | } | ||
647 | |||
648 | module_init(pnpbios_init_all); | ||
649 | module_exit(pnpbios_exit); | ||
650 | |||
651 | #endif | ||
652 | |||
653 | EXPORT_SYMBOL(pnpbios_protocol); | 611 | EXPORT_SYMBOL(pnpbios_protocol); |
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 9c8c07701b65..9d9841f24a85 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c | |||
@@ -212,7 +212,7 @@ static int proc_write_node(struct file *file, const char __user * buf, | |||
212 | goto out; | 212 | goto out; |
213 | } | 213 | } |
214 | ret = count; | 214 | ret = count; |
215 | out: | 215 | out: |
216 | kfree(node); | 216 | kfree(node); |
217 | return ret; | 217 | return ret; |
218 | } | 218 | } |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 04ecd7b67230..3fabf11b0027 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -238,7 +238,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
238 | break; | 238 | break; |
239 | 239 | ||
240 | default: /* an unkown tag */ | 240 | default: /* an unkown tag */ |
241 | len_err: | 241 | len_err: |
242 | printk(KERN_ERR | 242 | printk(KERN_ERR |
243 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", | 243 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", |
244 | tag, len); | 244 | tag, len); |
@@ -298,6 +298,7 @@ static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, | |||
298 | struct pnp_option *option) | 298 | struct pnp_option *option) |
299 | { | 299 | { |
300 | struct pnp_mem *mem; | 300 | struct pnp_mem *mem; |
301 | |||
301 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); | 302 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
302 | if (!mem) | 303 | if (!mem) |
303 | return; | 304 | return; |
@@ -468,7 +469,7 @@ static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p, | |||
468 | return p + 2; | 469 | return p + 2; |
469 | 470 | ||
470 | default: /* an unkown tag */ | 471 | default: /* an unkown tag */ |
471 | len_err: | 472 | len_err: |
472 | printk(KERN_ERR | 473 | printk(KERN_ERR |
473 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", | 474 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", |
474 | tag, len); | 475 | tag, len); |
@@ -562,7 +563,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p, | |||
562 | break; | 563 | break; |
563 | 564 | ||
564 | default: /* an unkown tag */ | 565 | default: /* an unkown tag */ |
565 | len_err: | 566 | len_err: |
566 | printk(KERN_ERR | 567 | printk(KERN_ERR |
567 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", | 568 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", |
568 | tag, len); | 569 | tag, len); |
@@ -756,7 +757,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p, | |||
756 | break; | 757 | break; |
757 | 758 | ||
758 | default: /* an unkown tag */ | 759 | default: /* an unkown tag */ |
759 | len_err: | 760 | len_err: |
760 | printk(KERN_ERR | 761 | printk(KERN_ERR |
761 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", | 762 | "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", |
762 | tag, len); | 763 | tag, len); |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index ea6ec14a0559..ef1286900db3 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -47,9 +47,6 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) | |||
47 | { | 47 | { |
48 | struct pnp_option *option; | 48 | struct pnp_option *option; |
49 | 49 | ||
50 | if (!dev) | ||
51 | return NULL; | ||
52 | |||
53 | option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); | 50 | option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); |
54 | 51 | ||
55 | /* this should never happen but if it does we'll try to continue */ | 52 | /* this should never happen but if it does we'll try to continue */ |
@@ -64,9 +61,6 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, | |||
64 | { | 61 | { |
65 | struct pnp_option *option; | 62 | struct pnp_option *option; |
66 | 63 | ||
67 | if (!dev) | ||
68 | return NULL; | ||
69 | |||
70 | option = pnp_build_option(priority); | 64 | option = pnp_build_option(priority); |
71 | 65 | ||
72 | if (dev->dependent) { | 66 | if (dev->dependent) { |
@@ -83,11 +77,6 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) | |||
83 | { | 77 | { |
84 | struct pnp_irq *ptr; | 78 | struct pnp_irq *ptr; |
85 | 79 | ||
86 | if (!option) | ||
87 | return -EINVAL; | ||
88 | if (!data) | ||
89 | return -EINVAL; | ||
90 | |||
91 | ptr = option->irq; | 80 | ptr = option->irq; |
92 | while (ptr && ptr->next) | 81 | while (ptr && ptr->next) |
93 | ptr = ptr->next; | 82 | ptr = ptr->next; |
@@ -112,11 +101,6 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) | |||
112 | { | 101 | { |
113 | struct pnp_dma *ptr; | 102 | struct pnp_dma *ptr; |
114 | 103 | ||
115 | if (!option) | ||
116 | return -EINVAL; | ||
117 | if (!data) | ||
118 | return -EINVAL; | ||
119 | |||
120 | ptr = option->dma; | 104 | ptr = option->dma; |
121 | while (ptr && ptr->next) | 105 | while (ptr && ptr->next) |
122 | ptr = ptr->next; | 106 | ptr = ptr->next; |
@@ -132,11 +116,6 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) | |||
132 | { | 116 | { |
133 | struct pnp_port *ptr; | 117 | struct pnp_port *ptr; |
134 | 118 | ||
135 | if (!option) | ||
136 | return -EINVAL; | ||
137 | if (!data) | ||
138 | return -EINVAL; | ||
139 | |||
140 | ptr = option->port; | 119 | ptr = option->port; |
141 | while (ptr && ptr->next) | 120 | while (ptr && ptr->next) |
142 | ptr = ptr->next; | 121 | ptr = ptr->next; |
@@ -152,11 +131,6 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data) | |||
152 | { | 131 | { |
153 | struct pnp_mem *ptr; | 132 | struct pnp_mem *ptr; |
154 | 133 | ||
155 | if (!option) | ||
156 | return -EINVAL; | ||
157 | if (!data) | ||
158 | return -EINVAL; | ||
159 | |||
160 | ptr = option->mem; | 134 | ptr = option->mem; |
161 | while (ptr && ptr->next) | 135 | while (ptr && ptr->next) |
162 | ptr = ptr->next; | 136 | ptr = ptr->next; |