aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_main.c
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-03-18 12:26:31 +0200
committerJohn W. Linville <linville@tuxdriver.com>2010-03-23 16:50:20 -0400
commita1dd8187d8d8f565976c9e55374dee520cdc2fa3 (patch)
tree79325182613284e2c2a2023a401da32f7b93bd25 /drivers/net/wireless/wl12xx/wl1271_main.c
parentwl1271: Add proper WLAN-BT co-ex configuration, and enable co-ex. (diff)
downloadlinux-dev-a1dd8187d8d8f565976c9e55374dee520cdc2fa3.tar.xz
linux-dev-a1dd8187d8d8f565976c9e55374dee520cdc2fa3.zip
wl1271: Move platform device registration from _spi to _main
In order to get the platform device for both SPI and SDIO, move the platform device registration to wl1271_main.c from wl1271_spi.c. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_main.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 6501d6e2d3b2..ad9c49111678 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -29,6 +29,7 @@
#include <linux/etherdevice.h>
#include <linux/vmalloc.h>
#include <linux/inetdevice.h>
+#include <linux/platform_device.h>
#include "wl1271.h"
#include "wl12xx_80211.h"
@@ -280,6 +281,21 @@ static struct conf_drv_settings default_conf = {
}
};
+static void wl1271_device_release(struct device *dev)
+{
+
+}
+
+static struct platform_device wl1271_device = {
+ .name = "wl1271",
+ .id = -1,
+
+ /* device model insists to have a release function */
+ .dev = {
+ .release = wl1271_device_release,
+ },
+};
+
static LIST_HEAD(wl_list);
static void wl1271_conf_init(struct wl1271 *wl)
@@ -2025,12 +2041,13 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
{
struct ieee80211_hw *hw;
struct wl1271 *wl;
- int i;
+ int i, ret;
hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops);
if (!hw) {
wl1271_error("could not alloc ieee80211_hw");
- return ERR_PTR(-ENOMEM);
+ ret = -ENOMEM;
+ goto err;
}
wl = hw->priv;
@@ -2070,12 +2087,28 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl1271_debugfs_init(wl);
+ /* Register platform device */
+ ret = platform_device_register(&wl1271_device);
+ if (ret) {
+ wl1271_error("couldn't register platform device");
+ goto err_hw;
+ }
+ dev_set_drvdata(&wl1271_device.dev, wl);
+
+
return hw;
+
+err_hw:
+ ieee80211_unregister_hw(wl->hw);
+
+err:
+ return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(wl1271_alloc_hw);
int wl1271_free_hw(struct wl1271 *wl)
{
+ platform_device_unregister(&wl1271_device);
ieee80211_unregister_hw(wl->hw);
wl1271_debugfs_exit(wl);