aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-03-24 06:15:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-24 10:33:18 -0500
commit88abaab4f9b08381e30e737980a1c49d6b524dfc (patch)
treed33aa82674c00c37cd293c9e888cff785880ce5a /drivers/s390/cio
parentfb630517f0d0736ea73af07d6b357be9ad67e6f1 (diff)
[PATCH] s390: kzalloc() conversion in drivers/s390
Convert all kmalloc + memset sequences in drivers/s390 to kzalloc usage. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r--drivers/s390/cio/ccwgroup.c3
-rw-r--r--drivers/s390/cio/chsc.c3
-rw-r--r--drivers/s390/cio/css.c3
-rw-r--r--drivers/s390/cio/device.c6
-rw-r--r--drivers/s390/cio/device_ops.c9
-rw-r--r--drivers/s390/cio/qdio.c20
6 files changed, 15 insertions, 29 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index 8013c8eb76fe..bdfee7fbaa2e 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -157,11 +157,10 @@ ccwgroup_create(struct device *root,
157 if (argc > 256) /* disallow dumb users */ 157 if (argc > 256) /* disallow dumb users */
158 return -EINVAL; 158 return -EINVAL;
159 159
160 gdev = kmalloc(sizeof(*gdev) + argc*sizeof(gdev->cdev[0]), GFP_KERNEL); 160 gdev = kzalloc(sizeof(*gdev) + argc*sizeof(gdev->cdev[0]), GFP_KERNEL);
161 if (!gdev) 161 if (!gdev)
162 return -ENOMEM; 162 return -ENOMEM;
163 163
164 memset(gdev, 0, sizeof(*gdev) + argc*sizeof(gdev->cdev[0]));
165 atomic_set(&gdev->onoff, 0); 164 atomic_set(&gdev->onoff, 0);
166 165
167 del_drvdata = 0; 166 del_drvdata = 0;
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 8b57fe62a9f9..6412b2c3edd3 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -1403,10 +1403,9 @@ new_channel_path(int chpid)
1403 struct channel_path *chp; 1403 struct channel_path *chp;
1404 int ret; 1404 int ret;
1405 1405
1406 chp = kmalloc(sizeof(struct channel_path), GFP_KERNEL); 1406 chp = kzalloc(sizeof(struct channel_path), GFP_KERNEL);
1407 if (!chp) 1407 if (!chp)
1408 return -ENOMEM; 1408 return -ENOMEM;
1409 memset(chp, 0, sizeof(struct channel_path));
1410 1409
1411 /* fill in status, etc. */ 1410 /* fill in status, etc. */
1412 chp->id = chpid; 1411 chp->id = chpid;
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
index 5b304dbacaeb..74ea8aac4b7d 100644
--- a/drivers/s390/cio/css.c
+++ b/drivers/s390/cio/css.c
@@ -630,10 +630,9 @@ css_enqueue_subchannel_slow(struct subchannel_id schid)
630 struct slow_subchannel *new_slow_sch; 630 struct slow_subchannel *new_slow_sch;
631 unsigned long flags; 631 unsigned long flags;
632 632
633 new_slow_sch = kmalloc(sizeof(struct slow_subchannel), GFP_ATOMIC); 633 new_slow_sch = kzalloc(sizeof(struct slow_subchannel), GFP_ATOMIC);
634 if (!new_slow_sch) 634 if (!new_slow_sch)
635 return -ENOMEM; 635 return -ENOMEM;
636 memset(new_slow_sch, 0, sizeof(struct slow_subchannel));
637 new_slow_sch->schid = schid; 636 new_slow_sch->schid = schid;
638 spin_lock_irqsave(&slow_subchannel_lock, flags); 637 spin_lock_irqsave(&slow_subchannel_lock, flags);
639 list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head); 638 list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index afc4e88551ad..8e3053c2a451 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -826,17 +826,15 @@ io_subchannel_probe (struct subchannel *sch)
826 get_device(&cdev->dev); 826 get_device(&cdev->dev);
827 return 0; 827 return 0;
828 } 828 }
829 cdev = kmalloc (sizeof(*cdev), GFP_KERNEL); 829 cdev = kzalloc (sizeof(*cdev), GFP_KERNEL);
830 if (!cdev) 830 if (!cdev)
831 return -ENOMEM; 831 return -ENOMEM;
832 memset(cdev, 0, sizeof(struct ccw_device)); 832 cdev->private = kzalloc(sizeof(struct ccw_device_private),
833 cdev->private = kmalloc(sizeof(struct ccw_device_private),
834 GFP_KERNEL | GFP_DMA); 833 GFP_KERNEL | GFP_DMA);
835 if (!cdev->private) { 834 if (!cdev->private) {
836 kfree(cdev); 835 kfree(cdev);
837 return -ENOMEM; 836 return -ENOMEM;
838 } 837 }
839 memset(cdev->private, 0, sizeof(struct ccw_device_private));
840 atomic_set(&cdev->private->onoff, 0); 838 atomic_set(&cdev->private->onoff, 0);
841 cdev->dev = (struct device) { 839 cdev->dev = (struct device) {
842 .parent = &sch->dev, 840 .parent = &sch->dev,
diff --git a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
index 3a50b1903287..795abb5a65ba 100644
--- a/drivers/s390/cio/device_ops.c
+++ b/drivers/s390/cio/device_ops.c
@@ -359,10 +359,9 @@ read_dev_chars (struct ccw_device *cdev, void **buffer, int length)
359 CIO_TRACE_EVENT (4, "rddevch"); 359 CIO_TRACE_EVENT (4, "rddevch");
360 CIO_TRACE_EVENT (4, sch->dev.bus_id); 360 CIO_TRACE_EVENT (4, sch->dev.bus_id);
361 361
362 rdc_ccw = kmalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); 362 rdc_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
363 if (!rdc_ccw) 363 if (!rdc_ccw)
364 return -ENOMEM; 364 return -ENOMEM;
365 memset(rdc_ccw, 0, sizeof(struct ccw1));
366 rdc_ccw->cmd_code = CCW_CMD_RDC; 365 rdc_ccw->cmd_code = CCW_CMD_RDC;
367 rdc_ccw->count = length; 366 rdc_ccw->count = length;
368 rdc_ccw->flags = CCW_FLAG_SLI; 367 rdc_ccw->flags = CCW_FLAG_SLI;
@@ -426,16 +425,14 @@ read_conf_data_lpm (struct ccw_device *cdev, void **buffer, int *length, __u8 lp
426 if (!ciw || ciw->cmd == 0) 425 if (!ciw || ciw->cmd == 0)
427 return -EOPNOTSUPP; 426 return -EOPNOTSUPP;
428 427
429 rcd_ccw = kmalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA); 428 rcd_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
430 if (!rcd_ccw) 429 if (!rcd_ccw)
431 return -ENOMEM; 430 return -ENOMEM;
432 memset(rcd_ccw, 0, sizeof(struct ccw1)); 431 rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
433 rcd_buf = kmalloc(ciw->count, GFP_KERNEL | GFP_DMA);
434 if (!rcd_buf) { 432 if (!rcd_buf) {
435 kfree(rcd_ccw); 433 kfree(rcd_ccw);
436 return -ENOMEM; 434 return -ENOMEM;
437 } 435 }
438 memset (rcd_buf, 0, ciw->count);
439 rcd_ccw->cmd_code = ciw->cmd; 436 rcd_ccw->cmd_code = ciw->cmd;
440 rcd_ccw->cda = (__u32) __pa (rcd_buf); 437 rcd_ccw->cda = (__u32) __pa (rcd_buf);
441 rcd_ccw->count = ciw->count; 438 rcd_ccw->count = ciw->count;
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c
index 9ed37dc9a1b0..814f9258ce00 100644
--- a/drivers/s390/cio/qdio.c
+++ b/drivers/s390/cio/qdio.c
@@ -1686,16 +1686,14 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
1686 int result=-ENOMEM; 1686 int result=-ENOMEM;
1687 1687
1688 for (i=0;i<no_input_qs;i++) { 1688 for (i=0;i<no_input_qs;i++) {
1689 q=kmalloc(sizeof(struct qdio_q),GFP_KERNEL); 1689 q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
1690 1690
1691 if (!q) { 1691 if (!q) {
1692 QDIO_PRINT_ERR("kmalloc of q failed!\n"); 1692 QDIO_PRINT_ERR("kmalloc of q failed!\n");
1693 goto out; 1693 goto out;
1694 } 1694 }
1695 1695
1696 memset(q,0,sizeof(struct qdio_q)); 1696 q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL);
1697
1698 q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
1699 if (!q->slib) { 1697 if (!q->slib) {
1700 QDIO_PRINT_ERR("kmalloc of slib failed!\n"); 1698 QDIO_PRINT_ERR("kmalloc of slib failed!\n");
1701 goto out; 1699 goto out;
@@ -1705,14 +1703,12 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
1705 } 1703 }
1706 1704
1707 for (i=0;i<no_output_qs;i++) { 1705 for (i=0;i<no_output_qs;i++) {
1708 q=kmalloc(sizeof(struct qdio_q),GFP_KERNEL); 1706 q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
1709 1707
1710 if (!q) { 1708 if (!q) {
1711 goto out; 1709 goto out;
1712 } 1710 }
1713 1711
1714 memset(q,0,sizeof(struct qdio_q));
1715
1716 q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL); 1712 q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
1717 if (!q->slib) { 1713 if (!q->slib) {
1718 QDIO_PRINT_ERR("kmalloc of slib failed!\n"); 1714 QDIO_PRINT_ERR("kmalloc of slib failed!\n");
@@ -2984,7 +2980,7 @@ qdio_allocate(struct qdio_initialize *init_data)
2984 qdio_allocate_do_dbf(init_data); 2980 qdio_allocate_do_dbf(init_data);
2985 2981
2986 /* create irq */ 2982 /* create irq */
2987 irq_ptr=kmalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA); 2983 irq_ptr = kzalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA);
2988 2984
2989 QDIO_DBF_TEXT0(0,setup,"irq_ptr:"); 2985 QDIO_DBF_TEXT0(0,setup,"irq_ptr:");
2990 QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*)); 2986 QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
@@ -2994,8 +2990,6 @@ qdio_allocate(struct qdio_initialize *init_data)
2994 return -ENOMEM; 2990 return -ENOMEM;
2995 } 2991 }
2996 2992
2997 memset(irq_ptr,0,sizeof(struct qdio_irq));
2998
2999 init_MUTEX(&irq_ptr->setting_up_sema); 2993 init_MUTEX(&irq_ptr->setting_up_sema);
3000 2994
3001 /* QDR must be in DMA area since CCW data address is only 32 bit */ 2995 /* QDR must be in DMA area since CCW data address is only 32 bit */
@@ -3686,10 +3680,10 @@ qdio_get_qdio_memory(void)
3686 3680
3687 for (i=1;i<INDICATORS_PER_CACHELINE;i++) 3681 for (i=1;i<INDICATORS_PER_CACHELINE;i++)
3688 indicator_used[i]=0; 3682 indicator_used[i]=0;
3689 indicators=(__u32*)kmalloc(sizeof(__u32)*(INDICATORS_PER_CACHELINE), 3683 indicators = kzalloc(sizeof(__u32)*(INDICATORS_PER_CACHELINE),
3690 GFP_KERNEL); 3684 GFP_KERNEL);
3691 if (!indicators) return -ENOMEM; 3685 if (!indicators)
3692 memset(indicators,0,sizeof(__u32)*(INDICATORS_PER_CACHELINE)); 3686 return -ENOMEM;
3693 return 0; 3687 return 0;
3694} 3688}
3695 3689