Skip to contentSkip to conversation

staging: r8188eu: remove unused efuse hal components

PATCH In review Martin Kaiser 4 participants 15 messages Aug 11, 2021 – Aug 14, 2021 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 staging: r8188eu: remove unused efuse hal components

struct hal_data_8188e contains some components related to efuses which are not used for rl8188eu.

---
 drivers/staging/r8188eu/include/rtl8188e_hal.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -3
index ea879572d6e1..3939bf053de1 100644
@@ -263,9 +263,6 @@ struct hal_data_8188e {
 	u8	bAPKThermalMeterIgnore;
 
 	bool	EepromOrEfuse;
-	/* 92C:256bytes, 88E:512bytes, we use union set (512bytes) */
-	u8	EfuseMap[2][HWSET_MAX_SIZE_512];
-	u8	EfuseUsedPercentage;
 	struct efuse_hal	EfuseHal;
 
 	u8	Index24G_CCK_Base[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/5 staging: r8188eu: remove unused function parameters

rtw_usb_if1_init and chip_by_usb_id do not need a
struct usb_device_id parameter.

---
 drivers/staging/r8188eu/os_dep/usb_intf.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/r8188eu/os_dep/usb_intf.c +4 -5
index 8f1e33d2fff7..4bf89b78a74a 100644
@@ -250,8 +250,7 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
 
 }
 
-static void chip_by_usb_id(struct adapter *padapter,
-			   const struct usb_device_id *pdid)
+static void chip_by_usb_id(struct adapter *padapter)
 {
 	padapter->chip_type = NULL_CHIP_TYPE;
 	hal_set_hw_type(padapter);
@@ -569,7 +568,7 @@ int rtw_resume_process(struct adapter *padapter)
  */
 
 static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
-	struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
+	struct usb_interface *pusb_intf)
 {
 	struct adapter *padapter = NULL;
 	struct net_device *pnetdev = NULL;
@@ -587,7 +586,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
 
 	/* step 1-1., decide the chip_type via vid/pid */
 	padapter->interface_type = RTW_USB;
-	chip_by_usb_id(padapter, pdid);
+	chip_by_usb_id(padapter);
 
 	if (rtw_handle_dualmac(padapter, 1) != _SUCCESS)
 		goto free_adapter;
@@ -722,7 +721,7 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
 	if (!dvobj)
 		goto exit;
 
-	if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid);
+	if1 = rtw_usb_if1_init(dvobj, pusb_intf);
 	if (!if1) {
 		DBG_88E("rtw_init_primarystruct adapter Failed!\n");
 		goto free_dvobj;
Signature · 1 line
2.20.1
Acked-by on v1 2/5
#2 lore raw

Re: [PATCH 2/5] staging: r8188eu: remove unused function parameters

Quoted 51 lines · Martin Kaiser

rtw_usb_if1_init and chip_by_usb_id do not need a
struct usb_device_id parameter.

---
 drivers/staging/r8188eu/os_dep/usb_intf.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/r8188eu/os_dep/usb_intf.c +4 -6
index 8f1e33d2fff7..4bf89b78a74a 100644
@@ -250,8 +250,7 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
 
 }
 
-static void chip_by_usb_id(struct adapter *padapter,
-                          const struct usb_device_id *pdid)
+static void chip_by_usb_id(struct adapter *padapter)
 {
        padapter->chip_type = NULL_CHIP_TYPE;
        hal_set_hw_type(padapter);
@@ -569,7 +568,7 @@ int rtw_resume_process(struct adapter *padapter)
  */
 
 static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
-       struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
+       struct usb_interface *pusb_intf)
 {
        struct adapter *padapter = NULL;
        struct net_device *pnetdev = NULL;
@@ -587,7 +586,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
 
        /* step 1-1., decide the chip_type via vid/pid */
        padapter->interface_type = RTW_USB;
-       chip_by_usb_id(padapter, pdid);
+       chip_by_usb_id(padapter);
 
        if (rtw_handle_dualmac(padapter, 1) != _SUCCESS)
                goto free_adapter;
@@ -722,7 +721,7 @@ static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device
        if (!dvobj)
                goto exit;
 
-       if1 = rtw_usb_if1_init(dvobj, pusb_intf, pdid);
+       if1 = rtw_usb_if1_init(dvobj, pusb_intf);
        if (!if1) {
                DBG_88E("rtw_init_primarystruct adapter Failed!\n");
                goto free_dvobj;
--
Quoted 2 lines

2.20.1

Dear Martin,

Looks good.

Regards,
Phil

#3 lore raw

PATCH 3/5 staging: r8188eu: (trivial) remove a duplicate debug print

In reply to Martin Kaiser

Keep the one that shows the wakeup capability.

---
 drivers/staging/r8188eu/os_dep/usb_intf.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/os_dep/usb_intf.c +0 -1
index 4bf89b78a74a..6e4bf623f788 100644
@@ -624,7 +624,6 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
 		dvobj->pusbdev->do_remote_wakeup = 1;
 		pusb_intf->needs_remote_wakeup = 1;
 		device_init_wakeup(&pusb_intf->dev, 1);
-		DBG_88E("\n  padapter->pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n");
 		DBG_88E("\n  padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n",
 			device_may_wakeup(&pusb_intf->dev));
 	}
Signature · 1 line
2.20.1
#4 lore raw

Re: [PATCH 3/5] staging: r8188eu: (trivial) remove a duplicate debug print

Quoted 21 lines · Martin Kaiser

Keep the one that shows the wakeup capability.

---
 drivers/staging/r8188eu/os_dep/usb_intf.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/r8188eu/os_dep/usb_intf.c +0 -2
index 4bf89b78a74a..6e4bf623f788 100644
@@ -624,7 +624,6 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
                dvobj->pusbdev->do_remote_wakeup = 1;
                pusb_intf->needs_remote_wakeup = 1;
                device_init_wakeup(&pusb_intf->dev, 1);
-               DBG_88E("\n  padapter->pwrctrlpriv.bSupportRemoteWakeup~~~~~~\n");
                DBG_88E("\n  padapter->pwrctrlpriv.bSupportRemoteWakeup~~~[%d]~~~\n",
                        device_may_wakeup(&pusb_intf->dev));
        }
--
Quoted 2 lines

2.20.1

Dear Martin,

Just my personal opinion, but I'd be inclined to strip out all DBG_88E calls totally. If there are necessary functions being called such as device_may_wakeup() we can always just keep this part and remove the macro call (not checked this function out myself yet). Thanks.

Regards,
Phil

#5 lore raw

Re: [PATCH 3/5] staging: r8188eu: (trivial) remove a duplicate debug print

Quoted 4 lines · Phillip Potter
Quoted 3 lines · Martin Kaiser

Keep the one that shows the wakeup capability.

Please think of the subject and the commit message as two different things. Often it's people reviewing on email will only read one or the other. In other words just restate the subject:

These two debug messages have the same information. Delete the less informative one and keep the other.

Quoted 7 lines

Dear Martin,

Just my personal opinion, but I'd be inclined to strip out all DBG_88E calls totally. If there are necessary functions being called such as device_may_wakeup() we can always just keep this part and remove the macro call (not checked this function out myself yet). Thanks.

Yeah. I agree. The DBG_88E() doesn't call device_may_wakeup() unless the module is loaded with a high enough value "rtw_debug" module option so hopefully device_may_wakeup() does not have side effects. (It does not).

Thanks for reviewing these patches. I do think it's nice to have positive reviews instead of just me complaining and pointing out the negative things. We are trying to get code merged, not trying to put up roadblocks so maybe encouraging more Acked-by reviews is a good thing...

regards,
dan carpenter

#6 lore raw

Re: [PATCH 3/5] staging: r8188eu: (trivial) remove a duplicate debug print

Hi Dan and Phil,

Thus wrote Dan Carpenter ([email protected]):

Quoted 3 lines

Please think of the subject and the commit message as two different things. Often it's people reviewing on email will only read one or the other. In other words just restate the subject:

ok, I'll keep that in mind for further patches.

Quoted 6 lines
Quoted 6 lines

Dear Martin,

Just my personal opinion, but I'd be inclined to strip out all DBG_88E calls totally. If there are necessary functions being called such as device_may_wakeup() we can always just keep this part and remove the macro call (not checked this function out myself yet). Thanks.

I'd agree with you, Phil. Most DBG_88E prints don't say anything useful.

This comment from Greg made me drop the DBG_88E removal for now

https://lore.kernel.org/linux-staging/[email protected]/T/#m05d82a0ca8ed36180ebdc987114b4d892445c52d

A compromise would be to remove only those DBG_88E prints which are really not helpful.

Best regards,
Martin

#7 lore raw

Re: [PATCH 3/5] staging: r8188eu: (trivial) remove a duplicate debug print

Quoted 16 lines · CEST Martin Kaiser

Hi Dan and Phil,

Thus wrote Dan Carpenter ([email protected]):

Quoted 4 lines

Please think of the subject and the commit message as two different things. Often it's people reviewing on email will only read one or the

other. In other words just restate the subject:

OK, I'll keep that in mind for further patches.

Quoted 6 lines
Quoted 6 lines

Dear Martin,

Just my personal opinion, but I'd be inclined to strip out all DBG_88E calls totally. If there are necessary functions being called such as device_may_wakeup() we can always just keep this part and remove the macro call (not checked this function out myself yet). Thanks.

Quoted 7 lines

I'd agree with you, Phil. Most DBG_88E prints don't say anything useful.

This comment from Greg made me drop the DBG_88E removal for now

https://lore.kernel.org/linux-staging/[email protected]/T/#m05d82a
0ca8ed36180ebdc987114b4d892445c52d

Hi Martin,

I think you misunderstood what Greg was trying to convey with the above- mentioned message.

Well, he doesn't like to feed developers with little spoons :-)

I'm pretty sure that, by "Why not use the proper debugging calls instead of just deleting them?", he meant you should research, understand, and use the proper APIs for printing debug messages.

Please check out pr_debug(), dev_dbg(), netdev_dbg(). Use them appropriately, according to the subsystem you're working in and to the different types of arguments they take.

Thanks,

Fabio

Quoted 6 lines

A compromise would be to remove only those DBG_88E prints which are really not helpful.

Best regards,
Martin

#8 lore raw

Re: [PATCH 3/5] staging: r8188eu: (trivial) remove a duplicate debug print

Quoted 36 lines · Fabio M. De Francesco
Quoted 16 lines · CEST Martin Kaiser

Hi Dan and Phil,

Thus wrote Dan Carpenter ([email protected]):

Quoted 4 lines

Please think of the subject and the commit message as two different things. Often it's people reviewing on email will only read one or the

other. In other words just restate the subject:

OK, I'll keep that in mind for further patches.

Quoted 6 lines
Quoted 6 lines

Dear Martin,

Just my personal opinion, but I'd be inclined to strip out all DBG_88E calls totally. If there are necessary functions being called such as device_may_wakeup() we can always just keep this part and remove the macro call (not checked this function out myself yet). Thanks.

Quoted 7 lines

I'd agree with you, Phil. Most DBG_88E prints don't say anything useful.

This comment from Greg made me drop the DBG_88E removal for now

https://lore.kernel.org/linux-staging/[email protected]/T/#m05d82a
0ca8ed36180ebdc987114b4d892445c52d

Hi Martin,

I think you misunderstood what Greg was trying to convey with the above- mentioned message.

Well, he doesn't like to feed developers with little spoons :-)

I'm pretty sure that, by "Why not use the proper debugging calls instead of just deleting them?", he meant you should research, understand, and use the proper APIs for printing debug messages.

Quoted 17 lines

Please check out pr_debug(), dev_dbg(), netdev_dbg(). Use them appropriately, according to the subsystem you're working in and to the different types of arguments they take.

Thanks,

Fabio

Quoted 6 lines

A compromise would be to remove only those DBG_88E prints which are really not helpful.

Best regards,
Martin

The problem I see is that this driver is so littered with unnecessary macro calls, how do we decide which ones to keep? In my mind, the better option is to remove them all and then come up with some new ones in the vein of netdev_dbg() and friends. I could be wrong of course :-) I tried going down the route of keeping/converting some to proper calls such as netdev_dbg() and the issue is a lot of the calls don't have an obvious value anyway.

