Skip to contentSkip to conversation

b43: ssb: refuse to support more than IEEE 802.11 core

PATCH New Rafał Miłecki 2 participants 6 messages Apr 20, 2014 – Apr 21, 2014 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 b43: ssb: refuse to support more than IEEE 802.11 core

Some ancient Broadcom devices had one core per band, e.g.:
ssb: Found chip with id 0x4306, rev 0x02 and package 0x00
ssb: Core 0 found: ChipCommon (cc 0x800, rev 0x02, vendor 0x4243)
ssb: Core 1 found: IEEE 802.11 (cc 0x812, rev 0x04, vendor 0x4243)
ssb: Core 2 found: PCMCIA (cc 0x80D, rev 0x01, vendor 0x4243)
ssb: Core 3 found: V90 (cc 0x807, rev 0x01, vendor 0x4243)
ssb: Core 4 found: PCI (cc 0x804, rev 0x07, vendor 0x4243)
ssb: Core 5 found: IEEE 802.11 (cc 0x812, rev 0x04, vendor 0x4243)

This hardware model was dropped for newer devices handled by b43.

---
With this patchset I'm still able to use my BCM4321, so I guess it's alright & safe :)

---
 drivers/net/wireless/b43/main.c | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)
drivers/net/wireless/b43/main.c +20 -17
index 69fc3d6..cf84cf2 100644
@@ -5486,39 +5486,42 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
 	struct b43_bus_dev *dev;
 	struct b43_wl *wl;
 	int err;
-	int first = 0;
 
 	dev = b43_bus_dev_ssb_init(sdev);
 	if (!dev)
 		return -ENOMEM;
 
 	wl = ssb_get_devtypedata(sdev);
-	if (!wl) {
-		/* Probing the first core. Must setup common struct b43_wl */
-		first = 1;
-		b43_sprom_fixup(sdev->bus);
-		wl = b43_wireless_init(dev);
-		if (IS_ERR(wl)) {
-			err = PTR_ERR(wl);
-			goto out;
-		}
-		ssb_set_devtypedata(sdev, wl);
-		B43_WARN_ON(ssb_get_devtypedata(sdev) != wl);
+	if (wl) {
+		b43err(NULL, "Dual-core devices are not supported\n");
+		err = -ENOTSUPP;
+		goto err_ssb_kfree_dev;
 	}
+
+	b43_sprom_fixup(sdev->bus);
+
+	wl = b43_wireless_init(dev);
+	if (IS_ERR(wl)) {
+		err = PTR_ERR(wl);
+		goto err_ssb_kfree_dev;
+	}
+	ssb_set_devtypedata(sdev, wl);
+	B43_WARN_ON(ssb_get_devtypedata(sdev) != wl);
+
 	err = b43_one_core_attach(dev, wl);
 	if (err)
-		goto err_wireless_exit;
+		goto err_ssb_wireless_exit;
 
 	/* setup and start work to load firmware */
 	INIT_WORK(&wl->firmware_load, b43_request_firmware);
 	schedule_work(&wl->firmware_load);
 
-      out:
 	return err;
 
-      err_wireless_exit:
-	if (first)
-		b43_wireless_exit(dev, wl);
+err_ssb_wireless_exit:
+	b43_wireless_exit(dev, wl);
+err_ssb_kfree_dev:
+	kfree(dev);
 	return err;
 }
 
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH 2/2 b43: remove leftover code for dual-core devices support

---
 drivers/net/wireless/b43/b43.h  |  4 ----
 drivers/net/wireless/b43/main.c | 52 +++++++++++++++--------------------------
 2 files changed, 19 insertions(+), 37 deletions(-)
