diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2005-09-06 15:16:51 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 16:57:21 -0700 |
commit | a2822e7f00cdccbff8e507b5ebbddce1aa95eb5d (patch) | |
tree | 07ac5760bb7771744daa59b759c34190fb39f3ae /drivers/pnp/pnpacpi | |
parent | ea2f1590aaffbd02f1850c19c3895ff4d092c6e0 (diff) | |
download | blackbird-op-linux-a2822e7f00cdccbff8e507b5ebbddce1aa95eb5d.tar.gz blackbird-op-linux-a2822e7f00cdccbff8e507b5ebbddce1aa95eb5d.zip |
[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.c | 15 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/pnpacpi.h | 1 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 18 |
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) return (!acpi_match_ids(dev, excluded_id_list)); } -void *pnpacpi_kmalloc(size_t size, int f) -{ - void *p = kmalloc(size, f); - if (p) - memset(p, 0, size); - return p; -} - /* * Compatible Device IDs */ @@ -143,7 +135,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) return 0; pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); - dev = pnpacpi_kmalloc(sizeof(struct pnp_dev), GFP_KERNEL); + dev = kcalloc(1, sizeof(struct pnp_dev), GFP_KERNEL); if (!dev) { pnp_err("Out of memory"); return -ENOMEM; @@ -173,7 +165,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) dev->number = num; /* set the initial values for the PnP device */ - dev_id = pnpacpi_kmalloc(sizeof(struct pnp_id), GFP_KERNEL); + dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); if (!dev_id) goto err; pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id); @@ -205,8 +197,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) for (i = 0; i < cid_list->count; i++) { if (!ispnpidacpi(cid_list->id[i].value)) continue; - dev_id = pnpacpi_kmalloc(sizeof(struct pnp_id), - GFP_KERNEL); + dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL); if (!dev_id) continue; 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 @@ #include <linux/acpi.h> #include <linux/pnp.h> -void *pnpacpi_kmalloc(size_t size, int f); acpi_status pnpacpi_parse_allocated_resource(acpi_handle, struct pnp_resource_table*); acpi_status pnpacpi_parse_resource_option_data(acpi_handle, struct pnp_dev*); int 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 if (p->number_of_channels == 0) return; - dma = pnpacpi_kmalloc(sizeof(struct pnp_dma), GFP_KERNEL); + dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL); if (!dma) return; @@ -300,7 +300,7 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option, if (p->number_of_interrupts == 0) return; - irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); + irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; @@ -321,7 +321,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, if (p->number_of_interrupts == 0) return; - irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); + irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); if (!irq) return; @@ -342,7 +342,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, if (io->range_length == 0) return; - port = pnpacpi_kmalloc(sizeof(struct pnp_port), GFP_KERNEL); + port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; port->min = io->min_base_address; @@ -363,7 +363,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, if (io->range_length == 0) return; - port = pnpacpi_kmalloc(sizeof(struct pnp_port), GFP_KERNEL); + port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); if (!port) return; port->min = port->max = io->base_address; @@ -382,7 +382,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, if (p->range_length == 0) return; - mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); + mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; mem->min = p->min_base_address; @@ -405,7 +405,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, if (p->range_length == 0) return; - mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); + mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; mem->min = p->min_base_address; @@ -428,7 +428,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, if (p->range_length == 0) return; - mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); + mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL); if (!mem) return; mem->min = mem->max = p->range_base_address; @@ -612,7 +612,7 @@ int pnpacpi_build_resource_template(acpi_handle handle, if (!res_cnt) return -EINVAL; buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1; - buffer->pointer = pnpacpi_kmalloc(buffer->length - 1, GFP_KERNEL); + buffer->pointer = kcalloc(1, buffer->length - 1, GFP_KERNEL); if (!buffer->pointer) return -ENOMEM; pnp_dbg("Res cnt %d", res_cnt); |