diff mbox series

[7/7] brcmfmac: introduce BRCMFMAC exported symbols namespace

Message ID CAJ65rDwMzF8hhuykrikSdsPMgy4GhLkTUfqTfn-cbHwCL5OE2Q@mail.gmail.com
State New
Headers show
Series [1/7] brcmfmac: add function to unbind device to bus layer api | expand

Commit Message

Arend Van Spriel June 13, 2022, 9:19 a.m. UTC
Instead of using EXPORT_SYMBOL() use namespace variant and only if
build vendor-specific code as separate module.

Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 .../net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c   | 1 +
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h     | 6 ++++++
 .../net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c   | 1 +
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c    | 4 ++--
 .../net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c   | 1 +
 5 files changed, 11 insertions(+), 2 deletions(-)

Comments

Kalle Valo July 28, 2022, 9:39 a.m. UTC | #1
aspriel@gmail.com writes:

> Instead of using EXPORT_SYMBOL() use namespace variant and only if
> build vendor-specific code as separate module.

The commit log should always answer to the question "why?".
Arend Van Spriel July 29, 2022, 9:38 a.m. UTC | #2
On 7/28/2022 11:39 AM, Kalle Valo wrote:
> aspriel@gmail.com writes:
> 
>> Instead of using EXPORT_SYMBOL() use namespace variant and only if
>> build vendor-specific code as separate module.
> 
> The commit log should always answer to the question "why?".

Let me try:

Exported symbols are usable from any kernel module. Using the namespace 
variant requires the caller to explicitly import the symbols. This makes 
it more clear that these are only intended to be used by brcmfmac 
driver. When vendor-support is built-in there is no reason to export the
symbols at all.

If the above is acceptable I will use that when resending the patch series.

Regards,
Arend
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c
index 790116a735c7..d55f3271d619 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bca/module.c
@@ -21,6 +21,7 @@  static void __exit brcmf_bca_exit(void)
 }

 MODULE_LICENSE("Dual BSD/GPL");
+MODULE_IMPORT_NS(BRCMFMAC);

 module_init(brcmf_bca_init);
 module_exit(brcmf_bca_exit);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
index 5d627b8dbb50..8cafe59c089d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h
@@ -13,6 +13,12 @@ 
 #include <net/cfg80211.h>
 #include "fweh.h"

+#if IS_ENABLED(CONFIG_BRCMFMAC_VENDOR_MODULES)
+#define BRCMF_EXPORT_SYMBOL_GPL(__sym)	EXPORT_SYMBOL_NS_GPL(__sym, BRCMFMAC)
+#else
+#define BRCMF_EXPORT_SYMBOL(__sym)
+#endif
+
 #define TOE_TX_CSUM_OL		0x00000001
 #define TOE_RX_CSUM_OL		0x00000002

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c
index 34294724a1f8..f82fbbe3ecef 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/module.c
@@ -21,6 +21,7 @@  static void __exit brcmf_cyw_exit(void)
 }

 MODULE_LICENSE("Dual BSD/GPL");
+MODULE_IMPORT_NS(BRCMFMAC);

 module_init(brcmf_cyw_init);
 module_exit(brcmf_cyw_exit);
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c
index d0ba2aba093b..be72203f4e0b 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c
@@ -112,7 +112,7 @@  int brcmf_fwvid_register_vendor(enum
brcmf_fwvendor fwvid, struct module *vmod,

 	return 0;
 }
-EXPORT_SYMBOL(brcmf_fwvid_register_vendor);
+BRCMF_EXPORT_SYMBOL_GPL(brcmf_fwvid_register_vendor);

 int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct
module *mod)
 {
@@ -145,7 +145,7 @@  int brcmf_fwvid_unregister_vendor(enum
brcmf_fwvendor fwvid, struct module *mod)

 	return 0;
 }
-EXPORT_SYMBOL(brcmf_fwvid_unregister_vendor);
+BRCMF_EXPORT_SYMBOL_GPL(brcmf_fwvid_unregister_vendor);
 #else
 static inline int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid)
 {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c
index 23e3a4557880..02918d434556 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/wcc/module.c
@@ -21,6 +21,7 @@  static void __exit brcmf_wcc_exit(void)
 }

 MODULE_LICENSE("Dual BSD/GPL");
+MODULE_IMPORT_NS(BRCMFMAC);

 module_init(brcmf_wcc_init);
 module_exit(brcmf_wcc_exit);