Regards,
Phil

#9 lore raw

Re: [PATCH 3/5] staging: r8188eu: (trivial) remove a duplicate debug print

Quoted 7 lines · CEST Phillip Potter

On Fri, 13 Aug 2021 at 13:42, Fabio M. De Francesco

Quoted 4 lines · <[email protected]> wrote:
Quoted 3 lines · CEST Martin Kaiser

Hi Dan and Phil,
[...]

Quoted 1 line
Quoted 1 line

Just my personal opinion, but I'd be inclined to strip out all

DBG_88E

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 3 lines
Quoted 3 lines

calls totally. If there are necessary functions being called such as device_may_wakeup() we can always just keep this part and remove the macro call (not checked this function out myself yet). Thanks.

I'd agree with you, Phil. Most DBG_88E prints don't say anything useful.

This comment from Greg made me drop the DBG_88E removal for now

https://lore.kernel.org/linux-staging/[email protected]/T/#m05
d82a 0ca8ed36180ebdc987114b4d892445c52d

Quoted 8 lines
Quoted 8 lines

Hi Martin,

I think you misunderstood what Greg was trying to convey with the above- mentioned message.

Well, he doesn't like to feed developers with little spoons :-)

I'm pretty sure that, by "Why not use the proper debugging calls instead

of

