Skip to contentSkip to conversation

cbus: fix compilation with current mainline

PATCH In review Felipe Balbi 5 participants 10 messages May 1, 2010 – May 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cbus: fix compilation with current mainline

From: Felipe Balbi <[email protected]>

commit 5a0e3ad6af8660be21ca98a971cd00f331318c05 broke compilation of the retu-pwrbutton driver when it dropped implicit inclusion of slab.h and gfp.h.

Fix it by including slab.h on retu-pwrbutton.c, while at that, also include slab.h on retu-rtc.c to avoid later problems with implicit inclusion of that being dropped.

Compile tested with n770_defconfig and n8x0_defconfig

---
 drivers/cbus/retu-pwrbutton.c |    1 +
 drivers/cbus/retu-rtc.c       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/cbus/retu-pwrbutton.c +1 -0
index 2d8cf40..f0cd056 100644
@@ -34,6 +34,7 @@
 #include <linux/jiffies.h>
 #include <linux/bitops.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 
 #include "retu.h"
 
drivers/cbus/retu-rtc.c +1 -0
index b0a0f3d..b3974e2 100644
@@ -36,6 +36,7 @@
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/completion.h>
 #include <linux/platform_device.h>
Signature · 1 line
1.7.1.rc2.7.g3e7f1
#1 lore raw

PATCH 2/2 cbus: switch kmalloc() + memset() to kzalloc()

From: Felipe Balbi <[email protected]>

no functional changes, just using kzalloc().

compile tested with n8x0_defconfig and n770_defconfig

---
 drivers/cbus/retu-user.c  |    6 +++---
 drivers/cbus/tahvo-usb.c  |    4 ++--
 drivers/cbus/tahvo-user.c |    6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/cbus/retu-user.c +3 -3
index 1a29492..953d92a 100644
@@ -382,12 +382,12 @@ int retu_user_init(void)
 	struct retu_irq *irq;
 	int res, i;
 
-	irq = kmalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL);
+	irq = kzalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL);
 	if (irq == NULL) {
-		printk(KERN_ERR PFX "kmalloc failed\n");
+		printk(KERN_ERR PFX "kzalloc failed\n");
 		return -ENOMEM;
 	}
-	memset(irq, 0, sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN);
+
 	for (i = 0; i < RETU_MAX_IRQ_BUF_LEN; i++)
 		list_add(&irq[i].node, &retu_irqs_reserve);
 
drivers/cbus/tahvo-usb.c +2 -2
index ef9fc37..5a344b6 100644
@@ -655,10 +655,10 @@ static int tahvo_usb_probe(struct device *dev)
 	dev_dbg(dev, "probe\n");
 
 	/* Create driver data */
-	tu = kmalloc(sizeof(*tu), GFP_KERNEL);
+	tu = kzalloc(sizeof(*tu), GFP_KERNEL);
 	if (!tu)
 		return -ENOMEM;
-	memset(tu, 0, sizeof(*tu));
+
 	tu->pt_dev = container_of(dev, struct platform_device, dev);
 #ifdef CONFIG_USB_OTG
 	/* Default mode */
drivers/cbus/tahvo-user.c +3 -3
index 01e7f20..bd30f06 100644
@@ -364,12 +364,12 @@ int tahvo_user_init(void)
 	struct tahvo_irq *irq;
 	int res, i;
 
-	irq = kmalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL);
+	irq = kzalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL);
 	if (irq == NULL) {
-		printk(KERN_ERR PFX "kmalloc failed\n");
+		printk(KERN_ERR PFX "kzalloc failed\n");
 		return -ENOMEM;
 	}
-	memset(irq, 0, sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN);
+
 	for (i = 0; i < TAHVO_MAX_IRQ_BUF_LEN; i++)
 		list_add(&irq[i].node, &tahvo_irqs_reserve);
 
Signature · 1 line
1.7.1.rc2.7.g3e7f1
Acked-by on v1 2/2
#2 lore raw

Re: [CBUS PATCH 2/2] cbus: switch kmalloc() + memset() to kzalloc()

Quoted 4 lines · On Sat, 1 May 2010 21:01:10 +0300 Felipe Balbi <[email protected]> wrote:

From: Felipe Balbi <[email protected]>

no functional changes, just using kzalloc().

Quoted 9 lines

compile tested with n8x0_defconfig and n770_defconfig

