aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/isapnp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pnp/isapnp')
-rw-r--r--drivers/pnp/isapnp/core.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index 82c5edd5b9ee..beedd86800f4 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -142,17 +142,6 @@ static void isapnp_write_word(unsigned char idx, unsigned short val)
142 isapnp_write_byte(idx+1, val); 142 isapnp_write_byte(idx+1, val);
143} 143}
144 144
145static void *isapnp_alloc(long size)
146{
147 void *result;
148
149 result = kmalloc(size, GFP_KERNEL);
150 if (!result)
151 return NULL;
152 memset(result, 0, size);
153 return result;
154}
155
156static void isapnp_key(void) 145static void isapnp_key(void)
157{ 146{
158 unsigned char code = 0x6a, msb; 147 unsigned char code = 0x6a, msb;
@@ -406,7 +395,7 @@ static void isapnp_parse_id(struct pnp_dev * dev, unsigned short vendor, unsigne
406 struct pnp_id * id; 395 struct pnp_id * id;
407 if (!dev) 396 if (!dev)
408 return; 397 return;
409 id = isapnp_alloc(sizeof(struct pnp_id)); 398 id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
410 if (!id) 399 if (!id)
411 return; 400 return;
412 sprintf(id->id, "%c%c%c%x%x%x%x", 401 sprintf(id->id, "%c%c%c%x%x%x%x",
@@ -430,7 +419,7 @@ static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int si
430 struct pnp_dev *dev; 419 struct pnp_dev *dev;
431 420
432 isapnp_peek(tmp, size); 421 isapnp_peek(tmp, size);
433 dev = isapnp_alloc(sizeof(struct pnp_dev)); 422 dev = kcalloc(1, sizeof(struct pnp_dev), GFP_KERNEL);
434 if (!dev) 423 if (!dev)
435 return NULL; 424 return NULL;
436 dev->number = number; 425 dev->number = number;
@@ -461,7 +450,7 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
461 unsigned long bits; 450 unsigned long bits;
462 451
463 isapnp_peek(tmp, size); 452 isapnp_peek(tmp, size);
464 irq = isapnp_alloc(sizeof(struct pnp_irq)); 453 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
465 if (!irq) 454 if (!irq)
466 return; 455 return;
467 bits = (tmp[1] << 8) | tmp[0]; 456 bits = (tmp[1] << 8) | tmp[0];
@@ -485,7 +474,7 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option,
485 struct pnp_dma *dma; 474 struct pnp_dma *dma;
486 475
487 isapnp_peek(tmp, size); 476 isapnp_peek(tmp, size);
488 dma = isapnp_alloc(sizeof(struct pnp_dma)); 477 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL);
489 if (!dma) 478 if (!dma)
490 return; 479 return;
491 dma->map = tmp[0]; 480 dma->map = tmp[0];
@@ -505,7 +494,7 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
505 struct pnp_port *port; 494 struct pnp_port *port;
506 495
507 isapnp_peek(tmp, size); 496 isapnp_peek(tmp, size);
508 port = isapnp_alloc(sizeof(struct pnp_port)); 497 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
509 if (!port) 498 if (!port)
510 return; 499 return;
511 port->min = (tmp[2] << 8) | tmp[1]; 500 port->min = (tmp[2] << 8) | tmp[1];
@@ -528,7 +517,7 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
528 struct pnp_port *port; 517 struct pnp_port *port;
529 518
530 isapnp_peek(tmp, size); 519 isapnp_peek(tmp, size);
531 port = isapnp_alloc(sizeof(struct pnp_port)); 520 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
532 if (!port) 521 if (!port)
533 return; 522 return;
534 port->min = port->max = (tmp[1] << 8) | tmp[0]; 523 port->min = port->max = (tmp[1] << 8) | tmp[0];
@@ -550,7 +539,7 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
550 struct pnp_mem *mem; 539 struct pnp_mem *mem;
551 540
552 isapnp_peek(tmp, size); 541 isapnp_peek(tmp, size);
553 mem = isapnp_alloc(sizeof(struct pnp_mem)); 542 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
554 if (!mem) 543 if (!mem)
555 return; 544 return;
556 mem->min = ((tmp[2] << 8) | tmp[1]) << 8; 545 mem->min = ((tmp[2] << 8) | tmp[1]) << 8;
@@ -573,7 +562,7 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
573 struct pnp_mem *mem; 562 struct pnp_mem *mem;
574 563
575 isapnp_peek(tmp, size); 564 isapnp_peek(tmp, size);
576 mem = isapnp_alloc(sizeof(struct pnp_mem)); 565 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
577 if (!mem) 566 if (!mem)
578 return; 567 return;
579 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];
@@ -595,7 +584,7 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
595 struct pnp_mem *mem; 584 struct pnp_mem *mem;
596 585
597 isapnp_peek(tmp, size); 586 isapnp_peek(tmp, size);
598 mem = isapnp_alloc(sizeof(struct pnp_mem)); 587 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
599 if (!mem) 588 if (!mem)
600 return; 589 return;
601 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];
@@ -838,7 +827,7 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
838 827
839static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device) 828static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device)
840{ 829{
841 struct pnp_id * id = isapnp_alloc(sizeof(struct pnp_id)); 830 struct pnp_id * id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
842 if (!id) 831 if (!id)
843 return; 832 return;
844 sprintf(id->id, "%c%c%c%x%x%x%x", 833 sprintf(id->id, "%c%c%c%x%x%x%x",
@@ -874,7 +863,7 @@ static int __init isapnp_build_device_list(void)
874 header[4], header[5], header[6], header[7], header[8]); 863 header[4], header[5], header[6], header[7], header[8]);
875 printk(KERN_DEBUG "checksum = 0x%x\n", checksum); 864 printk(KERN_DEBUG "checksum = 0x%x\n", checksum);
876#endif 865#endif
877 if ((card = isapnp_alloc(sizeof(struct pnp_card))) == NULL) 866 if ((card = kcalloc(1, sizeof(struct pnp_card), GFP_KERNEL)) == NULL)
878 continue; 867 continue;
879 868
880 card->number = csn; 869 card->number = csn;