b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core
@ 2014-04-20 18:30 Rafał Miłecki
  2014-04-20 18:30 ` [wireless-next][PATCH 2/2] b43: remove leftover code for dual-core devices support Rafał Miłecki
  2014-04-20 18:54 ` [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Michael Büsch
  0 siblings, 2 replies; 6+ messages in thread
From: Rafał Miłecki @ 2014-04-20 18:30 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

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.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
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(-)

diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 69fc3d6..cf84cf2 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -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;
 }
 
-- 
1.8.4.5

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

* [wireless-next][PATCH 2/2] b43: remove leftover code for dual-core devices support
  2014-04-20 18:30 [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Rafał Miłecki
@ 2014-04-20 18:30 ` Rafał Miłecki
  2014-04-21  8:54   ` [wireless-next][PATCH V2 2/2] b43: remove list of IEEE 802.11 devices Rafał Miłecki
  2014-04-20 18:54 ` [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Michael Büsch
  1 sibling, 1 reply; 6+ messages in thread
From: Rafał Miłecki @ 2014-04-20 18:30 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
 drivers/net/wireless/b43/b43.h  |  4 ----
 drivers/net/wireless/b43/main.c | 52 +++++++++++++++--------------------------
 2 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 54376fd..4113b69 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -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;
 
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index cf84cf2..07024c6 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3735,40 +3735,35 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan)
 {
 	struct b43_wldev *up_dev = NULL;
 	struct b43_wldev *down_dev;
-	struct b43_wldev *d;
 	int err;
 	bool uninitialized_var(gmode);
 	int prev_status;
 
 	/* Find a device and PHY which supports the band. */
-	list_for_each_entry(d, &wl->devlist, list) {
-		switch (chan->band) {
-		case IEEE80211_BAND_5GHZ:
-			if (d->phy.supports_5ghz) {
-				up_dev = d;
-				gmode = false;
-			}
-			break;
-		case IEEE80211_BAND_2GHZ:
-			if (d->phy.supports_2ghz) {
-				up_dev = d;
-				gmode = true;
-			}
-			break;
-		default:
-			B43_WARN_ON(1);
-			return -EINVAL;
+	switch (chan->band) {
+	case IEEE80211_BAND_5GHZ:
+		if (wl->current_dev->phy.supports_5ghz) {
+			up_dev = wl->current_dev;
+			gmode = false;
 		}
-		if (up_dev)
-			break;
+		break;
+	case IEEE80211_BAND_2GHZ:
+		if (wl->current_dev->phy.supports_2ghz) {
+			up_dev = wl->current_dev;
+			gmode = true;
+		}
+		break;
+	default:
+		B43_WARN_ON(1);
+		return -EINVAL;
 	}
+
 	if (!up_dev) {
 		b43err(wl, "Could not find a device for %s-GHz band operation\n",
 		       band_to_string(chan->band));
 		return -ENODEV;
 	}
-	if ((up_dev == wl->current_dev) &&
-	    (!!wl->current_dev->phy.gmode == !!gmode)) {
+	if (!!wl->current_dev->phy.gmode == !!gmode) {
 		/* This device is already running. */
 		return 0;
 	}
@@ -5270,7 +5265,6 @@ static void b43_one_core_detach(struct b43_bus_dev *dev)
 	b43_debugfs_remove_device(wldev);
 	b43_wireless_core_detach(wldev);
 	list_del(&wldev->list);
-	wl->nr_devs--;
 	b43_bus_set_wldev(dev, NULL);
 	kfree(wldev);
 }
@@ -5295,8 +5289,6 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl)
 	if (err)
 		goto err_kfree_wldev;
 
-	list_add(&wldev->list, &wl->devlist);
-	wl->nr_devs++;
 	b43_bus_set_wldev(dev, wldev);
 	b43_debugfs_add_device(wldev);
 
@@ -5386,7 +5378,6 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 	wl->hw = hw;
 	mutex_init(&wl->mutex);
 	spin_lock_init(&wl->hardirq_lock);
-	INIT_LIST_HEAD(&wl->devlist);
 	INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work);
 	INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
 	INIT_WORK(&wl->tx_work, b43_tx_work);
@@ -5549,13 +5540,8 @@ static void b43_ssb_remove(struct ssb_device *sdev)
 	/* Unregister HW RNG driver */
 	b43_rng_exit(wl);
 
-	if (list_empty(&wl->devlist)) {
-		b43_leds_unregister(wl);
-		/* Last core on the chip unregistered.
-		 * We can destroy common struct b43_wl.
-		 */
-		b43_wireless_exit(dev, wl);
-	}
+	b43_leds_unregister(wl);
+	b43_wireless_exit(dev, wl);
 }
 
 static struct ssb_driver b43_ssb_driver = {
-- 
1.8.4.5

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

* [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core
  2014-04-20 18:30 [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Rafał Miłecki
  2014-04-20 18:30 ` [wireless-next][PATCH 2/2] b43: remove leftover code for dual-core devices support Rafał Miłecki
@ 2014-04-20 18:54 ` Michael Büsch
  2014-04-20 19:29   ` Rafał Miłecki
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Büsch @ 2014-04-20 18:54 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville, b43-dev

On Sun, 20 Apr 2014 20:30:58 +0200
Rafa? Mi?ecki <zajec5@gmail.com> wrote:

> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
> index 69fc3d6..cf84cf2 100644
> --- a/drivers/net/wireless/b43/main.c
> +++ b/drivers/net/wireless/b43/main.c
> @@ -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.


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

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

* [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core
  2014-04-20 18:54 ` [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Michael Büsch
@ 2014-04-20 19:29   ` Rafał Miłecki
  2014-04-20 22:36     ` Michael Büsch
  0 siblings, 1 reply; 6+ messages in thread
From: Rafał Miłecki @ 2014-04-20 19:29 UTC (permalink / raw)
  To: Michael Büsch
  Cc: linux-wireless@vger.kernel.org, John W. Linville, b43-dev

2014-04-20 20:54 GMT+02:00 Michael B?sch <m@bues.ch>:
> On Sun, 20 Apr 2014 20:30:58 +0200
> Rafa? Mi?ecki <zajec5@gmail.com> wrote:
>
>> diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
>> index 69fc3d6..cf84cf2 100644
>> --- a/drivers/net/wireless/b43/main.c
>> +++ b/drivers/net/wireless/b43/main.c
>> @@ -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.

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.

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

* [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core
  2014-04-20 19:29   ` Rafał Miłecki
@ 2014-04-20 22:36     ` Michael Büsch
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Büsch @ 2014-04-20 22:36 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: linux-wireless@vger.kernel.org, John W. Linville, b43-dev

On Sun, 20 Apr 2014 21:29:01 +0200
Rafa? Mi?ecki <zajec5@gmail.com> 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.

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

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

* [wireless-next][PATCH V2 2/2] b43: remove list of IEEE 802.11 devices
  2014-04-20 18:30 ` [wireless-next][PATCH 2/2] b43: remove leftover code for dual-core devices support Rafał Miłecki
@ 2014-04-21  8:54   ` Rafał Miłecki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2014-04-21  8:54 UTC (permalink / raw)
  To: linux-wireless, John W. Linville; +Cc: b43-dev, Rafał Miłecki

This is the first step to remove leftover code.

Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
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(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 54376fd..4113b69 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -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;
 
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index cf84cf2..07024c6 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3735,40 +3735,35 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan)
 {
 	struct b43_wldev *up_dev = NULL;
 	struct b43_wldev *down_dev;
-	struct b43_wldev *d;
 	int err;
 	bool uninitialized_var(gmode);
 	int prev_status;
 
 	/* Find a device and PHY which supports the band. */
-	list_for_each_entry(d, &wl->devlist, list) {
-		switch (chan->band) {
-		case IEEE80211_BAND_5GHZ:
-			if (d->phy.supports_5ghz) {
-				up_dev = d;
-				gmode = false;
-			}
-			break;
-		case IEEE80211_BAND_2GHZ:
-			if (d->phy.supports_2ghz) {
-				up_dev = d;
-				gmode = true;
-			}
-			break;
-		default:
-			B43_WARN_ON(1);
-			return -EINVAL;
+	switch (chan->band) {
+	case IEEE80211_BAND_5GHZ:
+		if (wl->current_dev->phy.supports_5ghz) {
+			up_dev = wl->current_dev;
+			gmode = false;
 		}
-		if (up_dev)
-			break;
+		break;
+	case IEEE80211_BAND_2GHZ:
+		if (wl->current_dev->phy.supports_2ghz) {
+			up_dev = wl->current_dev;
+			gmode = true;
+		}
+		break;
+	default:
+		B43_WARN_ON(1);
+		return -EINVAL;
 	}
+
 	if (!up_dev) {
 		b43err(wl, "Could not find a device for %s-GHz band operation\n",
 		       band_to_string(chan->band));
 		return -ENODEV;
 	}
-	if ((up_dev == wl->current_dev) &&
-	    (!!wl->current_dev->phy.gmode == !!gmode)) {
+	if (!!wl->current_dev->phy.gmode == !!gmode) {
 		/* This device is already running. */
 		return 0;
 	}
@@ -5270,7 +5265,6 @@ static void b43_one_core_detach(struct b43_bus_dev *dev)
 	b43_debugfs_remove_device(wldev);
 	b43_wireless_core_detach(wldev);
 	list_del(&wldev->list);
-	wl->nr_devs--;
 	b43_bus_set_wldev(dev, NULL);
 	kfree(wldev);
 }
@@ -5295,8 +5289,6 @@ static int b43_one_core_attach(struct b43_bus_dev *dev, struct b43_wl *wl)
 	if (err)
 		goto err_kfree_wldev;
 
-	list_add(&wldev->list, &wl->devlist);
-	wl->nr_devs++;
 	b43_bus_set_wldev(dev, wldev);
 	b43_debugfs_add_device(wldev);
 
@@ -5386,7 +5378,6 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev)
 	wl->hw = hw;
 	mutex_init(&wl->mutex);
 	spin_lock_init(&wl->hardirq_lock);
-	INIT_LIST_HEAD(&wl->devlist);
 	INIT_WORK(&wl->beacon_update_trigger, b43_beacon_update_trigger_work);
 	INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
 	INIT_WORK(&wl->tx_work, b43_tx_work);
@@ -5549,13 +5540,8 @@ static void b43_ssb_remove(struct ssb_device *sdev)
 	/* Unregister HW RNG driver */
 	b43_rng_exit(wl);
 
-	if (list_empty(&wl->devlist)) {
-		b43_leds_unregister(wl);
-		/* Last core on the chip unregistered.
-		 * We can destroy common struct b43_wl.
-		 */
-		b43_wireless_exit(dev, wl);
-	}
+	b43_leds_unregister(wl);
+	b43_wireless_exit(dev, wl);
 }
 
 static struct ssb_driver b43_ssb_driver = {
-- 
1.8.4.5

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

end of thread, other threads:[~2014-04-21  8:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-20 18:30 [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Rafał Miłecki
2014-04-20 18:30 ` [wireless-next][PATCH 2/2] b43: remove leftover code for dual-core devices support Rafał Miłecki
2014-04-21  8:54   ` [wireless-next][PATCH V2 2/2] b43: remove list of IEEE 802.11 devices Rafał Miłecki
2014-04-20 18:54 ` [wireless-next][PATCH 1/2] b43: ssb: refuse to support more than IEEE 802.11 core Michael Büsch
2014-04-20 19:29   ` Rafał Miłecki
2014-04-20 22:36     ` Michael Büsch

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).