summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2009-03-05 21:30:10 +0100
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:27 -0400
commit2ac710720c523dd243662746da4381dd4f1772f8 (patch)
treeb57dc667249ee4cbacbcc8f33686637ee3c304b2
parentfbf95296c1c8b1ba09bdea0438ce2c61e0e3be5d (diff)
downloadblackbird-op-linux-2ac710720c523dd243662746da4381dd4f1772f8.tar.gz
blackbird-op-linux-2ac710720c523dd243662746da4381dd4f1772f8.zip
p54: unify ieee80211 device registration
All three drivers (p54pci, p54usb and p54spi) are implementing the same functionality three times. So, why not put it into the shared library?! Signed-off-by: Christian Lamparter <chunkeey@web.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/p54/p54.h1
-rw-r--r--drivers/net/wireless/p54/p54common.c15
-rw-r--r--drivers/net/wireless/p54/p54pci.c7
-rw-r--r--drivers/net/wireless/p54/p54spi.c9
-rw-r--r--drivers/net/wireless/p54/p54usb.c6
5 files changed, 22 insertions, 16 deletions
diff --git a/drivers/net/wireless/p54/p54.h b/drivers/net/wireless/p54/p54.h
index 94c3acd1fcaf..071cbe965377 100644
--- a/drivers/net/wireless/p54/p54.h
+++ b/drivers/net/wireless/p54/p54.h
@@ -165,6 +165,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw);
int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len);
int p54_read_eeprom(struct ieee80211_hw *dev);
struct ieee80211_hw *p54_init_common(size_t priv_data_len);
+int p54_register_common(struct ieee80211_hw *dev, struct device *pdev);
void p54_free_common(struct ieee80211_hw *dev);
#endif /* P54_H */
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c
index 14438a642fdd..42d1cac609a1 100644
--- a/drivers/net/wireless/p54/p54common.c
+++ b/drivers/net/wireless/p54/p54common.c
@@ -2489,6 +2489,21 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
}
EXPORT_SYMBOL_GPL(p54_init_common);
+int p54_register_common(struct ieee80211_hw *dev, struct device *pdev)
+{
+ int err;
+
+ err = ieee80211_register_hw(dev);
+ if (err) {
+ dev_err(pdev, "Cannot register device (%d).\n", err);
+ return err;
+ }
+
+ dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy));
+ return 0;
+}
+EXPORT_SYMBOL_GPL(p54_register_common);
+
void p54_free_common(struct ieee80211_hw *dev)
{
struct p54_common *priv = dev->priv;
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
index 3f9a6b04ea95..46626e5dcbbe 100644
--- a/drivers/net/wireless/p54/p54pci.c
+++ b/drivers/net/wireless/p54/p54pci.c
@@ -565,12 +565,9 @@ static int __devinit p54p_probe(struct pci_dev *pdev,
if (err)
goto err_free_common;
- err = ieee80211_register_hw(dev);
- if (err) {
- printk(KERN_ERR "%s (p54pci): Cannot register netdevice\n",
- pci_name(pdev));
+ err = p54_register_common(dev, &pdev->dev);
+ if (err)
goto err_free_common;
- }
return 0;
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 7fde243b3d5d..2b222aaa6f0a 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -694,15 +694,10 @@ static int __devinit p54spi_probe(struct spi_device *spi)
if (ret)
goto err_free_common;
- ret = ieee80211_register_hw(hw);
- if (ret) {
- dev_err(&priv->spi->dev, "unable to register "
- "mac80211 hw: %d", ret);
+ ret = p54_register_common(hw, &priv->spi->dev);
+ if (ret)
goto err_free_common;
- }
- dev_info(&priv->spi->dev, "device is bound to %s\n",
- wiphy_name(hw->wiphy));
return 0;
err_free_common:
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c
index 3b5e54e6793d..da6640afc835 100644
--- a/drivers/net/wireless/p54/p54usb.c
+++ b/drivers/net/wireless/p54/p54usb.c
@@ -976,11 +976,9 @@ static int __devinit p54u_probe(struct usb_interface *intf,
if (err)
goto err_free_dev;
- err = ieee80211_register_hw(dev);
- if (err) {
- dev_err(&udev->dev, "(p54usb) Cannot register netdevice\n");
+ err = p54_register_common(dev, &udev->dev);
+ if (err)
goto err_free_dev;
- }
return 0;
OpenPOWER on IntegriCloud