diff options
| author | Grazvydas Ignotas <notasas@gmail.com> | 2010-11-03 18:13:49 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2010-11-15 13:27:02 -0500 |
| commit | e4b3fdb80021bc0a3239bfc2a873a6d7c6ac52a1 (patch) | |
| tree | ed955270792c46c6c8687ea0f5d19dc81c9e2a49 | |
| parent | 1d4b89f2970f9ea0902d0a3bc1090f3c770b5080 (diff) | |
wl1251: use wl12xx_platform_data to pass data
Make use the newly added method to pass platform data for wl1251 too.
This allows to eliminate some redundant code.
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Kalle Valo <kvalo@adurom.com>
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3pandora.c | 32 | ||||
| -rw-r--r-- | drivers/net/wireless/wl1251/sdio.c | 35 | ||||
| -rw-r--r-- | drivers/net/wireless/wl12xx/Kconfig | 2 |
3 files changed, 12 insertions, 57 deletions
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 89ed1be2d62e..8be261506056 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
| @@ -642,31 +642,13 @@ static void __init omap3pandora_init_irq(void) | |||
| 642 | omap_gpio_init(); | 642 | omap_gpio_init(); |
| 643 | } | 643 | } |
| 644 | 644 | ||
| 645 | static void pandora_wl1251_set_power(bool enable) | 645 | static void __init pandora_wl1251_init(void) |
| 646 | { | ||
| 647 | /* | ||
| 648 | * Keep power always on until wl1251_sdio driver learns to re-init | ||
| 649 | * the chip after powering it down and back up. | ||
| 650 | */ | ||
| 651 | } | ||
| 652 | |||
| 653 | static struct wl12xx_platform_data pandora_wl1251_pdata = { | ||
| 654 | .set_power = pandora_wl1251_set_power, | ||
| 655 | .use_eeprom = true, | ||
| 656 | }; | ||
| 657 | |||
| 658 | static struct platform_device pandora_wl1251_data = { | ||
| 659 | .name = "wl1251_data", | ||
| 660 | .id = -1, | ||
| 661 | .dev = { | ||
| 662 | .platform_data = &pandora_wl1251_pdata, | ||
| 663 | }, | ||
| 664 | }; | ||
| 665 | |||
| 666 | static void pandora_wl1251_init(void) | ||
| 667 | { | 646 | { |
| 647 | struct wl12xx_platform_data pandora_wl1251_pdata; | ||
| 668 | int ret; | 648 | int ret; |
| 669 | 649 | ||
| 650 | memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); | ||
| 651 | |||
| 670 | ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); | 652 | ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); |
| 671 | if (ret < 0) | 653 | if (ret < 0) |
| 672 | goto fail; | 654 | goto fail; |
| @@ -679,6 +661,11 @@ static void pandora_wl1251_init(void) | |||
| 679 | if (pandora_wl1251_pdata.irq < 0) | 661 | if (pandora_wl1251_pdata.irq < 0) |
| 680 | goto fail_irq; | 662 | goto fail_irq; |
| 681 | 663 | ||
| 664 | pandora_wl1251_pdata.use_eeprom = true; | ||
| 665 | ret = wl12xx_set_platform_data(&pandora_wl1251_pdata); | ||
| 666 | if (ret < 0) | ||
| 667 | goto fail_irq; | ||
| 668 | |||
| 682 | return; | 669 | return; |
| 683 | 670 | ||
| 684 | fail_irq: | 671 | fail_irq: |
| @@ -691,7 +678,6 @@ static struct platform_device *omap3pandora_devices[] __initdata = { | |||
| 691 | &pandora_leds_gpio, | 678 | &pandora_leds_gpio, |
| 692 | &pandora_keys_gpio, | 679 | &pandora_keys_gpio, |
| 693 | &pandora_dss_device, | 680 | &pandora_dss_device, |
| 694 | &pandora_wl1251_data, | ||
| 695 | &pandora_vwlan_device, | 681 | &pandora_vwlan_device, |
| 696 | }; | 682 | }; |
| 697 | 683 | ||
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c index f3e185efe124..596d90ecba33 100644 --- a/drivers/net/wireless/wl1251/sdio.c +++ b/drivers/net/wireless/wl1251/sdio.c | |||
| @@ -43,8 +43,6 @@ struct wl1251_sdio { | |||
| 43 | u32 elp_val; | 43 | u32 elp_val; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static struct wl12xx_platform_data *wl12xx_board_data; | ||
| 47 | |||
| 48 | static struct sdio_func *wl_to_func(struct wl1251 *wl) | 46 | static struct sdio_func *wl_to_func(struct wl1251 *wl) |
| 49 | { | 47 | { |
| 50 | struct wl1251_sdio *wl_sdio = wl->if_priv; | 48 | struct wl1251_sdio *wl_sdio = wl->if_priv; |
| @@ -219,30 +217,6 @@ static struct wl1251_if_operations wl1251_sdio_ops = { | |||
| 219 | .power = wl1251_sdio_set_power, | 217 | .power = wl1251_sdio_set_power, |
| 220 | }; | 218 | }; |
| 221 | 219 | ||
| 222 | static int wl1251_platform_probe(struct platform_device *pdev) | ||
| 223 | { | ||
| 224 | if (pdev->id != -1) { | ||
| 225 | wl1251_error("can only handle single device"); | ||
| 226 | return -ENODEV; | ||
| 227 | } | ||
| 228 | |||
| 229 | wl12xx_board_data = pdev->dev.platform_data; | ||
| 230 | return 0; | ||
| 231 | } | ||
| 232 | |||
| 233 | /* | ||
| 234 | * Dummy platform_driver for passing platform_data to this driver, | ||
| 235 | * until we have a way to pass this through SDIO subsystem or | ||
| 236 | * some other way. | ||
| 237 | */ | ||
| 238 | static struct platform_driver wl1251_platform_driver = { | ||
| 239 | .driver = { | ||
| 240 | .name = "wl1251_data", | ||
| 241 | .owner = THIS_MODULE, | ||
| 242 | }, | ||
| 243 | .probe = wl1251_platform_probe, | ||
| 244 | }; | ||
| 245 | |||
| 246 | static int wl1251_sdio_probe(struct sdio_func *func, | 220 | static int wl1251_sdio_probe(struct sdio_func *func, |
| 247 | const struct sdio_device_id *id) | 221 | const struct sdio_device_id *id) |
| 248 | { | 222 | { |
| @@ -250,6 +224,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, | |||
| 250 | struct wl1251 *wl; | 224 | struct wl1251 *wl; |
| 251 | struct ieee80211_hw *hw; | 225 | struct ieee80211_hw *hw; |
| 252 | struct wl1251_sdio *wl_sdio; | 226 | struct wl1251_sdio *wl_sdio; |
| 227 | const struct wl12xx_platform_data *wl12xx_board_data; | ||
| 253 | 228 | ||
| 254 | hw = wl1251_alloc_hw(); | 229 | hw = wl1251_alloc_hw(); |
| 255 | if (IS_ERR(hw)) | 230 | if (IS_ERR(hw)) |
| @@ -276,6 +251,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, | |||
| 276 | wl->if_priv = wl_sdio; | 251 | wl->if_priv = wl_sdio; |
| 277 | wl->if_ops = &wl1251_sdio_ops; | 252 | wl->if_ops = &wl1251_sdio_ops; |
| 278 | 253 | ||
| 254 | wl12xx_board_data = wl12xx_get_platform_data(); | ||
| 279 | if (wl12xx_board_data != NULL) { | 255 | if (wl12xx_board_data != NULL) { |
| 280 | wl->set_power = wl12xx_board_data->set_power; | 256 | wl->set_power = wl12xx_board_data->set_power; |
| 281 | wl->irq = wl12xx_board_data->irq; | 257 | wl->irq = wl12xx_board_data->irq; |
| @@ -378,12 +354,6 @@ static int __init wl1251_sdio_init(void) | |||
| 378 | { | 354 | { |
| 379 | int err; | 355 | int err; |
| 380 | 356 | ||
| 381 | err = platform_driver_register(&wl1251_platform_driver); | ||
| 382 | if (err) { | ||
| 383 | wl1251_error("failed to register platform driver: %d", err); | ||
| 384 | return err; | ||
| 385 | } | ||
| 386 | |||
| 387 | err = sdio_register_driver(&wl1251_sdio_driver); | 357 | err = sdio_register_driver(&wl1251_sdio_driver); |
| 388 | if (err) | 358 | if (err) |
| 389 | wl1251_error("failed to register sdio driver: %d", err); | 359 | wl1251_error("failed to register sdio driver: %d", err); |
| @@ -393,7 +363,6 @@ static int __init wl1251_sdio_init(void) | |||
| 393 | static void __exit wl1251_sdio_exit(void) | 363 | static void __exit wl1251_sdio_exit(void) |
| 394 | { | 364 | { |
| 395 | sdio_unregister_driver(&wl1251_sdio_driver); | 365 | sdio_unregister_driver(&wl1251_sdio_driver); |
| 396 | platform_driver_unregister(&wl1251_platform_driver); | ||
| 397 | wl1251_notice("unloaded"); | 366 | wl1251_notice("unloaded"); |
| 398 | } | 367 | } |
| 399 | 368 | ||
diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig index 1b3b7bdd6a19..02ad4bc15976 100644 --- a/drivers/net/wireless/wl12xx/Kconfig +++ b/drivers/net/wireless/wl12xx/Kconfig | |||
| @@ -52,5 +52,5 @@ config WL1271_SDIO | |||
| 52 | 52 | ||
| 53 | config WL12XX_PLATFORM_DATA | 53 | config WL12XX_PLATFORM_DATA |
| 54 | bool | 54 | bool |
| 55 | depends on WL1271_SDIO != n | 55 | depends on WL1271_SDIO != n || WL1251_SDIO != n |
| 56 | default y | 56 | default y |
