diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-03-18 06:26:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-23 16:50:20 -0400 |
commit | a1dd8187d8d8f565976c9e55374dee520cdc2fa3 (patch) | |
tree | 79325182613284e2c2a2023a401da32f7b93bd25 | |
parent | 1b00f546fc4271d94c1bccb1955ce64d9ace1000 (diff) |
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>
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_spi.c | 31 |
2 files changed, 37 insertions, 31 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 @@ | |||
29 | #include <linux/etherdevice.h> | 29 | #include <linux/etherdevice.h> |
30 | #include <linux/vmalloc.h> | 30 | #include <linux/vmalloc.h> |
31 | #include <linux/inetdevice.h> | 31 | #include <linux/inetdevice.h> |
32 | #include <linux/platform_device.h> | ||
32 | 33 | ||
33 | #include "wl1271.h" | 34 | #include "wl1271.h" |
34 | #include "wl12xx_80211.h" | 35 | #include "wl12xx_80211.h" |
@@ -280,6 +281,21 @@ static struct conf_drv_settings default_conf = { | |||
280 | } | 281 | } |
281 | }; | 282 | }; |
282 | 283 | ||
284 | static void wl1271_device_release(struct device *dev) | ||
285 | { | ||
286 | |||
287 | } | ||
288 | |||
289 | static struct platform_device wl1271_device = { | ||
290 | .name = "wl1271", | ||
291 | .id = -1, | ||
292 | |||
293 | /* device model insists to have a release function */ | ||
294 | .dev = { | ||
295 | .release = wl1271_device_release, | ||
296 | }, | ||
297 | }; | ||
298 | |||
283 | static LIST_HEAD(wl_list); | 299 | static LIST_HEAD(wl_list); |
284 | 300 | ||
285 | static void wl1271_conf_init(struct wl1271 *wl) | 301 | static void wl1271_conf_init(struct wl1271 *wl) |
@@ -2025,12 +2041,13 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2025 | { | 2041 | { |
2026 | struct ieee80211_hw *hw; | 2042 | struct ieee80211_hw *hw; |
2027 | struct wl1271 *wl; | 2043 | struct wl1271 *wl; |
2028 | int i; | 2044 | int i, ret; |
2029 | 2045 | ||
2030 | hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops); | 2046 | hw = ieee80211_alloc_hw(sizeof(*wl), &wl1271_ops); |
2031 | if (!hw) { | 2047 | if (!hw) { |
2032 | wl1271_error("could not alloc ieee80211_hw"); | 2048 | wl1271_error("could not alloc ieee80211_hw"); |
2033 | return ERR_PTR(-ENOMEM); | 2049 | ret = -ENOMEM; |
2050 | goto err; | ||
2034 | } | 2051 | } |
2035 | 2052 | ||
2036 | wl = hw->priv; | 2053 | wl = hw->priv; |
@@ -2070,12 +2087,28 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
2070 | 2087 | ||
2071 | wl1271_debugfs_init(wl); | 2088 | wl1271_debugfs_init(wl); |
2072 | 2089 | ||
2090 | /* Register platform device */ | ||
2091 | ret = platform_device_register(&wl1271_device); | ||
2092 | if (ret) { | ||
2093 | wl1271_error("couldn't register platform device"); | ||
2094 | goto err_hw; | ||
2095 | } | ||
2096 | dev_set_drvdata(&wl1271_device.dev, wl); | ||
2097 | |||
2098 | |||
2073 | return hw; | 2099 | return hw; |
2100 | |||
2101 | err_hw: | ||
2102 | ieee80211_unregister_hw(wl->hw); | ||
2103 | |||
2104 | err: | ||
2105 | return ERR_PTR(ret); | ||
2074 | } | 2106 | } |
2075 | EXPORT_SYMBOL_GPL(wl1271_alloc_hw); | 2107 | EXPORT_SYMBOL_GPL(wl1271_alloc_hw); |
2076 | 2108 | ||
2077 | int wl1271_free_hw(struct wl1271 *wl) | 2109 | int wl1271_free_hw(struct wl1271 *wl) |
2078 | { | 2110 | { |
2111 | platform_device_unregister(&wl1271_device); | ||
2079 | ieee80211_unregister_hw(wl->hw); | 2112 | ieee80211_unregister_hw(wl->hw); |
2080 | 2113 | ||
2081 | wl1271_debugfs_exit(wl); | 2114 | wl1271_debugfs_exit(wl); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c index 0eea73392ea3..4c129c76c29d 100644 --- a/drivers/net/wireless/wl12xx/wl1271_spi.c +++ b/drivers/net/wireless/wl12xx/wl1271_spi.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/crc7.h> | 26 | #include <linux/crc7.h> |
28 | #include <linux/spi/spi.h> | 27 | #include <linux/spi/spi.h> |
29 | #include <linux/spi/wl12xx.h> | 28 | #include <linux/spi/wl12xx.h> |
@@ -332,21 +331,6 @@ static irqreturn_t wl1271_irq(int irq, void *cookie) | |||
332 | return IRQ_HANDLED; | 331 | return IRQ_HANDLED; |
333 | } | 332 | } |
334 | 333 | ||
335 | static void wl1271_device_release(struct device *dev) | ||
336 | { | ||
337 | |||
338 | } | ||
339 | |||
340 | static struct platform_device wl1271_device = { | ||
341 | .name = "wl1271", | ||
342 | .id = -1, | ||
343 | |||
344 | /* device model insists to have a release function */ | ||
345 | .dev = { | ||
346 | .release = wl1271_device_release, | ||
347 | }, | ||
348 | }; | ||
349 | |||
350 | static void wl1271_spi_set_power(struct wl1271 *wl, bool enable) | 334 | static void wl1271_spi_set_power(struct wl1271 *wl, bool enable) |
351 | { | 335 | { |
352 | if (wl->set_power) | 336 | if (wl->set_power) |
@@ -422,28 +406,18 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
422 | 406 | ||
423 | disable_irq(wl->irq); | 407 | disable_irq(wl->irq); |
424 | 408 | ||
425 | ret = platform_device_register(&wl1271_device); | ||
426 | if (ret) { | ||
427 | wl1271_error("couldn't register platform device"); | ||
428 | goto out_irq; | ||
429 | } | ||
430 | dev_set_drvdata(&wl1271_device.dev, wl); | ||
431 | |||
432 | ret = wl1271_init_ieee80211(wl); | 409 | ret = wl1271_init_ieee80211(wl); |
433 | if (ret) | 410 | if (ret) |
434 | goto out_platform; | 411 | goto out_irq; |
435 | 412 | ||
436 | ret = wl1271_register_hw(wl); | 413 | ret = wl1271_register_hw(wl); |
437 | if (ret) | 414 | if (ret) |
438 | goto out_platform; | 415 | goto out_irq; |
439 | 416 | ||
440 | wl1271_notice("initialized"); | 417 | wl1271_notice("initialized"); |
441 | 418 | ||
442 | return 0; | 419 | return 0; |
443 | 420 | ||
444 | out_platform: | ||
445 | platform_device_unregister(&wl1271_device); | ||
446 | |||
447 | out_irq: | 421 | out_irq: |
448 | free_irq(wl->irq, wl); | 422 | free_irq(wl->irq, wl); |
449 | 423 | ||
@@ -457,7 +431,6 @@ static int __devexit wl1271_remove(struct spi_device *spi) | |||
457 | { | 431 | { |
458 | struct wl1271 *wl = dev_get_drvdata(&spi->dev); | 432 | struct wl1271 *wl = dev_get_drvdata(&spi->dev); |
459 | 433 | ||
460 | platform_device_unregister(&wl1271_device); | ||
461 | free_irq(wl->irq, wl); | 434 | free_irq(wl->irq, wl); |
462 | 435 | ||
463 | wl1271_free_hw(wl); | 436 | wl1271_free_hw(wl); |