Skip to contentSkip to conversation

drivers: net: hso: Fix -Wcast-function-type

PATCH Superseded Phong Tran 2 participants 7 messages Nov 25, 2019 – Nov 26, 2019

Subsystems (6)
lore
Share & tools
lore

Phong Tran

author
#0 lore raw

PATCH v2 1/2 drivers: net: hso: Fix -Wcast-function-type

correct usage prototype of callback in tasklet_init(). Report by https://github.com/KSPP/linux/issues/20

---
 drivers/net/usb/hso.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/usb/hso.c +3 -2
index 74849da031fa..ca827802f291 100644
@@ -1214,8 +1214,9 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
  * This needs to be a tasklet otherwise we will
  * end up recursively calling this function.
  */
-static void hso_unthrottle_tasklet(struct hso_serial *serial)
+static void hso_unthrottle_tasklet(unsigned long data)
 {
+	struct hso_serial *serial = (struct hso_serial *)data;
 	unsigned long flags;
 
 	spin_lock_irqsave(&serial->serial_lock, flags);
@@ -1265,7 +1266,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
 		/* Force default termio settings */
 		_hso_serial_set_termios(tty, NULL);
 		tasklet_init(&serial->unthrottle_tasklet,
-			     (void (*)(unsigned long))hso_unthrottle_tasklet,
+			     hso_unthrottle_tasklet,
 			     (unsigned long)serial);
 		result = hso_start_serial_device(serial->parent, GFP_KERNEL);
 		if (result) {
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH v2 2/2 drivers: net: usbnet: Fix -Wcast-function-type

correct usage prototype of callback in tasklet_init(). Report by https://github.com/KSPP/linux/issues/20

---
 drivers/net/usb/usbnet.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/usb/usbnet.c +7 -1
index dde05e2fdc3e..d10a5e6d0917 100644
@@ -1573,6 +1573,12 @@ static void usbnet_bh (struct timer_list *t)
 	}
 }
 
+static void usbnet_bh_tasklet (unsigned long data)
+{
+	struct timer_list *t = (struct timer_list *)data;
+	usbnet_bh(t);
+}
+
 
 /*-------------------------------------------------------------------------
  *
@@ -1700,7 +1706,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	skb_queue_head_init (&dev->txq);
 	skb_queue_head_init (&dev->done);
 	skb_queue_head_init(&dev->rxq_pause);
-	dev->bh.func = (void (*)(unsigned long))usbnet_bh;
+	dev->bh.func = usbnet_bh_tasklet;
 	dev->bh.data = (unsigned long)&dev->delay;
 	INIT_WORK (&dev->kevent, usbnet_deferred_kevent);
 	init_usb_anchor(&dev->deferred);
Signature · 1 line
2.20.1
maintainer
#2 lore raw

Re: [PATCH 2/2] drivers: net: usbnet: Fix -Wcast-function-type

From: Phong Tran <[email protected]>
Date: Mon, 25 Nov 2019 21:54:43 +0700

drivers/net/usb/usbnet.c static void usbnet_bh (struct timer_list *t) · line 1576

Quoted 5 lines
drivers/net/usb/usbnet.c +1 -0
@@ -1573,6 +1573,12 @@ static void usbnet_bh (struct timer_list *t)
 	}
 }
 
+static void usbnet_bh_tasklet (unsigned long data)
                                ^

Please remove this space and resubmit the patch series.

author
#3 lore raw

v2 cover Fix -Wcast-function-type usb net drivers

Change log with v1:
- Modify suffix of patch subject.
- Did the checkpatch.pl (remove the space, add a blank line).

Phong Tran (2):
net: hso: Fix -Wcast-function-type
net: usbnet: Fix -Wcast-function-type

 drivers/net/usb/hso.c    | 5 +++--
 drivers/net/usb/usbnet.c | 9 ++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1
author
#4 lore raw

PATCH v2 1/2 net: hso: Fix -Wcast-function-type

correct usage prototype of callback in tasklet_init(). Report by https://github.com/KSPP/linux/issues/20

---
 drivers/net/usb/hso.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/usb/hso.c +3 -2
index 74849da031fa..ca827802f291 100644
@@ -1214,8 +1214,9 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
  * This needs to be a tasklet otherwise we will
  * end up recursively calling this function.
  */
-static void hso_unthrottle_tasklet(struct hso_serial *serial)
+static void hso_unthrottle_tasklet(unsigned long data)
 {
+	struct hso_serial *serial = (struct hso_serial *)data;
 	unsigned long flags;
 
 	spin_lock_irqsave(&serial->serial_lock, flags);
@@ -1265,7 +1266,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
 		/* Force default termio settings */
 		_hso_serial_set_termios(tty, NULL);
 		tasklet_init(&serial->unthrottle_tasklet,
-			     (void (*)(unsigned long))hso_unthrottle_tasklet,
+			     hso_unthrottle_tasklet,
 			     (unsigned long)serial);
 		result = hso_start_serial_device(serial->parent, GFP_KERNEL);
 		if (result) {
Signature · 1 line
2.20.1
author
#5 lore raw

PATCH v2 2/2 net: usbnet: Fix -Wcast-function-type

In reply to Phong Tran

correct usage prototype of callback in tasklet_init(). Report by https://github.com/KSPP/linux/issues/20

---
 drivers/net/usb/usbnet.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/usb/usbnet.c +8 -1
index dde05e2fdc3e..30e511c2c8d0 100644
@@ -1573,6 +1573,13 @@ static void usbnet_bh (struct timer_list *t)
 	}
 }
 
+static void usbnet_bh_tasklet(unsigned long data)
+{
+	struct timer_list *t = (struct timer_list *)data;
+
+	usbnet_bh(t);
+}
+
 
 /*-------------------------------------------------------------------------
  *
@@ -1700,7 +1707,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	skb_queue_head_init (&dev->txq);
 	skb_queue_head_init (&dev->done);
 	skb_queue_head_init(&dev->rxq_pause);
-	dev->bh.func = (void (*)(unsigned long))usbnet_bh;
+	dev->bh.func = usbnet_bh_tasklet;
 	dev->bh.data = (unsigned long)&dev->delay;
 	INIT_WORK (&dev->kevent, usbnet_deferred_kevent);
 	init_usb_anchor(&dev->deferred);
Signature · 1 line
2.20.1
maintainer
#6 lore raw

Re: [Patch v2 0/2] Fix -Wcast-function-type usb net drivers

In reply to Phong Tran

From: Phong Tran <[email protected]>
Date: Tue, 26 Nov 2019 20:54:11 +0700

Quoted 3 lines

Change log with v1:
- Modify suffix of patch subject.
- Did the checkpatch.pl (remove the space, add a blank line).

Series applied, thanks.