Skip to contentSkip to conversation

staging: r8188eu: cleanup some metadata issues

PATCH In review Grzegorz Szymaszek 2 participants 6 messages Aug 5, 2022 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: r8188eu: cleanup some metadata issues

This patchset tries to improve the r8188eu driver metadata. Some hardcoded values are replaced with proper macros, some unnecessary macros are removed.

Changes for v2:
- added a cover letter and a base tree reference;
- added Philipp Hortmann's Tested-by;
- replaced the second and the third patch with different ones, per Greg Kroah-Hartman's suggestions to make better use of existing kernel macros and remove unnecessary ones.

Grzegorz Szymaszek (4):
staging: r8188eu: set firmware path in a macro
staging: r8188eu: use KBUILD_MODNAME instead of a string constant
staging: r8188eu: drop the DRV_NAME macro
staging: r8188eu: drop the DRIVERVERSION macro

 drivers/staging/r8188eu/core/rtw_fw.c       | 2 +-
 drivers/staging/r8188eu/include/drv_types.h | 4 +---
 drivers/staging/r8188eu/os_dep/os_intfs.c   | 3 +--
 drivers/staging/r8188eu/os_dep/usb_intf.c   | 2 +-
 4 files changed, 4 insertions(+), 7 deletions(-)

base-commit: 9de1f9c8ca5100a02a2e271bdbde36202e251b4b
prerequisite-patch-id: 79964bd0bcd260f1df53830a81e009c34993ee6f

Signature · 1 line
2.35.1
#1 lore raw

PATCH v2 1/4 staging: r8188eu: set firmware path in a macro

The r8188eu driver requires a firmware file, the path of which was hardcoded as constant strings in two places:
(1) in core/rtw_fw.c, in function load_firmware(),
(2) in os_dep/os_intfs.c, in the MODULE_FIRMWARE() call.

Declare the path using a macro, FW_RTL8188EU, and replace the above constant strings with the macro. That's the way it is done in many other drivers. The new macro is defined in include/drv_types.h, because that file is already included by both of the above files (or at least their headers) and because it already contains other driver constants, like its name and version.

---
V1->V2: Added Philipp Hortmann's Tested-by

 drivers/staging/r8188eu/core/rtw_fw.c       | 2 +-
 drivers/staging/r8188eu/include/drv_types.h | 1 +
 drivers/staging/r8188eu/os_dep/os_intfs.c   | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_fw.c +1 -1
