aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@web.de>2009-03-05 15:30:10 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:27 -0400
commit2ac710720c523dd243662746da4381dd4f1772f8 (patch)
treeb57dc667249ee4cbacbcc8f33686637ee3c304b2
parentfbf95296c1c8b1ba09bdea0438ce2c61e0e3be5d (diff)
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);
165int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len); 165int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len);
166int p54_read_eeprom(struct ieee80211_hw *dev); 166int p54_read_eeprom(struct ieee80211_hw *dev);
167struct ieee80211_hw *p54_init_common(size_t priv_data_len); 167struct ieee80211_hw *p54_init_common(size_t priv_data_len);
168int p54_register_common(struct ieee80211_hw *dev, struct device *pdev);
168void p54_free_common(struct ieee80211_hw *dev); 169void p54_free_common(struct ieee80211_hw *dev);
169 170
170#endif /* P54_H */ 171#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)
2489} 2489}
2490EXPORT_SYMBOL_GPL(p54_init_common); 2490EXPORT_SYMBOL_GPL(p54_init_common);
2491 2491
2492int p54_register_common(struct ieee80211_hw *dev, struct device *pdev)
2493{
2494 int err;
2495
2496 err = ieee80211_register_hw(dev);
2497 if (err) {
2498 dev_err(pdev, "Cannot register device (%d).\n", err);
2499 return err;
2500 }
2501
2502 dev_info(pdev, "is registered as '%s'\n", wiphy_name(dev->wiphy));
2503 return 0;
2504}
2505EXPORT_SYMBOL_GPL(p54_register_common);
2506
2492void p54_free_common(struct ieee80211_hw *dev) 2507void p54_free_common(struct ieee80211_hw *dev)
2493{ 2508{
2494 struct p54_common *priv = dev->priv; 2509 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,
565 if (err) 565 if (err)
566 goto err_free_common; 566 goto err_free_common;
567 567
568 err = ieee80211_register_hw(dev); 568 err = p54_register_common(dev, &pdev->dev);
569 if (err) { 569 if (err)
570 printk(KERN_ERR "%s (p54pci): Cannot register netdevice\n",
571 pci_name(pdev));
572 goto err_free_common; 570 goto err_free_common;
573 }
574 571
575 return 0; 572 return 0;
576 573
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)
694 if (ret) 694 if (ret)
695 goto err_free_common; 695 goto err_free_common;
696 696
697 ret = ieee80211_register_hw(hw); 697 ret = p54_register_common(hw, &priv->spi->dev);
698 if (ret) { 698 if (ret)
699 dev_err(&priv->spi->dev, "unable to register "
700 "mac80211 hw: %d", ret);
701 goto err_free_common; 699 goto err_free_common;
702 }
703 700
704 dev_info(&priv->spi->dev, "device is bound to %s\n",
705 wiphy_name(hw->wiphy));
706 return 0; 701 return 0;
707 702
708err_free_common: 703err_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,
976 if (err) 976 if (err)
977 goto err_free_dev; 977 goto err_free_dev;
978 978
979 err = ieee80211_register_hw(dev); 979 err = p54_register_common(dev, &udev->dev);
980 if (err) { 980 if (err)
981 dev_err(&udev->dev, "(p54usb) Cannot register netdevice\n");
982 goto err_free_dev; 981 goto err_free_dev;
983 }
984 982
985 return 0; 983 return 0;
986 984