提交 2ac71072 编写于 作者: C Christian Lamparter 提交者: John W. Linville

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: NChristian Lamparter <chunkeey@web.de>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 fbf95296
......@@ -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 */
......@@ -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;
......
......@@ -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;
......
......@@ -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:
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册