Quoted 1 line
Quoted 1 line

just deleting them?", he meant you should research, understand, and use

the

Quoted 3 lines
Quoted 3 lines

proper APIs for printing debug messages.

Please check out pr_debug(), dev_dbg(), netdev_dbg(). Use them

appropriately,

Quoted 21 lines
Quoted 12 lines

according to the subsystem you're working in and to the different types of arguments they take.

Thanks,

Fabio

Quoted 5 lines

A compromise would be to remove only those DBG_88E prints which are really not helpful.

Best regards,
Martin

The problem I see is that this driver is so littered with unnecessary macro calls, how do we decide which ones to keep? In my mind, the better option is to remove them all and then come up with some new ones in the vein of netdev_dbg() and friends. I could be wrong of course :-) I tried going down the route of keeping/converting some to proper calls such as netdev_dbg() and the issue is a lot of the calls don't have an obvious value anyway.

Quoted 2 lines

Regards,
Phil

I think that you'd better remove only the ones that "have no obvious value" and convert the others to using netdev_dbg(). Obviously, telling which have no value is at the discretion of whoever wants to carry on this work.

Regards,

Fabio

#10 lore raw

PATCH 4/5 staging: r8188eu: use proper way to build a module

In reply to Martin Kaiser

It seems that for now, we can only build this driver as a module.