---
 drivers/cbus/retu-user.c  |    6 +++---
 drivers/cbus/tahvo-usb.c  |    4 ++--
 drivers/cbus/tahvo-user.c |    6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)
#3 lore raw

PATCH 2/2 cbus: switch kmalloc() + memset() to kzalloc()

In reply to Felipe Balbi

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: cbus

Initial commit ID (Likely to change): 749c6d8eaac8cd49b3d53eb7fb708ce61787a3a1

PatchWorks
http://patchwork.kernel.org/patch/96299/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=749c6d8eaac8cd49b3d53eb7fb708ce61787a3a1

Acked-by on v1 1/2
#4 lore raw
In reply to Felipe Balbi
Quoted 10 lines · On Sat, 1 May 2010 21:01:09 +0300 Felipe Balbi <[email protected]> wrote:

From: Felipe Balbi <[email protected]>

commit 5a0e3ad6af8660be21ca98a971cd00f331318c05 broke compilation of the retu-pwrbutton driver when it dropped implicit inclusion of slab.h and gfp.h.

Fix it by including slab.h on retu-pwrbutton.c, while at that, also include slab.h on retu-rtc.c to avoid later problems with implicit inclusion of that being dropped.

Quoted 8 lines

Compile tested with n770_defconfig and n8x0_defconfig

---
 drivers/cbus/retu-pwrbutton.c |    1 +
 drivers/cbus/retu-rtc.c       |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
#5 lore raw

PATCH 1/2 cbus: fix compilation with current mainline

In reply to Felipe Balbi

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: cbus

Initial commit ID (Likely to change): f746c048052046009eafd6f71041204967e231a3

PatchWorks
http://patchwork.kernel.org/patch/96298/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=f746c048052046009eafd6f71041204967e231a3

#6 lore raw

PATCH 1/1 CBUS: Fix broken compilation

In reply to Felipe Balbi

Include explicitly slab.h in:
drivers/cbus/cbus.c
drivers/cbus/retu-headset.c
drivers/cbus/retu-user.c
drivers/cbus/retu-wdt.c
drivers/cbus/tahvo-user.c

Compile tested with n8x0_defconfig

---
 drivers/cbus/cbus.c         |    1 +
 drivers/cbus/retu-headset.c |    1 +
 drivers/cbus/retu-user.c    |    1 +
 drivers/cbus/retu-wdt.c     |    1 +
 drivers/cbus/tahvo-user.c   |    1 +
 5 files changed, 5 insertions(+), 0 deletions(-)
drivers/cbus/cbus.c +1 -0
index 00c3c32..2c74d6e 100644
@@ -30,6 +30,7 @@
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 
 #include <asm/io.h>
 #include <asm/mach-types.h>
drivers/cbus/retu-headset.c +1 -0
index e798bc2..645679c 100644
@@ -25,6 +25,7 @@
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 
 #include "retu.h"
 
drivers/cbus/retu-user.c +1 -0
index 0f35dc5..7bc97d4 100644
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>
 
 #include <asm/uaccess.h>
 
drivers/cbus/retu-wdt.c +1 -0
index 35932dd..fda8b35 100644
@@ -35,6 +35,7 @@
 #include <linux/platform_device.h>
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
+#include <linux/slab.h>
 
 #include <asm/uaccess.h>
 
drivers/cbus/tahvo-user.c +1 -0
index c0e8daf..b28b015 100644
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>
 
 #include <asm/uaccess.h>
 
Signature · 1 line
1.5.6.5
#7 lore raw

Re: [CBUS PATCH 1/1] CBUS: Fix broken compilation

Quoted 10 lines · Carlos Chinea

Include explicitly slab.h in:
drivers/cbus/cbus.c
drivers/cbus/retu-headset.c
drivers/cbus/retu-user.c
drivers/cbus/retu-wdt.c
drivers/cbus/tahvo-user.c

Compile tested with n8x0_defconfig

do you need to update your tree ? tony applied a patch from me already, or did I miss something else ? I'm sure I compile with n770_defconf and n8x0_defconfig.

Signature · 1 line
balbi
#8 lore raw

Re: [CBUS PATCH 1/1] CBUS: Fix broken compilation

In reply to Carlos Chinea

hi again,

Quoted 10 lines · Chinea Carlos (Nokia-D/Helsinki)

