diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2008-04-28 18:34:06 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2008-04-29 03:22:21 -0400 |
commit | 4ab55d8d4f7b910c4c60e0f8ff70d0dfdd484f02 (patch) | |
tree | 7ae1fd11249b844b7ae53faff5ee2906a6a796c2 /drivers | |
parent | 59284cb4099411bc6f4915a5a4cb76414440c447 (diff) |
PNP: remove more pnp_resource_table arguments
Stop passing around struct pnp_resource_table pointers. In most cases,
the caller doesn't need to know how the resources are stored inside
the struct pnp_dev.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-By: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pnp/isapnp/core.c | 6 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 11 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/pnpacpi.h | 6 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 55 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 4 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/pnpbios.h | 4 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 58 |
7 files changed, 73 insertions, 71 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 1ae3d8996156..b8e639f4f227 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -932,9 +932,9 @@ EXPORT_SYMBOL(isapnp_cfg_begin); | |||
932 | EXPORT_SYMBOL(isapnp_cfg_end); | 932 | EXPORT_SYMBOL(isapnp_cfg_end); |
933 | EXPORT_SYMBOL(isapnp_write_byte); | 933 | EXPORT_SYMBOL(isapnp_write_byte); |
934 | 934 | ||
935 | static int isapnp_read_resources(struct pnp_dev *dev, | 935 | static int isapnp_read_resources(struct pnp_dev *dev) |
936 | struct pnp_resource_table *res) | ||
937 | { | 936 | { |
937 | struct pnp_resource_table *res = &dev->res; | ||
938 | int tmp, ret; | 938 | int tmp, ret; |
939 | 939 | ||
940 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); | 940 | dev->active = isapnp_read_byte(ISAPNP_CFG_ACTIVATE); |
@@ -982,7 +982,7 @@ static int isapnp_get_resources(struct pnp_dev *dev) | |||
982 | 982 | ||
983 | pnp_init_resource_table(&dev->res); | 983 | pnp_init_resource_table(&dev->res); |
984 | isapnp_cfg_begin(dev->card->number, dev->number); | 984 | isapnp_cfg_begin(dev->card->number, dev->number); |
985 | ret = isapnp_read_resources(dev, &dev->res); | 985 | ret = isapnp_read_resources(dev); |
986 | isapnp_cfg_end(); | 986 | isapnp_cfg_end(); |
987 | return ret; | 987 | return ret; |
988 | } | 988 | } |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 590fbcb0ee89..3fd2416d6795 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -77,8 +77,7 @@ static int pnpacpi_get_resources(struct pnp_dev *dev) | |||
77 | { | 77 | { |
78 | acpi_status status; | 78 | acpi_status status; |
79 | 79 | ||
80 | status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data, | 80 | status = pnpacpi_parse_allocated_resource(dev); |
81 | &dev->res); | ||
82 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 81 | return ACPI_FAILURE(status) ? -ENODEV : 0; |
83 | } | 82 | } |
84 | 83 | ||
@@ -92,7 +91,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
92 | ret = pnpacpi_build_resource_template(dev, &buffer); | 91 | ret = pnpacpi_build_resource_template(dev, &buffer); |
93 | if (ret) | 92 | if (ret) |
94 | return ret; | 93 | return ret; |
95 | ret = pnpacpi_encode_resources(&dev->res, &buffer); | 94 | ret = pnpacpi_encode_resources(dev, &buffer); |
96 | if (ret) { | 95 | if (ret) { |
97 | kfree(buffer.pointer); | 96 | kfree(buffer.pointer); |
98 | return ret; | 97 | return ret; |
@@ -183,8 +182,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
183 | 182 | ||
184 | if (dev->active) { | 183 | if (dev->active) { |
185 | /* parse allocated resource */ | 184 | /* parse allocated resource */ |
186 | status = pnpacpi_parse_allocated_resource(device->handle, | 185 | status = pnpacpi_parse_allocated_resource(dev); |
187 | &dev->res); | ||
188 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 186 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { |
189 | pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s", | 187 | pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s", |
190 | acpi_device_hid(device)); | 188 | acpi_device_hid(device)); |
@@ -192,8 +190,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
192 | } | 190 | } |
193 | 191 | ||
194 | if (dev->capabilities & PNP_CONFIGURABLE) { | 192 | if (dev->capabilities & PNP_CONFIGURABLE) { |
195 | status = pnpacpi_parse_resource_option_data(device->handle, | 193 | status = pnpacpi_parse_resource_option_data(dev); |
196 | dev); | ||
197 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 194 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { |
198 | pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s", | 195 | pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s", |
199 | acpi_device_hid(device)); | 196 | acpi_device_hid(device)); |
diff --git a/drivers/pnp/pnpacpi/pnpacpi.h b/drivers/pnp/pnpacpi/pnpacpi.h index 116c591d8634..db0c4f25c2a3 100644 --- a/drivers/pnp/pnpacpi/pnpacpi.h +++ b/drivers/pnp/pnpacpi/pnpacpi.h | |||
@@ -5,8 +5,8 @@ | |||
5 | #include <linux/acpi.h> | 5 | #include <linux/acpi.h> |
6 | #include <linux/pnp.h> | 6 | #include <linux/pnp.h> |
7 | 7 | ||
8 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle, struct pnp_resource_table*); | 8 | acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *); |
9 | acpi_status pnpacpi_parse_resource_option_data(acpi_handle, struct pnp_dev*); | 9 | acpi_status pnpacpi_parse_resource_option_data(struct pnp_dev *); |
10 | int pnpacpi_encode_resources(struct pnp_resource_table *, struct acpi_buffer *); | 10 | int pnpacpi_encode_resources(struct pnp_dev *, struct acpi_buffer *); |
11 | int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *); | 11 | int pnpacpi_build_resource_template(struct pnp_dev *, struct acpi_buffer *); |
12 | #endif | 12 | #endif |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 32454aa07ebc..8a0617687723 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -76,10 +76,11 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | 79 | static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, |
80 | u32 gsi, int triggering, | 80 | u32 gsi, int triggering, |
81 | int polarity, int shareable) | 81 | int polarity, int shareable) |
82 | { | 82 | { |
83 | struct pnp_resource_table *res = &dev->res; | ||
83 | int i = 0; | 84 | int i = 0; |
84 | int irq; | 85 | int irq; |
85 | int p, t; | 86 | int p, t; |
@@ -172,9 +173,10 @@ static int dma_flags(int type, int bus_master, int transfer) | |||
172 | return flags; | 173 | return flags; |
173 | } | 174 | } |
174 | 175 | ||
175 | static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, | 176 | static void pnpacpi_parse_allocated_dmaresource(struct pnp_dev *dev, |
176 | u32 dma, int flags) | 177 | u32 dma, int flags) |
177 | { | 178 | { |
179 | struct pnp_resource_table *res = &dev->res; | ||
178 | int i = 0; | 180 | int i = 0; |
179 | static unsigned char warned; | 181 | static unsigned char warned; |
180 | 182 | ||
@@ -197,9 +199,10 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, | |||
197 | } | 199 | } |
198 | } | 200 | } |
199 | 201 | ||
200 | static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | 202 | static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, |
201 | u64 io, u64 len, int io_decode) | 203 | u64 io, u64 len, int io_decode) |
202 | { | 204 | { |
205 | struct pnp_resource_table *res = &dev->res; | ||
203 | int i = 0; | 206 | int i = 0; |
204 | static unsigned char warned; | 207 | static unsigned char warned; |
205 | 208 | ||
@@ -223,10 +226,11 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
223 | } | 226 | } |
224 | } | 227 | } |
225 | 228 | ||
226 | static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | 229 | static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, |
227 | u64 mem, u64 len, | 230 | u64 mem, u64 len, |
228 | int write_protect) | 231 | int write_protect) |
229 | { | 232 | { |
233 | struct pnp_resource_table *res = &dev->res; | ||
230 | int i = 0; | 234 | int i = 0; |
231 | static unsigned char warned; | 235 | static unsigned char warned; |
232 | 236 | ||
@@ -251,7 +255,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | |||
251 | } | 255 | } |
252 | } | 256 | } |
253 | 257 | ||
254 | static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | 258 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
255 | struct acpi_resource *res) | 259 | struct acpi_resource *res) |
256 | { | 260 | { |
257 | struct acpi_resource_address64 addr, *p = &addr; | 261 | struct acpi_resource_address64 addr, *p = &addr; |
@@ -268,11 +272,11 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res | |||
268 | return; | 272 | return; |
269 | 273 | ||
270 | if (p->resource_type == ACPI_MEMORY_RANGE) | 274 | if (p->resource_type == ACPI_MEMORY_RANGE) |
271 | pnpacpi_parse_allocated_memresource(res_table, | 275 | pnpacpi_parse_allocated_memresource(dev, |
272 | p->minimum, p->address_length, | 276 | p->minimum, p->address_length, |
273 | p->info.mem.write_protect); | 277 | p->info.mem.write_protect); |
274 | else if (p->resource_type == ACPI_IO_RANGE) | 278 | else if (p->resource_type == ACPI_IO_RANGE) |
275 | pnpacpi_parse_allocated_ioresource(res_table, | 279 | pnpacpi_parse_allocated_ioresource(dev, |
276 | p->minimum, p->address_length, | 280 | p->minimum, p->address_length, |
277 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 281 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
278 | ACPI_DECODE_16); | 282 | ACPI_DECODE_16); |
@@ -281,7 +285,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res | |||
281 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 285 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
282 | void *data) | 286 | void *data) |
283 | { | 287 | { |
284 | struct pnp_resource_table *res_table = data; | 288 | struct pnp_dev *dev = data; |
285 | struct acpi_resource_irq *irq; | 289 | struct acpi_resource_irq *irq; |
286 | struct acpi_resource_dma *dma; | 290 | struct acpi_resource_dma *dma; |
287 | struct acpi_resource_io *io; | 291 | struct acpi_resource_io *io; |
@@ -300,7 +304,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
300 | */ | 304 | */ |
301 | irq = &res->data.irq; | 305 | irq = &res->data.irq; |
302 | for (i = 0; i < irq->interrupt_count; i++) { | 306 | for (i = 0; i < irq->interrupt_count; i++) { |
303 | pnpacpi_parse_allocated_irqresource(res_table, | 307 | pnpacpi_parse_allocated_irqresource(dev, |
304 | irq->interrupts[i], | 308 | irq->interrupts[i], |
305 | irq->triggering, | 309 | irq->triggering, |
306 | irq->polarity, | 310 | irq->polarity, |
@@ -311,7 +315,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
311 | case ACPI_RESOURCE_TYPE_DMA: | 315 | case ACPI_RESOURCE_TYPE_DMA: |
312 | dma = &res->data.dma; | 316 | dma = &res->data.dma; |
313 | if (dma->channel_count > 0) | 317 | if (dma->channel_count > 0) |
314 | pnpacpi_parse_allocated_dmaresource(res_table, | 318 | pnpacpi_parse_allocated_dmaresource(dev, |
315 | dma->channels[0], | 319 | dma->channels[0], |
316 | dma_flags(dma->type, dma->bus_master, | 320 | dma_flags(dma->type, dma->bus_master, |
317 | dma->transfer)); | 321 | dma->transfer)); |
@@ -319,7 +323,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
319 | 323 | ||
320 | case ACPI_RESOURCE_TYPE_IO: | 324 | case ACPI_RESOURCE_TYPE_IO: |
321 | io = &res->data.io; | 325 | io = &res->data.io; |
322 | pnpacpi_parse_allocated_ioresource(res_table, | 326 | pnpacpi_parse_allocated_ioresource(dev, |
323 | io->minimum, | 327 | io->minimum, |
324 | io->address_length, | 328 | io->address_length, |
325 | io->io_decode); | 329 | io->io_decode); |
@@ -331,7 +335,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
331 | 335 | ||
332 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 336 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
333 | fixed_io = &res->data.fixed_io; | 337 | fixed_io = &res->data.fixed_io; |
334 | pnpacpi_parse_allocated_ioresource(res_table, | 338 | pnpacpi_parse_allocated_ioresource(dev, |
335 | fixed_io->address, | 339 | fixed_io->address, |
336 | fixed_io->address_length, | 340 | fixed_io->address_length, |
337 | ACPI_DECODE_10); | 341 | ACPI_DECODE_10); |
@@ -345,21 +349,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
345 | 349 | ||
346 | case ACPI_RESOURCE_TYPE_MEMORY24: | 350 | case ACPI_RESOURCE_TYPE_MEMORY24: |
347 | memory24 = &res->data.memory24; | 351 | memory24 = &res->data.memory24; |
348 | pnpacpi_parse_allocated_memresource(res_table, | 352 | pnpacpi_parse_allocated_memresource(dev, |
349 | memory24->minimum, | 353 | memory24->minimum, |
350 | memory24->address_length, | 354 | memory24->address_length, |
351 | memory24->write_protect); | 355 | memory24->write_protect); |
352 | break; | 356 | break; |
353 | case ACPI_RESOURCE_TYPE_MEMORY32: | 357 | case ACPI_RESOURCE_TYPE_MEMORY32: |
354 | memory32 = &res->data.memory32; | 358 | memory32 = &res->data.memory32; |
355 | pnpacpi_parse_allocated_memresource(res_table, | 359 | pnpacpi_parse_allocated_memresource(dev, |
356 | memory32->minimum, | 360 | memory32->minimum, |
357 | memory32->address_length, | 361 | memory32->address_length, |
358 | memory32->write_protect); | 362 | memory32->write_protect); |
359 | break; | 363 | break; |
360 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 364 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
361 | fixed_memory32 = &res->data.fixed_memory32; | 365 | fixed_memory32 = &res->data.fixed_memory32; |
362 | pnpacpi_parse_allocated_memresource(res_table, | 366 | pnpacpi_parse_allocated_memresource(dev, |
363 | fixed_memory32->address, | 367 | fixed_memory32->address, |
364 | fixed_memory32->address_length, | 368 | fixed_memory32->address_length, |
365 | fixed_memory32->write_protect); | 369 | fixed_memory32->write_protect); |
@@ -367,7 +371,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
367 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 371 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
368 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 372 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
369 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 373 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
370 | pnpacpi_parse_allocated_address_space(res_table, res); | 374 | pnpacpi_parse_allocated_address_space(dev, res); |
371 | break; | 375 | break; |
372 | 376 | ||
373 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 377 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
@@ -381,7 +385,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
381 | return AE_OK; | 385 | return AE_OK; |
382 | 386 | ||
383 | for (i = 0; i < extended_irq->interrupt_count; i++) { | 387 | for (i = 0; i < extended_irq->interrupt_count; i++) { |
384 | pnpacpi_parse_allocated_irqresource(res_table, | 388 | pnpacpi_parse_allocated_irqresource(dev, |
385 | extended_irq->interrupts[i], | 389 | extended_irq->interrupts[i], |
386 | extended_irq->triggering, | 390 | extended_irq->triggering, |
387 | extended_irq->polarity, | 391 | extended_irq->polarity, |
@@ -400,14 +404,15 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
400 | return AE_OK; | 404 | return AE_OK; |
401 | } | 405 | } |
402 | 406 | ||
403 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, | 407 | acpi_status pnpacpi_parse_allocated_resource(struct pnp_dev *dev) |
404 | struct pnp_resource_table * res) | ||
405 | { | 408 | { |
409 | acpi_handle handle = dev->data; | ||
410 | |||
406 | /* Blank the resource table values */ | 411 | /* Blank the resource table values */ |
407 | pnp_init_resource_table(res); | 412 | pnp_init_resource_table(&dev->res); |
408 | 413 | ||
409 | return acpi_walk_resources(handle, METHOD_NAME__CRS, | 414 | return acpi_walk_resources(handle, METHOD_NAME__CRS, |
410 | pnpacpi_allocated_resource, res); | 415 | pnpacpi_allocated_resource, dev); |
411 | } | 416 | } |
412 | 417 | ||
413 | static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev, | 418 | static __init void pnpacpi_parse_dma_option(struct pnp_dev *dev, |
@@ -727,9 +732,9 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
727 | return AE_OK; | 732 | return AE_OK; |
728 | } | 733 | } |
729 | 734 | ||
730 | acpi_status __init pnpacpi_parse_resource_option_data(acpi_handle handle, | 735 | acpi_status __init pnpacpi_parse_resource_option_data(struct pnp_dev *dev) |
731 | struct pnp_dev *dev) | ||
732 | { | 736 | { |
737 | acpi_handle handle = dev->data; | ||
733 | acpi_status status; | 738 | acpi_status status; |
734 | struct acpipnp_parse_option_s parse_data; | 739 | struct acpipnp_parse_option_s parse_data; |
735 | 740 | ||
@@ -959,9 +964,9 @@ static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | |||
959 | fixed_memory32->address_length = p->end - p->start + 1; | 964 | fixed_memory32->address_length = p->end - p->start + 1; |
960 | } | 965 | } |
961 | 966 | ||
962 | int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | 967 | int pnpacpi_encode_resources(struct pnp_dev *dev, struct acpi_buffer *buffer) |
963 | struct acpi_buffer *buffer) | ||
964 | { | 968 | { |
969 | struct pnp_resource_table *res_table = &dev->res; | ||
965 | int i = 0; | 970 | int i = 0; |
966 | /* pnpacpi_build_resource_template allocates extra mem */ | 971 | /* pnpacpi_build_resource_template allocates extra mem */ |
967 | int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; | 972 | int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 9852755b5590..1711e7f29613 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -219,7 +219,7 @@ static int pnpbios_get_resources(struct pnp_dev *dev) | |||
219 | kfree(node); | 219 | kfree(node); |
220 | return -ENODEV; | 220 | return -ENODEV; |
221 | } | 221 | } |
222 | pnpbios_read_resources_from_node(&dev->res, node); | 222 | pnpbios_read_resources_from_node(dev, node); |
223 | dev->active = pnp_is_active(dev); | 223 | dev->active = pnp_is_active(dev); |
224 | kfree(node); | 224 | kfree(node); |
225 | return 0; | 225 | return 0; |
@@ -241,7 +241,7 @@ static int pnpbios_set_resources(struct pnp_dev *dev) | |||
241 | kfree(node); | 241 | kfree(node); |
242 | return -ENODEV; | 242 | return -ENODEV; |
243 | } | 243 | } |
244 | if (pnpbios_write_resources_to_node(&dev->res, node) < 0) { | 244 | if (pnpbios_write_resources_to_node(dev, node) < 0) { |
245 | kfree(node); | 245 | kfree(node); |
246 | return -1; | 246 | return -1; |
247 | } | 247 | } |
diff --git a/drivers/pnp/pnpbios/pnpbios.h b/drivers/pnp/pnpbios/pnpbios.h index d8cb2fd1f127..42343fc753ba 100644 --- a/drivers/pnp/pnpbios/pnpbios.h +++ b/drivers/pnp/pnpbios/pnpbios.h | |||
@@ -28,8 +28,8 @@ extern int pnp_bios_present(void); | |||
28 | extern int pnpbios_dont_use_current_config; | 28 | extern int pnpbios_dont_use_current_config; |
29 | 29 | ||
30 | extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node); | 30 | extern int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node); |
31 | extern int pnpbios_read_resources_from_node(struct pnp_resource_table *res, struct pnp_bios_node * node); | 31 | extern int pnpbios_read_resources_from_node(struct pnp_dev *dev, struct pnp_bios_node *node); |
32 | extern int pnpbios_write_resources_to_node(struct pnp_resource_table *res, struct pnp_bios_node * node); | 32 | extern int pnpbios_write_resources_to_node(struct pnp_dev *dev, struct pnp_bios_node *node); |
33 | extern void pnpid32_to_pnpid(u32 id, char *str); | 33 | extern void pnpid32_to_pnpid(u32 id, char *str); |
34 | 34 | ||
35 | extern void pnpbios_print_status(const char * module, u16 status); | 35 | extern void pnpbios_print_status(const char * module, u16 status); |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index 70aa559b3f8c..1b8f30ff192a 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -54,9 +54,9 @@ inline void pcibios_penalize_isa_irq(int irq, int active) | |||
54 | * Allocated Resources | 54 | * Allocated Resources |
55 | */ | 55 | */ |
56 | 56 | ||
57 | static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, | 57 | static void pnpbios_parse_allocated_irqresource(struct pnp_dev *dev, int irq) |
58 | int irq) | ||
59 | { | 58 | { |
59 | struct pnp_resource_table *res = &dev->res; | ||
60 | int i = 0; | 60 | int i = 0; |
61 | 61 | ||
62 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) | 62 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) |
@@ -74,9 +74,9 @@ static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, | 77 | static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma) |
78 | int dma) | ||
79 | { | 78 | { |
79 | struct pnp_resource_table *res = &dev->res; | ||
80 | int i = 0; | 80 | int i = 0; |
81 | 81 | ||
82 | while (i < PNP_MAX_DMA && | 82 | while (i < PNP_MAX_DMA && |
@@ -93,9 +93,10 @@ static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res, | |||
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, | 96 | static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev, |
97 | int io, int len) | 97 | int io, int len) |
98 | { | 98 | { |
99 | struct pnp_resource_table *res = &dev->res; | ||
99 | int i = 0; | 100 | int i = 0; |
100 | 101 | ||
101 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) | 102 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) |
@@ -112,9 +113,10 @@ static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, | 116 | static void pnpbios_parse_allocated_memresource(struct pnp_dev *dev, |
116 | int mem, int len) | 117 | int mem, int len) |
117 | { | 118 | { |
119 | struct pnp_resource_table *res = &dev->res; | ||
118 | int i = 0; | 120 | int i = 0; |
119 | 121 | ||
120 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) | 122 | while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) |
@@ -131,11 +133,9 @@ static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res, | |||
131 | } | 133 | } |
132 | } | 134 | } |
133 | 135 | ||
134 | static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | 136 | static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev, |
135 | unsigned char *end, | 137 | unsigned char *p, |
136 | struct | 138 | unsigned char *end) |
137 | pnp_resource_table | ||
138 | *res) | ||
139 | { | 139 | { |
140 | unsigned int len, tag; | 140 | unsigned int len, tag; |
141 | int io, size, mask, i; | 141 | int io, size, mask, i; |
@@ -144,7 +144,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
144 | return NULL; | 144 | return NULL; |
145 | 145 | ||
146 | /* Blank the resource table values */ | 146 | /* Blank the resource table values */ |
147 | pnp_init_resource_table(res); | 147 | pnp_init_resource_table(&dev->res); |
148 | 148 | ||
149 | while ((char *)p < (char *)end) { | 149 | while ((char *)p < (char *)end) { |
150 | 150 | ||
@@ -164,7 +164,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
164 | goto len_err; | 164 | goto len_err; |
165 | io = *(short *)&p[4]; | 165 | io = *(short *)&p[4]; |
166 | size = *(short *)&p[10]; | 166 | size = *(short *)&p[10]; |
167 | pnpbios_parse_allocated_memresource(res, io, size); | 167 | pnpbios_parse_allocated_memresource(dev, io, size); |
168 | break; | 168 | break; |
169 | 169 | ||
170 | case LARGE_TAG_ANSISTR: | 170 | case LARGE_TAG_ANSISTR: |
@@ -180,7 +180,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
180 | goto len_err; | 180 | goto len_err; |
181 | io = *(int *)&p[4]; | 181 | io = *(int *)&p[4]; |
182 | size = *(int *)&p[16]; | 182 | size = *(int *)&p[16]; |
183 | pnpbios_parse_allocated_memresource(res, io, size); | 183 | pnpbios_parse_allocated_memresource(dev, io, size); |
184 | break; | 184 | break; |
185 | 185 | ||
186 | case LARGE_TAG_FIXEDMEM32: | 186 | case LARGE_TAG_FIXEDMEM32: |
@@ -188,7 +188,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
188 | goto len_err; | 188 | goto len_err; |
189 | io = *(int *)&p[4]; | 189 | io = *(int *)&p[4]; |
190 | size = *(int *)&p[8]; | 190 | size = *(int *)&p[8]; |
191 | pnpbios_parse_allocated_memresource(res, io, size); | 191 | pnpbios_parse_allocated_memresource(dev, io, size); |
192 | break; | 192 | break; |
193 | 193 | ||
194 | case SMALL_TAG_IRQ: | 194 | case SMALL_TAG_IRQ: |
@@ -199,7 +199,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
199 | for (i = 0; i < 16; i++, mask = mask >> 1) | 199 | for (i = 0; i < 16; i++, mask = mask >> 1) |
200 | if (mask & 0x01) | 200 | if (mask & 0x01) |
201 | io = i; | 201 | io = i; |
202 | pnpbios_parse_allocated_irqresource(res, io); | 202 | pnpbios_parse_allocated_irqresource(dev, io); |
203 | break; | 203 | break; |
204 | 204 | ||
205 | case SMALL_TAG_DMA: | 205 | case SMALL_TAG_DMA: |
@@ -210,7 +210,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
210 | for (i = 0; i < 8; i++, mask = mask >> 1) | 210 | for (i = 0; i < 8; i++, mask = mask >> 1) |
211 | if (mask & 0x01) | 211 | if (mask & 0x01) |
212 | io = i; | 212 | io = i; |
213 | pnpbios_parse_allocated_dmaresource(res, io); | 213 | pnpbios_parse_allocated_dmaresource(dev, io); |
214 | break; | 214 | break; |
215 | 215 | ||
216 | case SMALL_TAG_PORT: | 216 | case SMALL_TAG_PORT: |
@@ -218,7 +218,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
218 | goto len_err; | 218 | goto len_err; |
219 | io = p[2] + p[3] * 256; | 219 | io = p[2] + p[3] * 256; |
220 | size = p[7]; | 220 | size = p[7]; |
221 | pnpbios_parse_allocated_ioresource(res, io, size); | 221 | pnpbios_parse_allocated_ioresource(dev, io, size); |
222 | break; | 222 | break; |
223 | 223 | ||
224 | case SMALL_TAG_VENDOR: | 224 | case SMALL_TAG_VENDOR: |
@@ -230,7 +230,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p, | |||
230 | goto len_err; | 230 | goto len_err; |
231 | io = p[1] + p[2] * 256; | 231 | io = p[1] + p[2] * 256; |
232 | size = p[3]; | 232 | size = p[3]; |
233 | pnpbios_parse_allocated_ioresource(res, io, size); | 233 | pnpbios_parse_allocated_ioresource(dev, io, size); |
234 | break; | 234 | break; |
235 | 235 | ||
236 | case SMALL_TAG_END: | 236 | case SMALL_TAG_END: |
@@ -660,12 +660,12 @@ static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res) | |||
660 | p[3] = len & 0xff; | 660 | p[3] = len & 0xff; |
661 | } | 661 | } |
662 | 662 | ||
663 | static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p, | 663 | static unsigned char *pnpbios_encode_allocated_resource_data(struct pnp_dev |
664 | unsigned char *end, | 664 | *dev, |
665 | struct | 665 | unsigned char *p, |
666 | pnp_resource_table | 666 | unsigned char *end) |
667 | *res) | ||
668 | { | 667 | { |
668 | struct pnp_resource_table *res = &dev->res; | ||
669 | unsigned int len, tag; | 669 | unsigned int len, tag; |
670 | int port = 0, irq = 0, dma = 0, mem = 0; | 670 | int port = 0, irq = 0, dma = 0, mem = 0; |
671 | 671 | ||
@@ -774,7 +774,7 @@ int __init pnpbios_parse_data_stream(struct pnp_dev *dev, | |||
774 | unsigned char *p = (char *)node->data; | 774 | unsigned char *p = (char *)node->data; |
775 | unsigned char *end = (char *)(node->data + node->size); | 775 | unsigned char *end = (char *)(node->data + node->size); |
776 | 776 | ||
777 | p = pnpbios_parse_allocated_resource_data(p, end, &dev->res); | 777 | p = pnpbios_parse_allocated_resource_data(dev, p, end); |
778 | if (!p) | 778 | if (!p) |
779 | return -EIO; | 779 | return -EIO; |
780 | p = pnpbios_parse_resource_option_data(p, end, dev); | 780 | p = pnpbios_parse_resource_option_data(p, end, dev); |
@@ -786,25 +786,25 @@ int __init pnpbios_parse_data_stream(struct pnp_dev *dev, | |||
786 | return 0; | 786 | return 0; |
787 | } | 787 | } |
788 | 788 | ||
789 | int pnpbios_read_resources_from_node(struct pnp_resource_table *res, | 789 | int pnpbios_read_resources_from_node(struct pnp_dev *dev, |
790 | struct pnp_bios_node *node) | 790 | struct pnp_bios_node *node) |
791 | { | 791 | { |
792 | unsigned char *p = (char *)node->data; | 792 | unsigned char *p = (char *)node->data; |
793 | unsigned char *end = (char *)(node->data + node->size); | 793 | unsigned char *end = (char *)(node->data + node->size); |
794 | 794 | ||
795 | p = pnpbios_parse_allocated_resource_data(p, end, res); | 795 | p = pnpbios_parse_allocated_resource_data(dev, p, end); |
796 | if (!p) | 796 | if (!p) |
797 | return -EIO; | 797 | return -EIO; |
798 | return 0; | 798 | return 0; |
799 | } | 799 | } |
800 | 800 | ||
801 | int pnpbios_write_resources_to_node(struct pnp_resource_table *res, | 801 | int pnpbios_write_resources_to_node(struct pnp_dev *dev, |
802 | struct pnp_bios_node *node) | 802 | struct pnp_bios_node *node) |
803 | { | 803 | { |
804 | unsigned char *p = (char *)node->data; | 804 | unsigned char *p = (char *)node->data; |
805 | unsigned char *end = (char *)(node->data + node->size); | 805 | unsigned char *end = (char *)(node->data + node->size); |
806 | 806 | ||
807 | p = pnpbios_encode_allocated_resource_data(p, end, res); | 807 | p = pnpbios_encode_allocated_resource_data(dev, p, end); |
808 | if (!p) | 808 | if (!p) |
809 | return -EIO; | 809 | return -EIO; |
810 | return 0; | 810 | return 0; |