diff options
Diffstat (limited to 'drivers/pnp')
| -rw-r--r-- | drivers/pnp/isapnp/core.c | 1 | ||||
| -rw-r--r-- | drivers/pnp/manager.c | 1 | ||||
| -rw-r--r-- | drivers/pnp/pnpacpi/core.c | 1 | ||||
| -rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 43 | ||||
| -rw-r--r-- | drivers/pnp/pnpbios/bioscalls.c | 1 | ||||
| -rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 1 | ||||
| -rw-r--r-- | drivers/pnp/resource.c | 1 |
7 files changed, 33 insertions, 16 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index e851160e14f0..918d5f044865 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | #include <linux/module.h> | 37 | #include <linux/module.h> |
| 38 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
| 39 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
| 40 | #include <linux/slab.h> | ||
| 41 | #include <linux/delay.h> | 40 | #include <linux/delay.h> |
| 42 | #include <linux/init.h> | 41 | #include <linux/init.h> |
| 43 | #include <linux/isapnp.h> | 42 | #include <linux/isapnp.h> |
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index 00fd3577b985..0a15664eef1c 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
| 14 | #include <linux/pnp.h> | 14 | #include <linux/pnp.h> |
| 15 | #include <linux/slab.h> | ||
| 16 | #include <linux/bitmap.h> | 15 | #include <linux/bitmap.h> |
| 17 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
| 18 | #include "base.h" | 17 | #include "base.h" |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 5314bf630bc4..f7ff628b7d94 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | #include <linux/acpi.h> | 22 | #include <linux/acpi.h> |
| 23 | #include <linux/pnp.h> | 23 | #include <linux/pnp.h> |
| 24 | #include <linux/slab.h> | ||
| 24 | #include <linux/mod_devicetable.h> | 25 | #include <linux/mod_devicetable.h> |
| 25 | #include <acpi/acpi_bus.h> | 26 | #include <acpi/acpi_bus.h> |
| 26 | 27 | ||
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 54514aa35b09..35bb44af49b3 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/acpi.h> | 24 | #include <linux/acpi.h> |
| 25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
| 26 | #include <linux/pnp.h> | 26 | #include <linux/pnp.h> |
| 27 | #include <linux/slab.h> | ||
| 27 | #include "../base.h" | 28 | #include "../base.h" |
| 28 | #include "pnpacpi.h" | 29 | #include "pnpacpi.h" |
| 29 | 30 | ||
| @@ -273,12 +274,33 @@ static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev, | |||
| 273 | pnp_add_bus_resource(dev, start, end); | 274 | pnp_add_bus_resource(dev, start, end); |
| 274 | } | 275 | } |
| 275 | 276 | ||
| 277 | static u64 addr_space_length(struct pnp_dev *dev, u64 min, u64 max, u64 len) | ||
| 278 | { | ||
| 279 | u64 max_len; | ||
| 280 | |||
| 281 | max_len = max - min + 1; | ||
| 282 | if (len <= max_len) | ||
| 283 | return len; | ||
| 284 | |||
| 285 | /* | ||
| 286 | * Per 6.4.3.5, _LEN cannot exceed _MAX - _MIN + 1, but some BIOSes | ||
| 287 | * don't do this correctly, e.g., | ||
| 288 | * https://bugzilla.kernel.org/show_bug.cgi?id=15480 | ||
| 289 | */ | ||
| 290 | dev_info(&dev->dev, | ||
| 291 | "resource length %#llx doesn't fit in %#llx-%#llx, trimming\n", | ||
| 292 | (unsigned long long) len, (unsigned long long) min, | ||
| 293 | (unsigned long long) max); | ||
| 294 | return max_len; | ||
| 295 | } | ||
| 296 | |||
| 276 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | 297 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
| 277 | struct acpi_resource *res) | 298 | struct acpi_resource *res) |
| 278 | { | 299 | { |
| 279 | struct acpi_resource_address64 addr, *p = &addr; | 300 | struct acpi_resource_address64 addr, *p = &addr; |
| 280 | acpi_status status; | 301 | acpi_status status; |
| 281 | int window; | 302 | int window; |
| 303 | u64 len; | ||
| 282 | 304 | ||
| 283 | status = acpi_resource_to_address64(res, p); | 305 | status = acpi_resource_to_address64(res, p); |
| 284 | if (!ACPI_SUCCESS(status)) { | 306 | if (!ACPI_SUCCESS(status)) { |
| @@ -287,20 +309,18 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | |||
| 287 | return; | 309 | return; |
| 288 | } | 310 | } |
| 289 | 311 | ||
| 312 | len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); | ||
| 290 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; | 313 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
| 291 | 314 | ||
| 292 | if (p->resource_type == ACPI_MEMORY_RANGE) | 315 | if (p->resource_type == ACPI_MEMORY_RANGE) |
| 293 | pnpacpi_parse_allocated_memresource(dev, | 316 | pnpacpi_parse_allocated_memresource(dev, p->minimum, len, |
| 294 | p->minimum, p->address_length, | ||
| 295 | p->info.mem.write_protect, window); | 317 | p->info.mem.write_protect, window); |
| 296 | else if (p->resource_type == ACPI_IO_RANGE) | 318 | else if (p->resource_type == ACPI_IO_RANGE) |
| 297 | pnpacpi_parse_allocated_ioresource(dev, | 319 | pnpacpi_parse_allocated_ioresource(dev, p->minimum, len, |
| 298 | p->minimum, p->address_length, | ||
| 299 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 320 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
| 300 | ACPI_DECODE_16, window); | 321 | ACPI_DECODE_16, window); |
| 301 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | 322 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) |
| 302 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | 323 | pnpacpi_parse_allocated_busresource(dev, p->minimum, len); |
| 303 | p->address_length); | ||
| 304 | } | 324 | } |
| 305 | 325 | ||
| 306 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | 326 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, |
| @@ -308,21 +328,20 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | |||
| 308 | { | 328 | { |
| 309 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; | 329 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; |
| 310 | int window; | 330 | int window; |
| 331 | u64 len; | ||
| 311 | 332 | ||
| 333 | len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); | ||
| 312 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; | 334 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
| 313 | 335 | ||
| 314 | if (p->resource_type == ACPI_MEMORY_RANGE) | 336 | if (p->resource_type == ACPI_MEMORY_RANGE) |
| 315 | pnpacpi_parse_allocated_memresource(dev, | 337 | pnpacpi_parse_allocated_memresource(dev, p->minimum, len, |
| 316 | p->minimum, p->address_length, | ||
| 317 | p->info.mem.write_protect, window); | 338 | p->info.mem.write_protect, window); |
| 318 | else if (p->resource_type == ACPI_IO_RANGE) | 339 | else if (p->resource_type == ACPI_IO_RANGE) |
| 319 | pnpacpi_parse_allocated_ioresource(dev, | 340 | pnpacpi_parse_allocated_ioresource(dev, p->minimum, len, |
| 320 | p->minimum, p->address_length, | ||
| 321 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 341 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
| 322 | ACPI_DECODE_16, window); | 342 | ACPI_DECODE_16, window); |
| 323 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | 343 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) |
| 324 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | 344 | pnpacpi_parse_allocated_busresource(dev, p->minimum, len); |
| 325 | p->address_length); | ||
| 326 | } | 345 | } |
| 327 | 346 | ||
| 328 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 347 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c index fc83783c3a96..8591f6ab1b35 100644 --- a/drivers/pnp/pnpbios/bioscalls.c +++ b/drivers/pnp/pnpbios/bioscalls.c | |||
| @@ -11,7 +11,6 @@ | |||
| 11 | #include <linux/pnp.h> | 11 | #include <linux/pnp.h> |
| 12 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
| 13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
| 14 | #include <linux/slab.h> | ||
| 15 | #include <linux/kmod.h> | 14 | #include <linux/kmod.h> |
| 16 | #include <linux/completion.h> | 15 | #include <linux/completion.h> |
| 17 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index a5135ebe5f07..cb1f47bfee96 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
| @@ -5,7 +5,6 @@ | |||
| 5 | #include <linux/ctype.h> | 5 | #include <linux/ctype.h> |
| 6 | #include <linux/pnp.h> | 6 | #include <linux/pnp.h> |
| 7 | #include <linux/string.h> | 7 | #include <linux/string.h> |
| 8 | #include <linux/slab.h> | ||
| 9 | 8 | ||
| 10 | #ifdef CONFIG_PCI | 9 | #ifdef CONFIG_PCI |
| 11 | #include <linux/pci.h> | 10 | #include <linux/pci.h> |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 5b277dbaacde..2e54e6a23c72 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/slab.h> | ||
| 11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
| 12 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
| 13 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