drivers/net/wireless/b43/b43.h +0 -4
index 54376fd..4113b69 100644
@@ -915,10 +915,6 @@ struct b43_wl {
 	char rng_name[30 + 1];
 #endif /* CONFIG_B43_HWRNG */
 
-	/* List of all wireless devices on this chip */
-	struct list_head devlist;
-	u8 nr_devs;
-
 	bool radiotap_enabled;
 	bool radio_enabled;
 
drivers/net/wireless/b43/main.c +19 -33

94 lines not on this page · raw message

Signature · 1 line
1.8.4.5
#2 lore raw

PATCH v2 2/2 b43: remove list of IEEE 802.11 devices

This is the first step to remove leftover code.

---
As Michael noticed there is much more to remove (e.g. struct b43_wl). Change commit message to speciify what exactly we remove at this point. No code changes to V1

---
 drivers/net/wireless/b43/b43.h  |  4 ----
 drivers/net/wireless/b43/main.c | 52 +++++++++++++++--------------------------
 2 files changed, 19 insertions(+), 37 deletions(-)
drivers/net/wireless/b43/b43.h +0 -4
index 54376fd..4113b69 100644
@@ -915,10 +915,6 @@ struct b43_wl {
 	char rng_name[30 + 1];
 #endif /* CONFIG_B43_HWRNG */
 
-	/* List of all wireless devices on this chip */
-	struct list_head devlist;
-	u8 nr_devs;
-
 	bool radiotap_enabled;
 	bool radio_enabled;
 
drivers/net/wireless/b43/main.c +19 -33

94 lines not on this page · raw message

Signature · 1 line
1.8.4.5
#3 lore raw

PATCH 1/2 b43: ssb: refuse to support more than IEEE 802.11 core

In reply to Rafał Miłecki
Quoted 5 lines · On Sun, 20 Apr 2014 20:30:58 +0200 Rafa? Mi?ecki <[email protected]> wrote:
drivers/net/wireless/b43/main.c +0 -0
index 69fc3d6..cf84cf2 100644

drivers/net/wireless/b43/main.c int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) · line 5494

Quoted 10 lines
drivers/net/wireless/b43/main.c +0 -1
@@ -5486,39 +5486,42 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
 	struct b43_bus_dev *dev;
 	struct b43_wl *wl;
 	int err;
-	int first = 0;
 
 	dev = b43_bus_dev_ssb_init(sdev);
 	if (!dev)
 		return -ENOMEM;
 
 	wl = ssb_get_devtypedata(sdev);

The whole "struct b43_wl" and "ssb_get_devtypedata" was to support multiple cores of the same type in a single driver instance (= b43 multicore).
With multicore support being removed, everything in b43_wl could be merged into b43_wldev. Also the use of ssb_get_devtypedata could probably be removed, too.

This will simplify a lot of the b43 startup and shutdown code.

Signature · 13 lines
Michael.

----
Please use PGP/GPG encryption.
Key-ID: F532BE1D908D8B0E
--------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20140420/26c99456/attachment.sig>
#4 lore raw

PATCH 1/2 b43: ssb: refuse to support more than IEEE 802.11 core

2014-04-20 20:54 GMT+02:00 Michael B?sch <[email protected]>:

Quoted 25 lines
Quoted 5 lines · On Sun, 20 Apr 2014 20:30:58 +0200 Rafa? Mi?ecki <[email protected]> wrote:
drivers/net/wireless/b43/main.c +0 -0
index 69fc3d6..cf84cf2 100644

drivers/net/wireless/b43/main.c int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id) · line 5494

Quoted 10 lines
drivers/net/wireless/b43/main.c +0 -1
@@ -5486,39 +5486,42 @@ int b43_ssb_probe(struct ssb_device *sdev, const struct ssb_device_id *id)
      struct b43_bus_dev *dev;
      struct b43_wl *wl;
      int err;
-     int first = 0;
 
      dev = b43_bus_dev_ssb_init(sdev);
      if (!dev)
              return -ENOMEM;
 
      wl = ssb_get_devtypedata(sdev);

The whole "struct b43_wl" and "ssb_get_devtypedata" was to support multiple cores of the same type in a single driver instance (= b43 multicore).
With multicore support being removed, everything in b43_wl could be merged into b43_wldev. Also the use of ssb_get_devtypedata could probably be removed, too.

Quoted 1 line

This will simplify a lot of the b43 startup and shutdown code.

Yeah, I've noticed that, but this will be a bit complex to clean all that code. I planned to handle this in future with further patches.

Do you think it's OK to push this small patchset and continue cleaning process later? I'm afraid it may take a lot of time to clean in completely and patchset would be huge. That's why I wanted to handle it with small steps.

#5 lore raw

PATCH 1/2 b43: ssb: refuse to support more than IEEE 802.11 core

Quoted 4 lines · On Sun, 20 Apr 2014 21:29:01 +0200 Rafa? Mi?ecki <[email protected]> wrote:

Do you think it's OK to push this small patchset and continue cleaning process later? I'm afraid it may take a lot of time to clean in completely and patchset would be huge. That's why I wanted to handle it with small steps.

Yes absolutely. The changes are huge and small steps are appreciated. Try moving variables one group at a time. Not one huge patch that moves everything. Nobody would be able to review that.

Signature · 13 lines
Michael.

----
Please use PGP/GPG encryption.
Key-ID: F532BE1D908D8B0E
--------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/b43-dev/attachments/20140421/a23c3fc9/attachment.sig>