aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2005-09-06 18:16:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:21 -0400
commita2822e7f00cdccbff8e507b5ebbddce1aa95eb5d (patch)
tree07ac5760bb7771744daa59b759c34190fb39f3ae /drivers/pnp/pnpacpi
parentea2f1590aaffbd02f1850c19c3895ff4d092c6e0 (diff)
[PATCH] pnp: consolidate kmalloc wrappers
ISAPNP, PNPBIOS, and PNPACPI all had their own kmalloc wrappers that reimplemented kcalloc(). Remove the wrappers and just use kcalloc() directly. Note that this also removes the PNPBIOS error message when the kmalloc fails. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/core.c15
-rw-r--r--drivers/pnp/pnpacpi/pnpacpi.h1
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c18
3 files changed, 12 insertions, 22 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 8655dd2e5b83..d3d292ea5876 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -41,14 +41,6 @@ static inline int is_exclusive_device(struct acpi_device *dev)
41 return (!acpi_match_ids(dev, excluded_id_list)); 41 return (!acpi_match_ids(dev, excluded_id_list));
42} 42}
43 43
44void *pnpacpi_kmalloc(size_t size, int f)
45{
46 void *p = kmalloc(size, f);
47 if (p)
48 memset(p, 0, size);
49 return p;
50}
51
52/* 44/*
53 * Compatible Device IDs 45 * Compatible Device IDs
54 */ 46 */
@@ -143,7 +135,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
143 return 0; 135 return 0;
144 136
145 pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); 137 pnp_dbg("ACPI device : hid %s", acpi_device_hid(device));
146 dev = pnpacpi_kmalloc(sizeof(struct pnp_dev), GFP_KERNEL); 138 dev = kcalloc(1, sizeof(struct pnp_dev), GFP_KERNEL);
147 if (!dev) { 139 if (!dev) {
148 pnp_err("Out of memory"); 140 pnp_err("Out of memory");
149 return -ENOMEM; 141 return -ENOMEM;
@@ -173,7 +165,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
173 dev->number = num; 165 dev->number = num;
174 166
175 /* set the initial values for the PnP device */ 167 /* set the initial values for the PnP device */
176 dev_id = pnpacpi_kmalloc(sizeof(struct pnp_id), GFP_KERNEL); 168 dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
177 if (!dev_id) 169 if (!dev_id)
178 goto err; 170 goto err;
179 pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id); 171 pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id);
@@ -205,8 +197,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
205 for (i = 0; i < cid_list->count; i++) { 197 for (i = 0; i < cid_list->count; i++) {
206 if (!ispnpidacpi(cid_list->id[i].value)) 198 if (!ispnpidacpi(cid_list->id[i].value))
207 continue; 199 continue;
208 dev_id = pnpacpi_kmalloc(sizeof(struct pnp_id), 200 dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
209 GFP_KERNEL);
210 if (!dev_id) 201 if (!dev_id)
211 continue; 202 continue;
212 203
diff --git a/drivers/pnp/pnpacpi/pnpacpi.h b/drivers/pnp/pnpacpi/pnpacpi.h
index 76f907e09ee6..f28e2ed66fa3 100644
--- a/drivers/pnp/pnpacpi/pnpacpi.h
+++ b/drivers/pnp/pnpacpi/pnpacpi.h
@@ -5,7 +5,6 @@
5#include <linux/acpi.h> 5#include <linux/acpi.h>
6#include <linux/pnp.h> 6#include <linux/pnp.h>
7 7
8void *pnpacpi_kmalloc(size_t size, int f);
9acpi_status pnpacpi_parse_allocated_resource(acpi_handle, struct pnp_resource_table*); 8acpi_status pnpacpi_parse_allocated_resource(acpi_handle, struct pnp_resource_table*);
10acpi_status pnpacpi_parse_resource_option_data(acpi_handle, struct pnp_dev*); 9acpi_status pnpacpi_parse_resource_option_data(acpi_handle, struct pnp_dev*);
11int pnpacpi_encode_resources(struct pnp_resource_table *, struct acpi_buffer *); 10int pnpacpi_encode_resources(struct pnp_resource_table *, struct acpi_buffer *);
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 75575f6c349c..675b76a42403 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -244,7 +244,7 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
244 244
245 if (p->number_of_channels == 0) 245 if (p->number_of_channels == 0)
246 return; 246 return;
247 dma = pnpacpi_kmalloc(sizeof(struct pnp_dma), GFP_KERNEL); 247 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL);
248 if (!dma) 248 if (!dma)
249 return; 249 return;
250 250
@@ -300,7 +300,7 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
300 300
301 if (p->number_of_interrupts == 0) 301 if (p->number_of_interrupts == 0)
302 return; 302 return;
303 irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); 303 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
304 if (!irq) 304 if (!irq)
305 return; 305 return;
306 306
@@ -321,7 +321,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
321 321
322 if (p->number_of_interrupts == 0) 322 if (p->number_of_interrupts == 0)
323 return; 323 return;
324 irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); 324 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
325 if (!irq) 325 if (!irq)
326 return; 326 return;
327 327
@@ -342,7 +342,7 @@ pnpacpi_parse_port_option(struct pnp_option *option,
342 342
343 if (io->range_length == 0) 343 if (io->range_length == 0)
344 return; 344 return;
345 port = pnpacpi_kmalloc(sizeof(struct pnp_port), GFP_KERNEL); 345 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
346 if (!port) 346 if (!port)
347 return; 347 return;
348 port->min = io->min_base_address; 348 port->min = io->min_base_address;
@@ -363,7 +363,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
363 363
364 if (io->range_length == 0) 364 if (io->range_length == 0)
365 return; 365 return;
366 port = pnpacpi_kmalloc(sizeof(struct pnp_port), GFP_KERNEL); 366 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
367 if (!port) 367 if (!port)
368 return; 368 return;
369 port->min = port->max = io->base_address; 369 port->min = port->max = io->base_address;
@@ -382,7 +382,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
382 382
383 if (p->range_length == 0) 383 if (p->range_length == 0)
384 return; 384 return;
385 mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); 385 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
386 if (!mem) 386 if (!mem)
387 return; 387 return;
388 mem->min = p->min_base_address; 388 mem->min = p->min_base_address;
@@ -405,7 +405,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
405 405
406 if (p->range_length == 0) 406 if (p->range_length == 0)
407 return; 407 return;
408 mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); 408 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
409 if (!mem) 409 if (!mem)
410 return; 410 return;
411 mem->min = p->min_base_address; 411 mem->min = p->min_base_address;
@@ -428,7 +428,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
428 428
429 if (p->range_length == 0) 429 if (p->range_length == 0)
430 return; 430 return;
431 mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); 431 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
432 if (!mem) 432 if (!mem)
433 return; 433 return;
434 mem->min = mem->max = p->range_base_address; 434 mem->min = mem->max = p->range_base_address;
@@ -612,7 +612,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
612 if (!res_cnt) 612 if (!res_cnt)
613 return -EINVAL; 613 return -EINVAL;
614 buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1; 614 buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1;
615 buffer->pointer = pnpacpi_kmalloc(buffer->length - 1, GFP_KERNEL); 615 buffer->pointer = kcalloc(1, buffer->length - 1, GFP_KERNEL);
616 if (!buffer->pointer) 616 if (!buffer->pointer)
617 return -ENOMEM; 617 return -ENOMEM;
618 pnp_dbg("Res cnt %d", res_cnt); 618 pnp_dbg("Res cnt %d", res_cnt);