Skip to contentSkip to conversation

b43: replace B43_BCMA_EXTRA with modparam allhwsupport

RFC PATCH New Rafał Miłecki 3 participants 4 messages Jun 25, 2013 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 b43: replace B43_BCMA_EXTRA with modparam allhwsupport

This allows enabling support for extra hardware with just a module param, without kernel/module recompilation.

---
 drivers/net/wireless/b43/Kconfig |    6 ------
 drivers/net/wireless/b43/main.c  |   16 ++++++++++++++--
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/net/wireless/b43/Kconfig +0 -6
index 3f21e0b..51ff0b1 100644
@@ -31,12 +31,6 @@ config B43_BCMA
 	depends on B43 && (BCMA = y || BCMA = B43)
 	default y
 
-config B43_BCMA_EXTRA
-	bool "Hardware support that overlaps with the brcmsmac driver"
-	depends on B43_BCMA
-	default n if BRCMSMAC
-	default y
-
 config B43_SSB
 	bool
 	depends on B43 && (SSB = y || SSB = B43)
drivers/net/wireless/b43/main.c +14 -2
index a95b77a..583993c 100644
@@ -113,13 +113,19 @@ static int b43_modparam_pio = 0;
 module_param_named(pio, b43_modparam_pio, int, 0644);
 MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
 
+#ifdef CONFIG_BRCMSMAC
+static int modparam_allhwsupport;
+#else
+static int modparam_allhwsupport = 1;
+#endif
+module_param_named(allhwsupport, modparam_allhwsupport, int, 0444);
+MODULE_PARM_DESC(allhwsupport, "Enable support for all hardware (even it if overlaps with the brcmsmac driver)");
+
 #ifdef CONFIG_B43_BCMA
 static const struct bcma_device_id b43_bcma_tbl[] = {
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS),
-#ifdef CONFIG_B43_BCMA_EXTRA
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
-#endif
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1D, BCMA_ANY_CLASS),
 	BCMA_CORETABLE_END
 };
@@ -5396,6 +5402,12 @@ static int b43_bcma_probe(struct bcma_device *core)
 	struct b43_wl *wl;
 	int err;
 
+	if (!modparam_allhwsupport &&
+	    (core->id.rev == 0x17 || core->id.rev == 0x18)) {
+		pr_err("Support for cores revisions 0x17 and 0x18 disabled by module param allhwsupport=0. Try b43.allhwsupport=1\n");
+		return -ENOTSUPP;
+	}
+
 	dev = b43_bus_dev_bcma_init(core);
 	if (!dev)
 		return -ENODEV;
Signature · 1 line
1.7.10.4
#1 lore raw

RFC PATCH 1/1 b43: replace B43_BCMA_EXTRA with modparam allhwsupport

Seems OK to me...

Quoted 73 lines · Rafa? Mi?ecki

This allows enabling support for extra hardware with just a module param, without kernel/module recompilation.

---
 drivers/net/wireless/b43/Kconfig |    6 ------
 drivers/net/wireless/b43/main.c  |   16 ++++++++++++++--
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/net/wireless/b43/Kconfig +0 -6
index 3f21e0b..51ff0b1 100644
@@ -31,12 +31,6 @@ config B43_BCMA
 	depends on B43 && (BCMA = y || BCMA = B43)
 	default y
 
-config B43_BCMA_EXTRA
-	bool "Hardware support that overlaps with the brcmsmac driver"
-	depends on B43_BCMA
-	default n if BRCMSMAC
-	default y
-
 config B43_SSB
 	bool
 	depends on B43 && (SSB = y || SSB = B43)
drivers/net/wireless/b43/main.c +14 -2
index a95b77a..583993c 100644
@@ -113,13 +113,19 @@ static int b43_modparam_pio = 0;
 module_param_named(pio, b43_modparam_pio, int, 0644);
 MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
 
+#ifdef CONFIG_BRCMSMAC
+static int modparam_allhwsupport;
+#else
+static int modparam_allhwsupport = 1;
+#endif
+module_param_named(allhwsupport, modparam_allhwsupport, int, 0444);
+MODULE_PARM_DESC(allhwsupport, "Enable support for all hardware (even it if overlaps with the brcmsmac driver)");
+
 #ifdef CONFIG_B43_BCMA
 static const struct bcma_device_id b43_bcma_tbl[] = {
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x11, BCMA_ANY_CLASS),
-#ifdef CONFIG_B43_BCMA_EXTRA
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x17, BCMA_ANY_CLASS),
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x18, BCMA_ANY_CLASS),
-#endif
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_80211, 0x1D, BCMA_ANY_CLASS),
 	BCMA_CORETABLE_END
 };
@@ -5396,6 +5402,12 @@ static int b43_bcma_probe(struct bcma_device *core)
 	struct b43_wl *wl;
 	int err;
 
