linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues
@ 2022-08-05 16:27 Grzegorz Szymaszek
  2022-08-05 16:27 ` [PATCH v2 1/4] staging: r8188eu: set firmware path in a macro Grzegorz Szymaszek
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Grzegorz Szymaszek @ 2022-08-05 16:27 UTC (permalink / raw)
  To: Larry Finger, Greg KH, Phillip Potter
  Cc: Philipp Hortmann, Grzegorz Szymaszek, linux-kernel, linux-staging

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
-- 
2.35.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/4] staging: r8188eu: set firmware path in a macro
  2022-08-05 16:27 [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Grzegorz Szymaszek
@ 2022-08-05 16:27 ` Grzegorz Szymaszek
  2022-08-05 16:27 ` [PATCH v2 2/4] staging: r8188eu: use KBUILD_MODNAME instead of a string constant Grzegorz Szymaszek
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Szymaszek @ 2022-08-05 16:27 UTC (permalink / raw)
  To: Larry Finger, Greg KH, Phillip Potter
  Cc: Philipp Hortmann, Grzegorz Szymaszek, linux-kernel, linux-staging

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.

Link: https://lore.kernel.org/lkml/YuoQ37PIKzWO1zIY@kroah.com/
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
---
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(-)

diff --git a/drivers/staging/r8188eu/core/rtw_fw.c b/drivers/staging/r8188eu/core/rtw_fw.c
index 0451e5177644..0fe6d4944694 100644
--- a/drivers/staging/r8188eu/core/rtw_fw.c
+++ b/drivers/staging/r8188eu/core/rtw_fw.c
@@ -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) {
diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index bba88a0ede61..f51b83515953 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -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;
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 5bd3022e4b40..5985054da935 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -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, */
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/4] staging: r8188eu: use KBUILD_MODNAME instead of a string constant
  2022-08-05 16:27 [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Grzegorz Szymaszek
  2022-08-05 16:27 ` [PATCH v2 1/4] staging: r8188eu: set firmware path in a macro Grzegorz Szymaszek
@ 2022-08-05 16:27 ` Grzegorz Szymaszek
  2022-08-05 16:28 ` [PATCH v2 3/4] staging: r8188eu: drop the DRV_NAME macro Grzegorz Szymaszek
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Szymaszek @ 2022-08-05 16:27 UTC (permalink / raw)
  To: Larry Finger, Greg KH, Phillip Potter
  Cc: Philipp Hortmann, Grzegorz Szymaszek, linux-kernel, linux-staging

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.

Link: https://lore.kernel.org/lkml/Yuy7QSh%2FclQ5Ki09@kroah.com/
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
---
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(-)

diff --git a/drivers/staging/r8188eu/os_dep/usb_intf.c b/drivers/staging/r8188eu/os_dep/usb_intf.c
index 68869c5daeff..b845f5ec5489 100644
--- a/drivers/staging/r8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/r8188eu/os_dep/usb_intf.c
@@ -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,
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/4] staging: r8188eu: drop the DRV_NAME macro
  2022-08-05 16:27 [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Grzegorz Szymaszek
  2022-08-05 16:27 ` [PATCH v2 1/4] staging: r8188eu: set firmware path in a macro Grzegorz Szymaszek
  2022-08-05 16:27 ` [PATCH v2 2/4] staging: r8188eu: use KBUILD_MODNAME instead of a string constant Grzegorz Szymaszek
@ 2022-08-05 16:28 ` Grzegorz Szymaszek
  2022-08-05 16:28 ` [PATCH v2 4/4] staging: r8188eu: drop the DRIVERVERSION macro Grzegorz Szymaszek
  2022-08-05 16:43 ` [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Szymaszek @ 2022-08-05 16:28 UTC (permalink / raw)
  To: Larry Finger, Greg KH, Phillip Potter
  Cc: Philipp Hortmann, Grzegorz Szymaszek, linux-kernel, linux-staging

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

Link: https://lore.kernel.org/lkml/Yuy7Lc%2FTJMinuupA@kroah.com/
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
---
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(-)

diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index f51b83515953..f659eac70b32 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -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"
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 4/4] staging: r8188eu: drop the DRIVERVERSION macro
  2022-08-05 16:27 [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Grzegorz Szymaszek
                   ` (2 preceding siblings ...)
  2022-08-05 16:28 ` [PATCH v2 3/4] staging: r8188eu: drop the DRV_NAME macro Grzegorz Szymaszek
@ 2022-08-05 16:28 ` Grzegorz Szymaszek
  2022-08-05 16:43 ` [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Szymaszek @ 2022-08-05 16:28 UTC (permalink / raw)
  To: Larry Finger, Greg KH, Phillip Potter
  Cc: Philipp Hortmann, Grzegorz Szymaszek, linux-kernel, linux-staging

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

Link: https://lore.kernel.org/lkml/Yuy7Lc%2FTJMinuupA@kroah.com/
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl>
---
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(-)

diff --git a/drivers/staging/r8188eu/include/drv_types.h b/drivers/staging/r8188eu/include/drv_types.h
index f659eac70b32..05888acc6bb1 100644
--- a/drivers/staging/r8188eu/include/drv_types.h
+++ b/drivers/staging/r8188eu/include/drv_types.h
@@ -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 {
diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
index 5985054da935..e90af754ef93 100644
--- a/drivers/staging/r8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
@@ -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"
-- 
2.35.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues
  2022-08-05 16:27 [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Grzegorz Szymaszek
                   ` (3 preceding siblings ...)
  2022-08-05 16:28 ` [PATCH v2 4/4] staging: r8188eu: drop the DRIVERVERSION macro Grzegorz Szymaszek
@ 2022-08-05 16:43 ` Philipp Hortmann
  4 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-08-05 16:43 UTC (permalink / raw)
  To: Grzegorz Szymaszek, Larry Finger, Greg KH, Phillip Potter,
	linux-kernel, linux-staging

On 8/5/22 18:27, Grzegorz Szymaszek wrote:
> 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


Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-05 16:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 16:27 [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Grzegorz Szymaszek
2022-08-05 16:27 ` [PATCH v2 1/4] staging: r8188eu: set firmware path in a macro Grzegorz Szymaszek
2022-08-05 16:27 ` [PATCH v2 2/4] staging: r8188eu: use KBUILD_MODNAME instead of a string constant Grzegorz Szymaszek
2022-08-05 16:28 ` [PATCH v2 3/4] staging: r8188eu: drop the DRV_NAME macro Grzegorz Szymaszek
2022-08-05 16:28 ` [PATCH v2 4/4] staging: r8188eu: drop the DRIVERVERSION macro Grzegorz Szymaszek
2022-08-05 16:43 ` [PATCH v2 0/4] staging: r8188eu: cleanup some metadata issues Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).