Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0355a345 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville
Browse files

b43: make b43_wireless_init less bus specific

parent 620d785b
Loading
Loading
Loading
Loading
+10 −13
Original line number Original line Diff line number Diff line
@@ -4925,19 +4925,16 @@ static void b43_wireless_exit(struct ssb_device *dev, struct b43_wl *wl)
	ieee80211_free_hw(hw);
	ieee80211_free_hw(hw);
}
}


static int b43_wireless_init(struct ssb_device *dev)
static struct b43_wl *b43_wireless_init(struct ssb_device *dev)
{
{
	struct ssb_sprom *sprom = &dev->bus->sprom;
	struct ssb_sprom *sprom = &dev->bus->sprom;
	struct ieee80211_hw *hw;
	struct ieee80211_hw *hw;
	struct b43_wl *wl;
	struct b43_wl *wl;
	int err = -ENOMEM;

	b43_sprom_fixup(dev->bus);


	hw = ieee80211_alloc_hw(sizeof(*wl), &b43_hw_ops);
	hw = ieee80211_alloc_hw(sizeof(*wl), &b43_hw_ops);
	if (!hw) {
	if (!hw) {
		b43err(NULL, "Could not allocate ieee80211 device\n");
		b43err(NULL, "Could not allocate ieee80211 device\n");
		goto out;
		return ERR_PTR(-ENOMEM);
	}
	}
	wl = hw_to_b43_wl(hw);
	wl = hw_to_b43_wl(hw);


@@ -4971,12 +4968,9 @@ static int b43_wireless_init(struct ssb_device *dev)
	INIT_WORK(&wl->tx_work, b43_tx_work);
	INIT_WORK(&wl->tx_work, b43_tx_work);
	skb_queue_head_init(&wl->tx_queue);
	skb_queue_head_init(&wl->tx_queue);


	ssb_set_devtypedata(dev, wl);
	b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
	b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
		dev->bus->chip_id, dev->id.revision);
		dev->bus->chip_id, dev->id.revision);
	err = 0;
	return wl;
out:
	return err;
}
}


static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
@@ -4989,11 +4983,14 @@ static int b43_ssb_probe(struct ssb_device *dev, const struct ssb_device_id *id)
	if (!wl) {
	if (!wl) {
		/* Probing the first core. Must setup common struct b43_wl */
		/* Probing the first core. Must setup common struct b43_wl */
		first = 1;
		first = 1;
		err = b43_wireless_init(dev);
		b43_sprom_fixup(dev->bus);
		if (err)
		wl = b43_wireless_init(dev);
		if (IS_ERR(wl)) {
			err = PTR_ERR(wl);
			goto out;
			goto out;
		wl = ssb_get_devtypedata(dev);
		}
		B43_WARN_ON(!wl);
		ssb_set_devtypedata(dev, wl);
		B43_WARN_ON(ssb_get_devtypedata(dev) != wl);
	}
	}
	err = b43_one_core_attach(dev, wl);
	err = b43_one_core_attach(dev, wl);
	if (err)
	if (err)