+	if (!modparam_allhwsupport &&
+	    (core->id.rev == 0x17 || core->id.rev == 0x18)) {
+		pr_err("Support for cores revisions 0x17 and 0x18 disabled by module param allhwsupport=0. Try b43.allhwsupport=1\n");
+		return -ENOTSUPP;
+	}
+
 	dev = b43_bus_dev_bcma_init(core);
 	if (!dev)
 		return -ENODEV;
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.
#2 lore raw

RFC PATCH 1/1 b43: replace B43_BCMA_EXTRA with modparam allhwsupport

In reply to Rafał Miłecki
Quoted 31 lines · Rafa? Mi?ecki

This allows enabling support for extra hardware with just a module param, without kernel/module recompilation.

---
 drivers/net/wireless/b43/Kconfig |    6 ------
 drivers/net/wireless/b43/main.c  |   16 ++++++++++++++--
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/net/wireless/b43/Kconfig +0 -6
index 3f21e0b..51ff0b1 100644
@@ -31,12 +31,6 @@ config B43_BCMA
        depends on B43 && (BCMA = y || BCMA = B43)
        default y
 
-config B43_BCMA_EXTRA
-       bool "Hardware support that overlaps with the brcmsmac driver"
-       depends on B43_BCMA
-       default n if BRCMSMAC
-       default y
-
 config B43_SSB
        bool
        depends on B43 && (SSB = y || SSB = B43)
drivers/net/wireless/b43/main.c +0 -0
index a95b77a..583993c 100644

drivers/net/wireless/b43/main.c static int b43_modparam_pio = 0; · line 116

Quoted 4 lines
drivers/net/wireless/b43/main.c +1 -0
@@ -113,13 +113,19 @@ static int b43_modparam_pio = 0;
 module_param_named(pio, b43_modparam_pio, int, 0644);
 MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
 
+#ifdef CONFIG_BRCMSMAC

This is only defined if BRCMSMAC is built-in, but not if it is built as a module; then it's CONFIG_BRCMSMAC_MODULE, which is probably not what you want. To easily catch both, use IS_ENABLED(CONFIG_BRCMSMAC).

drivers/net/wireless/b43/main.c static int b43_modparam_pio = 0; · line 120

Quoted 4 lines
drivers/net/wireless/b43/main.c +4 -0
+static int modparam_allhwsupport;
+#else
+static int modparam_allhwsupport = 1;
+#endif

And since IS_ENABLED returns 0 or 1 you should be able to reduce it to one line:

static int modparam_allhwsupport = !IS_ENABLED(CONFIG_BRCMSMAC);

Jonas

#3 lore raw

RFC PATCH 1/1 b43: replace B43_BCMA_EXTRA with modparam allhwsupport

2013/6/25 Jonas Gorski <[email protected]>:

Quoted 41 lines · Rafa? Mi?ecki
Quoted 31 lines

This allows enabling support for extra hardware with just a module param, without kernel/module recompilation.

---
 drivers/net/wireless/b43/Kconfig |    6 ------
 drivers/net/wireless/b43/main.c  |   16 ++++++++++++++--
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/net/wireless/b43/Kconfig +0 -6
index 3f21e0b..51ff0b1 100644
@@ -31,12 +31,6 @@ config B43_BCMA
        depends on B43 && (BCMA = y || BCMA = B43)
        default y
 
-config B43_BCMA_EXTRA
-       bool "Hardware support that overlaps with the brcmsmac driver"
-       depends on B43_BCMA
-       default n if BRCMSMAC
-       default y
-
 config B43_SSB
        bool
        depends on B43 && (SSB = y || SSB = B43)
drivers/net/wireless/b43/main.c +0 -0
index a95b77a..583993c 100644

drivers/net/wireless/b43/main.c static int b43_modparam_pio = 0; · line 116

Quoted 4 lines
drivers/net/wireless/b43/main.c +1 -0
@@ -113,13 +113,19 @@ static int b43_modparam_pio = 0;
 module_param_named(pio, b43_modparam_pio, int, 0644);
 MODULE_PARM_DESC(pio, "Use PIO accesses by default: 0=DMA, 1=PIO");
 
+#ifdef CONFIG_BRCMSMAC

This is only defined if BRCMSMAC is built-in, but not if it is built as a module; then it's CONFIG_BRCMSMAC_MODULE, which is probably not what you want. To easily catch both, use IS_ENABLED(CONFIG_BRCMSMAC).

Quoted 8 lines

drivers/net/wireless/b43/main.c static int b43_modparam_pio = 0; · line 120

Quoted 4 lines
drivers/net/wireless/b43/main.c +4 -0
+static int modparam_allhwsupport;
+#else
+static int modparam_allhwsupport = 1;
+#endif

And since IS_ENABLED returns 0 or 1 you should be able to reduce it to one line:

static int modparam_allhwsupport = !IS_ENABLED(CONFIG_BRCMSMAC);

I love learning new tricks all the time :)

Signature · 1 line
Rafa?