aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
committerLen Brown <len.brown@intel.com>2005-09-08 01:45:47 -0400
commit64e47488c913ac704d465a6af86a26786d1412a5 (patch)
treed3b0148592963dcde26e4bb35ddfec8b1eaf8e23 /drivers/pnp/pnpacpi
parent4a35a46bf1cda4737c428380d1db5d15e2590d18 (diff)
parentcaf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff)
Merge linux-2.6 with linux-acpi-2.6
Diffstat (limited to 'drivers/pnp/pnpacpi')
-rw-r--r--drivers/pnp/pnpacpi/core.c16
-rw-r--r--drivers/pnp/pnpacpi/pnpacpi.h1
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c18
3 files changed, 13 insertions, 22 deletions
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 8655dd2e5b83..1a8915e74160 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -19,6 +19,7 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#include <linux/config.h>
22#include <linux/acpi.h> 23#include <linux/acpi.h>
23#include <linux/pnp.h> 24#include <linux/pnp.h>
24#include <acpi/acpi_bus.h> 25#include <acpi/acpi_bus.h>
@@ -41,14 +42,6 @@ static inline int is_exclusive_device(struct acpi_device *dev)
41 return (!acpi_match_ids(dev, excluded_id_list)); 42 return (!acpi_match_ids(dev, excluded_id_list));
42} 43}
43 44
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/* 45/*
53 * Compatible Device IDs 46 * Compatible Device IDs
54 */ 47 */
@@ -143,7 +136,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
143 return 0; 136 return 0;
144 137
145 pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); 138 pnp_dbg("ACPI device : hid %s", acpi_device_hid(device));
146 dev = pnpacpi_kmalloc(sizeof(struct pnp_dev), GFP_KERNEL); 139 dev = kcalloc(1, sizeof(struct pnp_dev), GFP_KERNEL);
147 if (!dev) { 140 if (!dev) {
148 pnp_err("Out of memory"); 141 pnp_err("Out of memory");
149 return -ENOMEM; 142 return -ENOMEM;
@@ -173,7 +166,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
173 dev->number = num; 166 dev->number = num;
174 167
175 /* set the initial values for the PnP device */ 168 /* set the initial values for the PnP device */
176 dev_id = pnpacpi_kmalloc(sizeof(struct pnp_id), GFP_KERNEL); 169 dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
177 if (!dev_id) 170 if (!dev_id)
178 goto err; 171 goto err;
179 pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id); 172 pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id);
@@ -205,8 +198,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
205 for (i = 0; i < cid_list->count; i++) { 198 for (i = 0; i < cid_list->count; i++) {
206 if (!ispnpidacpi(cid_list->id[i].value)) 199 if (!ispnpidacpi(cid_list->id[i].value))
207 continue; 200 continue;
208 dev_id = pnpacpi_kmalloc(sizeof(struct pnp_id), 201 dev_id = kcalloc(1, sizeof(struct pnp_id), GFP_KERNEL);
209 GFP_KERNEL);
210 if (!dev_id) 202 if (!dev_id)
211 continue; 203 continue;
212 204
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 6db549c9480c..416d30debe6c 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -255,7 +255,7 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
255 255
256 if (p->number_of_channels == 0) 256 if (p->number_of_channels == 0)
257 return; 257 return;
258 dma = pnpacpi_kmalloc(sizeof(struct pnp_dma), GFP_KERNEL); 258 dma = kcalloc(1, sizeof(struct pnp_dma), GFP_KERNEL);
259 if (!dma) 259 if (!dma)
260 return; 260 return;
261 261
@@ -311,7 +311,7 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
311 311
312 if (p->number_of_interrupts == 0) 312 if (p->number_of_interrupts == 0)
313 return; 313 return;
314 irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); 314 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
315 if (!irq) 315 if (!irq)
316 return; 316 return;
317 317
@@ -332,7 +332,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
332 332
333 if (p->number_of_interrupts == 0) 333 if (p->number_of_interrupts == 0)
334 return; 334 return;
335 irq = pnpacpi_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); 335 irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL);
336 if (!irq) 336 if (!irq)
337 return; 337 return;
338 338
@@ -353,7 +353,7 @@ pnpacpi_parse_port_option(struct pnp_option *option,
353 353
354 if (io->range_length == 0) 354 if (io->range_length == 0)
355 return; 355 return;
356 port = pnpacpi_kmalloc(sizeof(struct pnp_port), GFP_KERNEL); 356 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
357 if (!port) 357 if (!port)
358 return; 358 return;
359 port->min = io->min_base_address; 359 port->min = io->min_base_address;
@@ -374,7 +374,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
374 374
375 if (io->range_length == 0) 375 if (io->range_length == 0)
376 return; 376 return;
377 port = pnpacpi_kmalloc(sizeof(struct pnp_port), GFP_KERNEL); 377 port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL);
378 if (!port) 378 if (!port)
379 return; 379 return;
380 port->min = port->max = io->base_address; 380 port->min = port->max = io->base_address;
@@ -393,7 +393,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
393 393
394 if (p->range_length == 0) 394 if (p->range_length == 0)
395 return; 395 return;
396 mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); 396 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
397 if (!mem) 397 if (!mem)
398 return; 398 return;
399 mem->min = p->min_base_address; 399 mem->min = p->min_base_address;
@@ -416,7 +416,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
416 416
417 if (p->range_length == 0) 417 if (p->range_length == 0)
418 return; 418 return;
419 mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); 419 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
420 if (!mem) 420 if (!mem)
421 return; 421 return;
422 mem->min = p->min_base_address; 422 mem->min = p->min_base_address;
@@ -439,7 +439,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
439 439
440 if (p->range_length == 0) 440 if (p->range_length == 0)
441 return; 441 return;
442 mem = pnpacpi_kmalloc(sizeof(struct pnp_mem), GFP_KERNEL); 442 mem = kcalloc(1, sizeof(struct pnp_mem), GFP_KERNEL);
443 if (!mem) 443 if (!mem)
444 return; 444 return;
445 mem->min = mem->max = p->range_base_address; 445 mem->min = mem->max = p->range_base_address;
@@ -623,7 +623,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
623 if (!res_cnt) 623 if (!res_cnt)
624 return -EINVAL; 624 return -EINVAL;
625 buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1; 625 buffer->length = sizeof(struct acpi_resource) * (res_cnt + 1) + 1;
626 buffer->pointer = pnpacpi_kmalloc(buffer->length - 1, GFP_KERNEL); 626 buffer->pointer = kcalloc(1, buffer->length - 1, GFP_KERNEL);
627 if (!buffer->pointer) 627 if (!buffer->pointer)
628 return -ENOMEM; 628 return -ENOMEM;
629 pnp_dbg("Res cnt %d", res_cnt); 629 pnp_dbg("Res cnt %d", res_cnt);