Use the same mechanism as other drivers (such as rtl8723bs or the deprecated rtl8188eu) to enforce building as a module, i.e. depend on m in Kconfig instead of setting CONFIG_R8188EU = m in the Makefile.

If we set CONFIG_R8188EU in the Makefile, this setting will not be visible in .config.

---
 drivers/staging/r8188eu/Kconfig  | 1 +
 drivers/staging/r8188eu/Makefile | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/staging/r8188eu/Kconfig +1 -0
index 6323d63a4a1b..dc1719d3f2e4 100644
@@ -2,6 +2,7 @@
 config R8188EU
 	tristate "Realtek RTL8188EU Wireless LAN NIC driver"
 	depends on WLAN && USB && CFG80211
+	depends on m
 	select WIRELESS_EXT
 	select WEXT_PRIV
 	select LIB80211
drivers/staging/r8188eu/Makefile +0 -2
index 7f6658f931d1..cca7a58c5f29 100644
@@ -4,8 +4,6 @@ EXTRA_CFLAGS += -O1
 
 ccflags-y += -D__CHECK_ENDIAN__
 
-CONFIG_R8188EU = m
-
 CONFIG_USB_HCI = y
 
 CONFIG_BT_COEXIST = n
Signature · 1 line
2.20.1
Acked-by on v1 4/5
#11 lore raw

Re: [PATCH 4/5] staging: r8188eu: use proper way to build a module

Quoted 42 lines · Martin Kaiser

It seems that for now, we can only build this driver as a module.