Include explicitly slab.h in:
drivers/cbus/cbus.c
drivers/cbus/retu-headset.c
drivers/cbus/retu-user.c
drivers/cbus/retu-wdt.c
drivers/cbus/tahvo-user.c

Compile tested with n8x0_defconfig

I see now the problem.

Quoted 13 lines

---

drivers/cbus/cbus.c         |    1 +
drivers/cbus/retu-headset.c |    1 +
drivers/cbus/retu-user.c    |    1 +
drivers/cbus/retu-wdt.c     |    1 +
drivers/cbus/tahvo-user.c   |    1 +
5 files changed, 5 insertions(+), 0 deletions(-)
drivers/cbus/cbus.c +0 -0
index 00c3c32..2c74d6e 100644

drivers/cbus/cbus.c line 33

Quoted 4 lines
drivers/cbus/cbus.c +1 -0
@@ -30,6 +30,7 @@
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>

this is already included in line 32 of that file.

drivers/cbus/retu-headset.c line 28

Quoted 9 lines
drivers/cbus/retu-headset.c +1 -0
index e798bc2..645679c 100644
@@ -25,6 +25,7 @@
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>

already on line 25, right above #include <linux/delay.h>

drivers/cbus/retu-user.c line 36

Quoted 9 lines
drivers/cbus/retu-user.c +1 -0
index 0f35dc5..7bc97d4 100644
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>

already on line 26

drivers/cbus/retu-wdt.c line 38

Quoted 9 lines
drivers/cbus/retu-wdt.c +1 -0
index 35932dd..fda8b35 100644
@@ -35,6 +35,7 @@
 #include <linux/platform_device.h>
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
+#include <linux/slab.h>

already on line 25

drivers/cbus/tahvo-user.c line 36

Quoted 9 lines
drivers/cbus/tahvo-user.c +1 -0
index c0e8daf..b28b015 100644
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>

already on line 26.

NAK to this patch.

Signature · 3 lines
balbi

DefectiveByDesign.org
#9 lore raw

Re: [CBUS PATCH 1/1] CBUS: Fix broken compilation

Ok, sorry for the noise. I missed Alexander Shishkin patch which took care of this already.

Quoted 87 lines · Balbi Felipe (Nokia-D/Helsinki)

hi again,

Quoted 10 lines · Chinea Carlos (Nokia-D/Helsinki)

Include explicitly slab.h in:
drivers/cbus/cbus.c
drivers/cbus/retu-headset.c
drivers/cbus/retu-user.c
drivers/cbus/retu-wdt.c
drivers/cbus/tahvo-user.c

Compile tested with n8x0_defconfig

I see now the problem.

Quoted 13 lines

---

drivers/cbus/cbus.c         |    1 +
drivers/cbus/retu-headset.c |    1 +
drivers/cbus/retu-user.c    |    1 +
drivers/cbus/retu-wdt.c     |    1 +
drivers/cbus/tahvo-user.c   |    1 +
5 files changed, 5 insertions(+), 0 deletions(-)
drivers/cbus/cbus.c +0 -0
index 00c3c32..2c74d6e 100644

drivers/cbus/cbus.c line 33

Quoted 4 lines
drivers/cbus/cbus.c +1 -0
@@ -30,6 +30,7 @@
 #include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>

this is already included in line 32 of that file.

drivers/cbus/retu-headset.c line 28

Quoted 9 lines
drivers/cbus/retu-headset.c +1 -0
index e798bc2..645679c 100644
@@ -25,6 +25,7 @@
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>

already on line 25, right above #include <linux/delay.h>

drivers/cbus/retu-user.c line 36

Quoted 9 lines
drivers/cbus/retu-user.c +1 -0
index 0f35dc5..7bc97d4 100644
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>

already on line 26

drivers/cbus/retu-wdt.c line 38

Quoted 9 lines
drivers/cbus/retu-wdt.c +1 -0
index 35932dd..fda8b35 100644
@@ -35,6 +35,7 @@
 #include <linux/platform_device.h>
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
+#include <linux/slab.h>

already on line 25

drivers/cbus/tahvo-user.c line 36

Quoted 9 lines
drivers/cbus/tahvo-user.c +1 -0
index c0e8daf..b28b015 100644
@@ -33,6 +33,7 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 #include <linux/mutex.h>
+#include <linux/slab.h>

already on line 26.

NAK to this patch.

Signature · 1 line
Carlos Chinea <[email protected]>