2019-11-24 09:44:48

by Phong Tran

[permalink] [raw]
Subject: [PATCH 0/5] Fix -Wcast-function-type net drivers

This series is for fixing the compiler warning while enable
-Wcast-function-type.

Almost is incompatible callback prototype in using tasklet.
The void (*func)(unsigned long) instead of void (*func)(struct foo*).

Reported by: https://github.com/KSPP/linux/issues/20

Phong Tran (5):
drivers: net: hso: Fix -Wcast-function-type
drivers: net: usbnet: Fix -Wcast-function-type
drivers: net: b43legacy: Fix -Wcast-function-type
drivers: net: intel: Fix -Wcast-function-type
drivers: net: realtek: Fix -Wcast-function-type

drivers/net/usb/hso.c | 5 +++--
drivers/net/usb/usbnet.c | 8 +++++++-
drivers/net/wireless/broadcom/b43legacy/main.c | 5 +++--
drivers/net/wireless/intel/ipw2x00/ipw2100.c | 7 ++++---
drivers/net/wireless/intel/ipw2x00/ipw2200.c | 5 +++--
drivers/net/wireless/intel/iwlegacy/3945-mac.c | 5 +++--
drivers/net/wireless/intel/iwlegacy/4965-mac.c | 5 +++--
drivers/net/wireless/realtek/rtlwifi/pci.c | 10 ++++++----
8 files changed, 32 insertions(+), 18 deletions(-)

--
2.20.1


2019-11-24 09:44:50

by Phong Tran

[permalink] [raw]
Subject: [PATCH 1/5] drivers: net: hso: Fix -Wcast-function-type

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

Signed-off-by: Phong Tran <[email protected]>
---
drivers/net/usb/hso.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 74849da031fa..ca827802f291 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -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) {
--
2.20.1

2019-11-24 09:45:04

by Phong Tran

[permalink] [raw]
Subject: [PATCH 3/5] drivers: net: b43legacy: Fix -Wcast-function-type

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

Signed-off-by: Phong Tran <[email protected]>
---
drivers/net/wireless/broadcom/b43legacy/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c
index 4325e91736eb..8b6b657c4b85 100644
--- a/drivers/net/wireless/broadcom/b43legacy/main.c
+++ b/drivers/net/wireless/broadcom/b43legacy/main.c
@@ -1275,8 +1275,9 @@ static void handle_irq_ucode_debug(struct b43legacy_wldev *dev)
}

/* Interrupt handler bottom-half */
-static void b43legacy_interrupt_tasklet(struct b43legacy_wldev *dev)
+static void b43legacy_interrupt_tasklet(unsigned long data)
{
+ struct b43legacy_wldev *dev = (struct b43legacy_wldev *)data;
u32 reason;
u32 dma_reason[ARRAY_SIZE(dev->dma_reason)];
u32 merged_dma_reason = 0;
@@ -3741,7 +3742,7 @@ static int b43legacy_one_core_attach(struct ssb_device *dev,
b43legacy_set_status(wldev, B43legacy_STAT_UNINIT);
wldev->bad_frames_preempt = modparam_bad_frames_preempt;
tasklet_init(&wldev->isr_tasklet,
- (void (*)(unsigned long))b43legacy_interrupt_tasklet,
+ b43legacy_interrupt_tasklet,
(unsigned long)wldev);
if (modparam_pio)
wldev->__using_pio = true;
--
2.20.1

2019-11-25 18:56:11

by Larry Finger

[permalink] [raw]
Subject: Re: [PATCH 3/5] drivers: net: b43legacy: Fix -Wcast-function-type

On 11/24/19 3:43 AM, Phong Tran wrote:
> correct usage prototype of callback in tasklet_init().
> Report by https://github.com/KSPP/linux/issues/20
>
> Signed-off-by: Phong Tran <[email protected]>
> ---
> drivers/net/wireless/broadcom/b43legacy/main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

The subject should be "b43legacy: .....". Otherwise it is OK.

Tested-by: Larry Finger <[email protected]>

Larry

>
> diff --git a/drivers/net/wireless/broadcom/b43legacy/main.c b/drivers/net/wireless/broadcom/b43legacy/main.c
> index 4325e91736eb..8b6b657c4b85 100644
> --- a/drivers/net/wireless/broadcom/b43legacy/main.c
> +++ b/drivers/net/wireless/broadcom/b43legacy/main.c
> @@ -1275,8 +1275,9 @@ static void handle_irq_ucode_debug(struct b43legacy_wldev *dev)
> }
>
> /* Interrupt handler bottom-half */
> -static void b43legacy_interrupt_tasklet(struct b43legacy_wldev *dev)
> +static void b43legacy_interrupt_tasklet(unsigned long data)
> {
> + struct b43legacy_wldev *dev = (struct b43legacy_wldev *)data;
> u32 reason;
> u32 dma_reason[ARRAY_SIZE(dev->dma_reason)];
> u32 merged_dma_reason = 0;
> @@ -3741,7 +3742,7 @@ static int b43legacy_one_core_attach(struct ssb_device *dev,
> b43legacy_set_status(wldev, B43legacy_STAT_UNINIT);
> wldev->bad_frames_preempt = modparam_bad_frames_preempt;
> tasklet_init(&wldev->isr_tasklet,
> - (void (*)(unsigned long))b43legacy_interrupt_tasklet,
> + b43legacy_interrupt_tasklet,
> (unsigned long)wldev);
> if (modparam_pio)
> wldev->__using_pio = true;
>