Use the same mechanism as other drivers (such as rtl8723bs or the deprecated rtl8188eu) to enforce building as a module, i.e. depend on m in Kconfig instead of setting CONFIG_R8188EU = m in the Makefile.

If we set CONFIG_R8188EU in the Makefile, this setting will not be visible in .config.

---
 drivers/staging/r8188eu/Kconfig  | 1 +
 drivers/staging/r8188eu/Makefile | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/staging/r8188eu/Kconfig +1 -0
index 6323d63a4a1b..dc1719d3f2e4 100644
@@ -2,6 +2,7 @@
 config R8188EU
        tristate "Realtek RTL8188EU Wireless LAN NIC driver"
        depends on WLAN && USB && CFG80211
+       depends on m
        select WIRELESS_EXT
        select WEXT_PRIV
        select LIB80211
drivers/staging/r8188eu/Makefile +0 -3
index 7f6658f931d1..cca7a58c5f29 100644
@@ -4,8 +4,6 @@ EXTRA_CFLAGS += -O1
 
 ccflags-y += -D__CHECK_ENDIAN__
 
-CONFIG_R8188EU = m
-
 CONFIG_USB_HCI = y
 
 CONFIG_BT_COEXIST = n
--
Quoted 2 lines

2.20.1

Dear Martin,

Looks good.

Regards,
Phil

#12 lore raw

PATCH 5/5 staging: r8188eu: remove CONFIG_USB_HCI from Makefile

In reply to Martin Kaiser

We already depend on USB. There's no need to set CONFIG_USB_HCI in the Makefile.

Some other Realtek drivers use #ifdef CONFIG_USB_HCI in their code, the r8188 driver doesn't.

---
 drivers/staging/r8188eu/Makefile | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/r8188eu/Makefile +0 -2
index cca7a58c5f29..6bd3a0590aa3 100644
@@ -4,8 +4,6 @@ EXTRA_CFLAGS += -O1
 
 ccflags-y += -D__CHECK_ENDIAN__
 
-CONFIG_USB_HCI = y
-
 CONFIG_BT_COEXIST = n
 CONFIG_WOWLAN = n
 
Signature · 1 line
2.20.1
Acked-by on v1 5/5
#13 lore raw

Re: [PATCH 5/5] staging: r8188eu: remove CONFIG_USB_HCI from Makefile

Quoted 26 lines · Martin Kaiser

We already depend on USB. There's no need to set CONFIG_USB_HCI in the Makefile.

Some other Realtek drivers use #ifdef CONFIG_USB_HCI in their code, the r8188 driver doesn't.

---
 drivers/staging/r8188eu/Makefile | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/r8188eu/Makefile +0 -3
index cca7a58c5f29..6bd3a0590aa3 100644
@@ -4,8 +4,6 @@ EXTRA_CFLAGS += -O1
 
 ccflags-y += -D__CHECK_ENDIAN__
 
-CONFIG_USB_HCI = y
-
 CONFIG_BT_COEXIST = n
 CONFIG_WOWLAN = n
 
--
Quoted 2 lines

2.20.1

Dear Martin,

Looks good.

Regards,
Phil

Acked-by on v1 1/5
#14 lore raw
In reply to Martin Kaiser
Quoted 24 lines · Martin Kaiser

struct hal_data_8188e contains some components related to efuses which are not used for rl8188eu.

---
 drivers/staging/r8188eu/include/rtl8188e_hal.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/r8188eu/include/rtl8188e_hal.h +0 -4
index ea879572d6e1..3939bf053de1 100644
@@ -263,9 +263,6 @@ struct hal_data_8188e {
        u8      bAPKThermalMeterIgnore;
 
        bool    EepromOrEfuse;
-       /* 92C:256bytes, 88E:512bytes, we use union set (512bytes) */
-       u8      EfuseMap[2][HWSET_MAX_SIZE_512];
-       u8      EfuseUsedPercentage;
        struct efuse_hal        EfuseHal;
 
        u8      Index24G_CCK_Base[RF_PATH_MAX][CHANNEL_MAX_NUMBER];
--
Quoted 2 lines

2.20.1

Dear Martin,

Looks good.

Regards,
Phil