diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/isapnp/core.c | 22 | ||||
-rw-r--r-- | drivers/pnp/isapnp/proc.c | 2 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/Kconfig | 4 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 6 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 22 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 16 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/proc.c | 8 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/rsparser.c | 16 | ||||
-rw-r--r-- | drivers/pnp/system.c | 52 |
9 files changed, 75 insertions, 73 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 3ac5b123215a..a0b158704ca1 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -395,7 +395,7 @@ static void isapnp_parse_id(struct pnp_dev * dev, unsigned short vendor, unsigne | |||
395 | struct pnp_id * id; | 395 | struct pnp_id * id; |
396 | if (!dev) | 396 | if (!dev) |
397 | return; | 397 | return; |
398 | id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); | 398 | id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
399 | if (!id) | 399 | if (!id) |
400 | return; | 400 | return; |
401 | sprintf(id->id, "%c%c%c%x%x%x%x", | 401 | sprintf(id->id, "%c%c%c%x%x%x%x", |
@@ -419,7 +419,7 @@ static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int si | |||
419 | struct pnp_dev *dev; | 419 | struct pnp_dev *dev; |
420 | 420 | ||
421 | isapnp_peek(tmp, size); | 421 | isapnp_peek(tmp, size); |
422 | dev = kcalloc(1, sizeof(struct pnp_dev), GFP_KERNEL); | 422 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); |
423 | if (!dev) | 423 | if (!dev) |
424 | return NULL; | 424 | return NULL; |
425 | dev->number = number; | 425 | dev->number = number; |
@@ -450,7 +450,7 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option, | |||
450 | unsigned long bits; | 450 | unsigned long bits; |
451 | 451 | ||
452 | isapnp_peek(tmp, size); | 452 | isapnp_peek(tmp, size); |
453 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 453 | irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL); |
454 | if (!irq) | 454 | if (!irq) |
455 | return; | 455 | return; |
456 | bits = (tmp[1] << 8) | tmp[0]; | 456 | bits = (tmp[1] << 8) | tmp[0]; |
@@ -474,7 +474,7 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option, | |||
474 | struct pnp_dma *dma; | 474 | struct pnp_dma *dma; |
475 | 475 | ||
476 | isapnp_peek(tmp, size); | 476 | isapnp_peek(tmp, size); |
477 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); | 477 | dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); |
478 | if (!dma) | 478 | if (!dma) |
479 | return; | 479 | return; |
480 | dma->map = tmp[0]; | 480 | dma->map = tmp[0]; |
@@ -494,7 +494,7 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option, | |||
494 | struct pnp_port *port; | 494 | struct pnp_port *port; |
495 | 495 | ||
496 | isapnp_peek(tmp, size); | 496 | isapnp_peek(tmp, size); |
497 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 497 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
498 | if (!port) | 498 | if (!port) |
499 | return; | 499 | return; |
500 | port->min = (tmp[2] << 8) | tmp[1]; | 500 | port->min = (tmp[2] << 8) | tmp[1]; |
@@ -517,7 +517,7 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option, | |||
517 | struct pnp_port *port; | 517 | struct pnp_port *port; |
518 | 518 | ||
519 | isapnp_peek(tmp, size); | 519 | isapnp_peek(tmp, size); |
520 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 520 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
521 | if (!port) | 521 | if (!port) |
522 | return; | 522 | return; |
523 | port->min = port->max = (tmp[1] << 8) | tmp[0]; | 523 | port->min = port->max = (tmp[1] << 8) | tmp[0]; |
@@ -539,7 +539,7 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option, | |||
539 | struct pnp_mem *mem; | 539 | struct pnp_mem *mem; |
540 | 540 | ||
541 | isapnp_peek(tmp, size); | 541 | isapnp_peek(tmp, size); |
542 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 542 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
543 | if (!mem) | 543 | if (!mem) |
544 | return; | 544 | return; |
545 | mem->min = ((tmp[2] << 8) | tmp[1]) << 8; | 545 | mem->min = ((tmp[2] << 8) | tmp[1]) << 8; |
@@ -562,7 +562,7 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option, | |||
562 | struct pnp_mem *mem; | 562 | struct pnp_mem *mem; |
563 | 563 | ||
564 | isapnp_peek(tmp, size); | 564 | isapnp_peek(tmp, size); |
565 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 565 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
566 | if (!mem) | 566 | if (!mem) |
567 | return; | 567 | return; |
568 | mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; | 568 | mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; |
@@ -584,7 +584,7 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option, | |||
584 | struct pnp_mem *mem; | 584 | struct pnp_mem *mem; |
585 | 585 | ||
586 | isapnp_peek(tmp, size); | 586 | isapnp_peek(tmp, size); |
587 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 587 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
588 | if (!mem) | 588 | if (!mem) |
589 | return; | 589 | return; |
590 | mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; | 590 | mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1]; |
@@ -829,7 +829,7 @@ static unsigned char __init isapnp_checksum(unsigned char *data) | |||
829 | 829 | ||
830 | static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device) | 830 | static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device) |
831 | { | 831 | { |
832 | struct pnp_id * id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); | 832 | struct pnp_id * id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
833 | if (!id) | 833 | if (!id) |
834 | return; | 834 | return; |
835 | sprintf(id->id, "%c%c%c%x%x%x%x", | 835 | sprintf(id->id, "%c%c%c%x%x%x%x", |
@@ -865,7 +865,7 @@ static int __init isapnp_build_device_list(void) | |||
865 | header[4], header[5], header[6], header[7], header[8]); | 865 | header[4], header[5], header[6], header[7], header[8]); |
866 | printk(KERN_DEBUG "checksum = 0x%x\n", checksum); | 866 | printk(KERN_DEBUG "checksum = 0x%x\n", checksum); |
867 | #endif | 867 | #endif |
868 | if ((card = kcalloc(1, sizeof(struct pnp_card), GFP_KERNEL)) == NULL) | 868 | if ((card = kzalloc(sizeof(struct pnp_card), GFP_KERNEL)) == NULL) |
869 | continue; | 869 | continue; |
870 | 870 | ||
871 | card->number = csn; | 871 | card->number = csn; |
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c index 958c11bedd0d..d21f3c1e72fc 100644 --- a/drivers/pnp/isapnp/proc.c +++ b/drivers/pnp/isapnp/proc.c | |||
@@ -56,7 +56,7 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence) | |||
56 | 56 | ||
57 | static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) | 57 | static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) |
58 | { | 58 | { |
59 | struct inode *ino = file->f_dentry->d_inode; | 59 | struct inode *ino = file->f_path.dentry->d_inode; |
60 | struct proc_dir_entry *dp = PDE(ino); | 60 | struct proc_dir_entry *dp = PDE(ino); |
61 | struct pnp_dev *dev = dp->data; | 61 | struct pnp_dev *dev = dp->data; |
62 | int pos = *ppos; | 62 | int pos = *ppos; |
diff --git a/drivers/pnp/pnpacpi/Kconfig b/drivers/pnp/pnpacpi/Kconfig index b1854171b963..ad27e5e0101f 100644 --- a/drivers/pnp/pnpacpi/Kconfig +++ b/drivers/pnp/pnpacpi/Kconfig | |||
@@ -2,8 +2,8 @@ | |||
2 | # Plug and Play ACPI configuration | 2 | # Plug and Play ACPI configuration |
3 | # | 3 | # |
4 | config PNPACPI | 4 | config PNPACPI |
5 | bool "Plug and Play ACPI support (EXPERIMENTAL)" | 5 | bool "Plug and Play ACPI support" |
6 | depends on PNP && ACPI && EXPERIMENTAL | 6 | depends on PNP && ACPI |
7 | default y | 7 | default y |
8 | ---help--- | 8 | ---help--- |
9 | Linux uses the PNPACPI to autodetect built-in | 9 | Linux uses the PNPACPI to autodetect built-in |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 6cf34a63c790..62eda5d59024 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -139,7 +139,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
139 | return 0; | 139 | return 0; |
140 | 140 | ||
141 | pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); | 141 | pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); |
142 | dev = kcalloc(1, sizeof(struct pnp_dev), GFP_KERNEL); | 142 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); |
143 | if (!dev) { | 143 | if (!dev) { |
144 | pnp_err("Out of memory"); | 144 | pnp_err("Out of memory"); |
145 | return -ENOMEM; | 145 | return -ENOMEM; |
@@ -169,7 +169,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
169 | dev->number = num; | 169 | dev->number = num; |
170 | 170 | ||
171 | /* set the initial values for the PnP device */ | 171 | /* set the initial values for the PnP device */ |
172 | dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); | 172 | dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
173 | if (!dev_id) | 173 | if (!dev_id) |
174 | goto err; | 174 | goto err; |
175 | pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id); | 175 | pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id); |
@@ -201,7 +201,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
201 | for (i = 0; i < cid_list->count; i++) { | 201 | for (i = 0; i < cid_list->count; i++) { |
202 | if (!ispnpidacpi(cid_list->id[i].value)) | 202 | if (!ispnpidacpi(cid_list->id[i].value)) |
203 | continue; | 203 | continue; |
204 | dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); | 204 | dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
205 | if (!dev_id) | 205 | if (!dev_id) |
206 | continue; | 206 | continue; |
207 | 207 | ||
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 379048fdf05d..7a535542fe92 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -298,7 +298,7 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
298 | 298 | ||
299 | if (p->channel_count == 0) | 299 | if (p->channel_count == 0) |
300 | return; | 300 | return; |
301 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); | 301 | dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); |
302 | if (!dma) | 302 | if (!dma) |
303 | return; | 303 | return; |
304 | 304 | ||
@@ -354,7 +354,7 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, | |||
354 | 354 | ||
355 | if (p->interrupt_count == 0) | 355 | if (p->interrupt_count == 0) |
356 | return; | 356 | return; |
357 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 357 | irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL); |
358 | if (!irq) | 358 | if (!irq) |
359 | return; | 359 | return; |
360 | 360 | ||
@@ -375,7 +375,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | |||
375 | 375 | ||
376 | if (p->interrupt_count == 0) | 376 | if (p->interrupt_count == 0) |
377 | return; | 377 | return; |
378 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 378 | irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL); |
379 | if (!irq) | 379 | if (!irq) |
380 | return; | 380 | return; |
381 | 381 | ||
@@ -396,7 +396,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
396 | 396 | ||
397 | if (io->address_length == 0) | 397 | if (io->address_length == 0) |
398 | return; | 398 | return; |
399 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 399 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
400 | if (!port) | 400 | if (!port) |
401 | return; | 401 | return; |
402 | port->min = io->minimum; | 402 | port->min = io->minimum; |
@@ -417,7 +417,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
417 | 417 | ||
418 | if (io->address_length == 0) | 418 | if (io->address_length == 0) |
419 | return; | 419 | return; |
420 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 420 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
421 | if (!port) | 421 | if (!port) |
422 | return; | 422 | return; |
423 | port->min = port->max = io->address; | 423 | port->min = port->max = io->address; |
@@ -436,7 +436,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
436 | 436 | ||
437 | if (p->address_length == 0) | 437 | if (p->address_length == 0) |
438 | return; | 438 | return; |
439 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 439 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
440 | if (!mem) | 440 | if (!mem) |
441 | return; | 441 | return; |
442 | mem->min = p->minimum; | 442 | mem->min = p->minimum; |
@@ -459,7 +459,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
459 | 459 | ||
460 | if (p->address_length == 0) | 460 | if (p->address_length == 0) |
461 | return; | 461 | return; |
462 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 462 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
463 | if (!mem) | 463 | if (!mem) |
464 | return; | 464 | return; |
465 | mem->min = p->minimum; | 465 | mem->min = p->minimum; |
@@ -482,7 +482,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | |||
482 | 482 | ||
483 | if (p->address_length == 0) | 483 | if (p->address_length == 0) |
484 | return; | 484 | return; |
485 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 485 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
486 | if (!mem) | 486 | if (!mem) |
487 | return; | 487 | return; |
488 | mem->min = mem->max = p->address; | 488 | mem->min = mem->max = p->address; |
@@ -514,7 +514,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
514 | return; | 514 | return; |
515 | 515 | ||
516 | if (p->resource_type == ACPI_MEMORY_RANGE) { | 516 | if (p->resource_type == ACPI_MEMORY_RANGE) { |
517 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 517 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
518 | if (!mem) | 518 | if (!mem) |
519 | return; | 519 | return; |
520 | mem->min = mem->max = p->minimum; | 520 | mem->min = mem->max = p->minimum; |
@@ -524,7 +524,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
524 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 524 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
525 | pnp_register_mem_resource(option, mem); | 525 | pnp_register_mem_resource(option, mem); |
526 | } else if (p->resource_type == ACPI_IO_RANGE) { | 526 | } else if (p->resource_type == ACPI_IO_RANGE) { |
527 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 527 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
528 | if (!port) | 528 | if (!port) |
529 | return; | 529 | return; |
530 | port->min = port->max = p->minimum; | 530 | port->min = port->max = p->minimum; |
@@ -721,7 +721,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, | |||
721 | if (!res_cnt) | 721 | if (!res_cnt) |
722 | return -EINVAL; | 722 | return -EINVAL; |
723 | buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1; | 723 | buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1; |
724 | buffer->pointer = kcalloc(1, buffer->length - 1, GFP_KERNEL); | 724 | buffer->pointer = kzalloc(buffer->length - 1, GFP_KERNEL); |
725 | if (!buffer->pointer) | 725 | if (!buffer->pointer) |
726 | return -ENOMEM; | 726 | return -ENOMEM; |
727 | pnp_dbg("Res cnt %d", res_cnt); | 727 | pnp_dbg("Res cnt %d", res_cnt); |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 33adeba1a31f..95738dbd5d45 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -109,10 +109,10 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info) | |||
109 | if (!current->fs->root) { | 109 | if (!current->fs->root) { |
110 | return -EAGAIN; | 110 | return -EAGAIN; |
111 | } | 111 | } |
112 | if (!(envp = (char **) kcalloc (20, sizeof (char *), GFP_KERNEL))) { | 112 | if (!(envp = kcalloc(20, sizeof (char *), GFP_KERNEL))) { |
113 | return -ENOMEM; | 113 | return -ENOMEM; |
114 | } | 114 | } |
115 | if (!(buf = kcalloc (1, 256, GFP_KERNEL))) { | 115 | if (!(buf = kzalloc(256, GFP_KERNEL))) { |
116 | kfree (envp); | 116 | kfree (envp); |
117 | return -ENOMEM; | 117 | return -ENOMEM; |
118 | } | 118 | } |
@@ -220,7 +220,7 @@ static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table | |||
220 | if(!pnpbios_is_dynamic(dev)) | 220 | if(!pnpbios_is_dynamic(dev)) |
221 | return -EPERM; | 221 | return -EPERM; |
222 | 222 | ||
223 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 223 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
224 | if (!node) | 224 | if (!node) |
225 | return -1; | 225 | return -1; |
226 | if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { | 226 | if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { |
@@ -243,7 +243,7 @@ static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table | |||
243 | if (!pnpbios_is_dynamic(dev)) | 243 | if (!pnpbios_is_dynamic(dev)) |
244 | return -EPERM; | 244 | return -EPERM; |
245 | 245 | ||
246 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 246 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
247 | if (!node) | 247 | if (!node) |
248 | return -1; | 248 | return -1; |
249 | if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { | 249 | if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) { |
@@ -294,7 +294,7 @@ static int pnpbios_disable_resources(struct pnp_dev *dev) | |||
294 | if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev)) | 294 | if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev)) |
295 | return -EPERM; | 295 | return -EPERM; |
296 | 296 | ||
297 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 297 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
298 | if (!node) | 298 | if (!node) |
299 | return -ENOMEM; | 299 | return -ENOMEM; |
300 | 300 | ||
@@ -336,7 +336,7 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node) | |||
336 | } | 336 | } |
337 | 337 | ||
338 | /* set the initial values for the PnP device */ | 338 | /* set the initial values for the PnP device */ |
339 | dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); | 339 | dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
340 | if (!dev_id) | 340 | if (!dev_id) |
341 | return -1; | 341 | return -1; |
342 | pnpid32_to_pnpid(node->eisa_id,id); | 342 | pnpid32_to_pnpid(node->eisa_id,id); |
@@ -374,7 +374,7 @@ static void __init build_devlist(void) | |||
374 | struct pnp_bios_node *node; | 374 | struct pnp_bios_node *node; |
375 | struct pnp_dev *dev; | 375 | struct pnp_dev *dev; |
376 | 376 | ||
377 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 377 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
378 | if (!node) | 378 | if (!node) |
379 | return; | 379 | return; |
380 | 380 | ||
@@ -391,7 +391,7 @@ static void __init build_devlist(void) | |||
391 | break; | 391 | break; |
392 | } | 392 | } |
393 | nodes_got++; | 393 | nodes_got++; |
394 | dev = kcalloc(1, sizeof (struct pnp_dev), GFP_KERNEL); | 394 | dev = kzalloc(sizeof (struct pnp_dev), GFP_KERNEL); |
395 | if (!dev) | 395 | if (!dev) |
396 | break; | 396 | break; |
397 | if(insert_device(dev,node)<0) | 397 | if(insert_device(dev,node)<0) |
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 5a3dfc97f5e9..8027073f7919 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c | |||
@@ -87,7 +87,7 @@ static int proc_read_escd(char *buf, char **start, off_t pos, | |||
87 | return -EFBIG; | 87 | return -EFBIG; |
88 | } | 88 | } |
89 | 89 | ||
90 | tmpbuf = kcalloc(1, escd.escd_size, GFP_KERNEL); | 90 | tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL); |
91 | if (!tmpbuf) return -ENOMEM; | 91 | if (!tmpbuf) return -ENOMEM; |
92 | 92 | ||
93 | if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) { | 93 | if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) { |
@@ -133,7 +133,7 @@ static int proc_read_devices(char *buf, char **start, off_t pos, | |||
133 | if (pos >= 0xff) | 133 | if (pos >= 0xff) |
134 | return 0; | 134 | return 0; |
135 | 135 | ||
136 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 136 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
137 | if (!node) return -ENOMEM; | 137 | if (!node) return -ENOMEM; |
138 | 138 | ||
139 | for (nodenum=pos; nodenum<0xff; ) { | 139 | for (nodenum=pos; nodenum<0xff; ) { |
@@ -168,7 +168,7 @@ static int proc_read_node(char *buf, char **start, off_t pos, | |||
168 | u8 nodenum = (long)data; | 168 | u8 nodenum = (long)data; |
169 | int len; | 169 | int len; |
170 | 170 | ||
171 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 171 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
172 | if (!node) return -ENOMEM; | 172 | if (!node) return -ENOMEM; |
173 | if (pnp_bios_get_dev_node(&nodenum, boot, node)) { | 173 | if (pnp_bios_get_dev_node(&nodenum, boot, node)) { |
174 | kfree(node); | 174 | kfree(node); |
@@ -188,7 +188,7 @@ static int proc_write_node(struct file *file, const char __user *buf, | |||
188 | u8 nodenum = (long)data; | 188 | u8 nodenum = (long)data; |
189 | int ret = count; | 189 | int ret = count; |
190 | 190 | ||
191 | node = kcalloc(1, node_info.max_node_size, GFP_KERNEL); | 191 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
192 | if (!node) | 192 | if (!node) |
193 | return -ENOMEM; | 193 | return -ENOMEM; |
194 | if (pnp_bios_get_dev_node(&nodenum, boot, node)) { | 194 | if (pnp_bios_get_dev_node(&nodenum, boot, node)) { |
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c index ef508a4de557..95b79685a9d1 100644 --- a/drivers/pnp/pnpbios/rsparser.c +++ b/drivers/pnp/pnpbios/rsparser.c | |||
@@ -248,7 +248,7 @@ static void | |||
248 | pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option) | 248 | pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option) |
249 | { | 249 | { |
250 | struct pnp_mem * mem; | 250 | struct pnp_mem * mem; |
251 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 251 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
252 | if (!mem) | 252 | if (!mem) |
253 | return; | 253 | return; |
254 | mem->min = ((p[5] << 8) | p[4]) << 8; | 254 | mem->min = ((p[5] << 8) | p[4]) << 8; |
@@ -264,7 +264,7 @@ static void | |||
264 | pnpbios_parse_mem32_option(unsigned char *p, int size, struct pnp_option *option) | 264 | pnpbios_parse_mem32_option(unsigned char *p, int size, struct pnp_option *option) |
265 | { | 265 | { |
266 | struct pnp_mem * mem; | 266 | struct pnp_mem * mem; |
267 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 267 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
268 | if (!mem) | 268 | if (!mem) |
269 | return; | 269 | return; |
270 | mem->min = (p[7] << 24) | (p[6] << 16) | (p[5] << 8) | p[4]; | 270 | mem->min = (p[7] << 24) | (p[6] << 16) | (p[5] << 8) | p[4]; |
@@ -280,7 +280,7 @@ static void | |||
280 | pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, struct pnp_option *option) | 280 | pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, struct pnp_option *option) |
281 | { | 281 | { |
282 | struct pnp_mem * mem; | 282 | struct pnp_mem * mem; |
283 | mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); | 283 | mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); |
284 | if (!mem) | 284 | if (!mem) |
285 | return; | 285 | return; |
286 | mem->min = mem->max = (p[7] << 24) | (p[6] << 16) | (p[5] << 8) | p[4]; | 286 | mem->min = mem->max = (p[7] << 24) | (p[6] << 16) | (p[5] << 8) | p[4]; |
@@ -297,7 +297,7 @@ pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option) | |||
297 | struct pnp_irq * irq; | 297 | struct pnp_irq * irq; |
298 | unsigned long bits; | 298 | unsigned long bits; |
299 | 299 | ||
300 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 300 | irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL); |
301 | if (!irq) | 301 | if (!irq) |
302 | return; | 302 | return; |
303 | bits = (p[2] << 8) | p[1]; | 303 | bits = (p[2] << 8) | p[1]; |
@@ -314,7 +314,7 @@ static void | |||
314 | pnpbios_parse_dma_option(unsigned char *p, int size, struct pnp_option *option) | 314 | pnpbios_parse_dma_option(unsigned char *p, int size, struct pnp_option *option) |
315 | { | 315 | { |
316 | struct pnp_dma * dma; | 316 | struct pnp_dma * dma; |
317 | dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); | 317 | dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL); |
318 | if (!dma) | 318 | if (!dma) |
319 | return; | 319 | return; |
320 | dma->map = p[1]; | 320 | dma->map = p[1]; |
@@ -327,7 +327,7 @@ static void | |||
327 | pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option) | 327 | pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option) |
328 | { | 328 | { |
329 | struct pnp_port * port; | 329 | struct pnp_port * port; |
330 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 330 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
331 | if (!port) | 331 | if (!port) |
332 | return; | 332 | return; |
333 | port->min = (p[3] << 8) | p[2]; | 333 | port->min = (p[3] << 8) | p[2]; |
@@ -343,7 +343,7 @@ static void | |||
343 | pnpbios_parse_fixed_port_option(unsigned char *p, int size, struct pnp_option *option) | 343 | pnpbios_parse_fixed_port_option(unsigned char *p, int size, struct pnp_option *option) |
344 | { | 344 | { |
345 | struct pnp_port * port; | 345 | struct pnp_port * port; |
346 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 346 | port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL); |
347 | if (!port) | 347 | if (!port) |
348 | return; | 348 | return; |
349 | port->min = port->max = (p[2] << 8) | p[1]; | 349 | port->min = port->max = (p[2] << 8) | p[1]; |
@@ -527,7 +527,7 @@ pnpbios_parse_compatible_ids(unsigned char *p, unsigned char *end, struct pnp_de | |||
527 | case SMALL_TAG_COMPATDEVID: /* compatible ID */ | 527 | case SMALL_TAG_COMPATDEVID: /* compatible ID */ |
528 | if (len != 4) | 528 | if (len != 4) |
529 | goto len_err; | 529 | goto len_err; |
530 | dev_id = kcalloc(1, sizeof (struct pnp_id), GFP_KERNEL); | 530 | dev_id = kzalloc(sizeof (struct pnp_id), GFP_KERNEL); |
531 | if (!dev_id) | 531 | if (!dev_id) |
532 | return NULL; | 532 | return NULL; |
533 | memset(dev_id, 0, sizeof(struct pnp_id)); | 533 | memset(dev_id, 0, sizeof(struct pnp_id)); |
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index d42015c382af..2065e74bb63f 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c | |||
@@ -3,7 +3,8 @@ | |||
3 | * | 3 | * |
4 | * Some code is based on pnpbios_core.c | 4 | * Some code is based on pnpbios_core.c |
5 | * Copyright 2002 Adam Belay <ambx1@neo.rr.com> | 5 | * Copyright 2002 Adam Belay <ambx1@neo.rr.com> |
6 | * | 6 | * (c) Copyright 2007 Hewlett-Packard Development Company, L.P. |
7 | * Bjorn Helgaas <bjorn.helgaas@hp.com> | ||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #include <linux/pnp.h> | 10 | #include <linux/pnp.h> |
@@ -21,18 +22,21 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
21 | { "", 0 } | 22 | { "", 0 } |
22 | }; | 23 | }; |
23 | 24 | ||
24 | static void reserve_ioport_range(char *pnpid, int start, int end) | 25 | static void reserve_range(char *pnpid, int start, int end, int port) |
25 | { | 26 | { |
26 | struct resource *res; | 27 | struct resource *res; |
27 | char *regionid; | 28 | char *regionid; |
28 | 29 | ||
29 | regionid = kmalloc(16, GFP_KERNEL); | 30 | regionid = kmalloc(16, GFP_KERNEL); |
30 | if ( regionid == NULL ) | 31 | if (regionid == NULL) |
31 | return; | 32 | return; |
32 | snprintf(regionid, 16, "pnp %s", pnpid); | 33 | snprintf(regionid, 16, "pnp %s", pnpid); |
33 | res = request_region(start,end-start+1,regionid); | 34 | if (port) |
34 | if ( res == NULL ) | 35 | res = request_region(start,end-start+1,regionid); |
35 | kfree( regionid ); | 36 | else |
37 | res = request_mem_region(start,end-start+1,regionid); | ||
38 | if (res == NULL) | ||
39 | kfree(regionid); | ||
36 | else | 40 | else |
37 | res->flags &= ~IORESOURCE_BUSY; | 41 | res->flags &= ~IORESOURCE_BUSY; |
38 | /* | 42 | /* |
@@ -41,26 +45,20 @@ static void reserve_ioport_range(char *pnpid, int start, int end) | |||
41 | * have double reservations. | 45 | * have double reservations. |
42 | */ | 46 | */ |
43 | printk(KERN_INFO | 47 | printk(KERN_INFO |
44 | "pnp: %s: ioport range 0x%x-0x%x %s reserved\n", | 48 | "pnp: %s: %s range 0x%x-0x%x %s reserved\n", |
45 | pnpid, start, end, | 49 | pnpid, port ? "ioport" : "iomem", start, end, |
46 | NULL != res ? "has been" : "could not be" | 50 | NULL != res ? "has been" : "could not be"); |
47 | ); | ||
48 | |||
49 | return; | ||
50 | } | 51 | } |
51 | 52 | ||
52 | static void reserve_resources_of_dev( struct pnp_dev *dev ) | 53 | static void reserve_resources_of_dev(struct pnp_dev *dev) |
53 | { | 54 | { |
54 | int i; | 55 | int i; |
55 | 56 | ||
56 | for (i=0;i<PNP_MAX_PORT;i++) { | 57 | for (i = 0; i < PNP_MAX_PORT; i++) { |
57 | if (!pnp_port_valid(dev, i)) | 58 | if (!pnp_port_valid(dev, i)) |
58 | /* end of resources */ | ||
59 | continue; | 59 | continue; |
60 | if (pnp_port_start(dev, i) == 0) | 60 | if (pnp_port_start(dev, i) == 0) |
61 | /* disabled */ | 61 | continue; /* disabled */ |
62 | /* Do nothing */ | ||
63 | continue; | ||
64 | if (pnp_port_start(dev, i) < 0x100) | 62 | if (pnp_port_start(dev, i) < 0x100) |
65 | /* | 63 | /* |
66 | * Below 0x100 is only standard PC hardware | 64 | * Below 0x100 is only standard PC hardware |
@@ -72,14 +70,18 @@ static void reserve_resources_of_dev( struct pnp_dev *dev ) | |||
72 | */ | 70 | */ |
73 | continue; | 71 | continue; |
74 | if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) | 72 | if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) |
75 | /* invalid endpoint */ | 73 | continue; /* invalid */ |
76 | /* Do nothing */ | 74 | |
75 | reserve_range(dev->dev.bus_id, pnp_port_start(dev, i), | ||
76 | pnp_port_end(dev, i), 1); | ||
77 | } | ||
78 | |||
79 | for (i = 0; i < PNP_MAX_MEM; i++) { | ||
80 | if (!pnp_mem_valid(dev, i)) | ||
77 | continue; | 81 | continue; |
78 | reserve_ioport_range( | 82 | |
79 | dev->dev.bus_id, | 83 | reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), |
80 | pnp_port_start(dev, i), | 84 | pnp_mem_end(dev, i), 0); |
81 | pnp_port_end(dev, i) | ||
82 | ); | ||
83 | } | 85 | } |
84 | 86 | ||
85 | return; | 87 | return; |