index 0451e5177644..0fe6d4944694 100644
@@ -209,7 +209,7 @@ static int load_firmware(struct rt_firmware *rtfw, struct device *device)
 {
 	int ret = _SUCCESS;
 	const struct firmware *fw;
-	const char *fw_name = "rtlwifi/rtl8188eufw.bin";
+	const char *fw_name = FW_RTL8188EU;
 	int err = request_firmware(&fw, fw_name, device);
 
 	if (err) {
drivers/staging/r8188eu/include/drv_types.h +1 -0
index bba88a0ede61..f51b83515953 100644
@@ -37,6 +37,7 @@
 #include "rtw_fw.h"
 
 #define DRIVERVERSION	"v4.1.4_6773.20130222"
+#define FW_RTL8188EU	"rtlwifi/rtl8188eufw.bin"
 
 struct registry_priv {
 	u8	chip_version;
drivers/staging/r8188eu/os_dep/os_intfs.c +1 -1
index 5bd3022e4b40..5985054da935 100644
@@ -18,7 +18,7 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
 MODULE_AUTHOR("Realtek Semiconductor Corp.");
 MODULE_VERSION(DRIVERVERSION);
-MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
+MODULE_FIRMWARE(FW_RTL8188EU);
 
 #define CONFIG_BR_EXT_BRNAME "br0"
 #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
Signature · 1 line
2.35.1
#2 lore raw

PATCH v2 2/4 staging: r8188eu: use KBUILD_MODNAME instead of a string constant

In reply to Grzegorz Szymaszek

The field .usbdrv.name of the struct rtw_usb_drv hardcoded the module (driver) name as a constant string. Replace the string with the KBUILD_MODNAME macro.

---
V1 -> V2: Split v1-0002 into v2-0002 and v2-0003. Replace the constant
string with KBUILD_MODNAME instead of DRV_NAME

 drivers/staging/r8188eu/os_dep/usb_intf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/os_dep/usb_intf.c +1 -1
index 68869c5daeff..b845f5ec5489 100644
@@ -54,7 +54,7 @@ struct rtw_usb_drv {
 };
 
 static struct rtw_usb_drv rtl8188e_usb_drv = {
-	.usbdrv.name = "r8188eu",
+	.usbdrv.name = KBUILD_MODNAME,
 	.usbdrv.probe = rtw_drv_init,
 	.usbdrv.disconnect = rtw_dev_remove,
 	.usbdrv.id_table = rtw_usb_id_tbl,
Signature · 1 line
2.35.1
#3 lore raw

PATCH v2 3/4 staging: r8188eu: drop the DRV_NAME macro

In reply to Grzegorz Szymaszek

The DRV_NAME macro is not used anywhere; KBUILD_MODNAME should be used instead. Remove the macro declaration.

---
V1 -> V2: Split v1-0003 into v2-0003 and v2-0004. Remove the DRV_NAME
macro, since KBUILD_MODNAME should be used instead

 drivers/staging/r8188eu/include/drv_types.h | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/r8188eu/include/drv_types.h +0 -2
index f51b83515953..f659eac70b32 100644
@@ -10,8 +10,6 @@
 #ifndef __DRV_TYPES_H__
 #define __DRV_TYPES_H__
 
-#define DRV_NAME "r8188eu"
-
 #include "osdep_service.h"
 #include "wlan_bssdef.h"
 #include "rtw_ht.h"
Signature · 1 line
2.35.1
#4 lore raw

PATCH v2 4/4 staging: r8188eu: drop the DRIVERVERSION macro

In reply to Grzegorz Szymaszek

Since the driver is currently in the kernel, the module version macro is not necessary.

---
V1 -> V2: Split v1-0003 into v2-0003 and v2-0004. Remove the
DRIVERVERSION macro instead of changing its name

 drivers/staging/r8188eu/include/drv_types.h | 1 -
 drivers/staging/r8188eu/os_dep/os_intfs.c   | 1 -
 2 files changed, 2 deletions(-)
drivers/staging/r8188eu/include/drv_types.h +0 -1
index f659eac70b32..05888acc6bb1 100644
@@ -34,7 +34,6 @@
 #include "rtl8188e_hal.h"
 #include "rtw_fw.h"
 
-#define DRIVERVERSION	"v4.1.4_6773.20130222"
 #define FW_RTL8188EU	"rtlwifi/rtl8188eufw.bin"
 
 struct registry_priv {
drivers/staging/r8188eu/os_dep/os_intfs.c +0 -1
index 5985054da935..e90af754ef93 100644
@@ -17,7 +17,6 @@
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
 MODULE_AUTHOR("Realtek Semiconductor Corp.");
-MODULE_VERSION(DRIVERVERSION);
 MODULE_FIRMWARE(FW_RTL8188EU);
 
 #define CONFIG_BR_EXT_BRNAME "br0"
Signature · 1 line
2.35.1
Tested-by on the v2 series
#5 lore raw
In reply to Grzegorz Szymaszek
Quoted 24 lines · Grzegorz Szymaszek

This patchset tries to improve the r8188eu driver metadata. Some hardcoded values are replaced with proper macros, some unnecessary macros are removed.

Changes for v2:
- added a cover letter and a base tree reference;
- added Philipp Hortmann's Tested-by;
- replaced the second and the third patch with different ones, per Greg Kroah-Hartman's suggestions to make better use of existing kernel macros and remove unnecessary ones.

Grzegorz Szymaszek (4):
staging: r8188eu: set firmware path in a macro
staging: r8188eu: use KBUILD_MODNAME instead of a string constant
staging: r8188eu: drop the DRV_NAME macro
staging: r8188eu: drop the DRIVERVERSION macro

  drivers/staging/r8188eu/core/rtw_fw.c       | 2 +-
  drivers/staging/r8188eu/include/drv_types.h | 4 +---
  drivers/staging/r8188eu/os_dep/os_intfs.c   | 3 +--
  drivers/staging/r8188eu/os_dep/usb_intf.c   | 2 +-
  4 files changed, 4 insertions(+), 7 deletions(-)
Quoted 2 lines

base-commit: 9de1f9c8ca5100a02a2e271bdbde36202e251b4b
prerequisite-patch-id: 79964bd0bcd260f1df53830a81e009c34993ee6f