Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Grazvydas Ignotas and committed by
John W. Linville
e4b3fdb8 1d4b89f2

+12 -57
+9 -23
arch/arm/mach-omap2/board-omap3pandora.c
··· 642 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 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 - { 647 + struct wl12xx_platform_data pandora_wl1251_pdata; 668 648 int ret; 649 + 650 + memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); 669 651 670 652 ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); 671 653 if (ret < 0) ··· 659 677 660 678 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); 661 679 if (pandora_wl1251_pdata.irq < 0) 680 + goto fail_irq; 681 + 682 + pandora_wl1251_pdata.use_eeprom = true; 683 + ret = wl12xx_set_platform_data(&pandora_wl1251_pdata); 684 + if (ret < 0) 662 685 goto fail_irq; 663 686 664 687 return; ··· 678 691 &pandora_leds_gpio, 679 692 &pandora_keys_gpio, 680 693 &pandora_dss_device, 681 - &pandora_wl1251_data, 682 694 &pandora_vwlan_device, 683 695 }; 684 696
+2 -33
drivers/net/wireless/wl1251/sdio.c
··· 43 43 u32 elp_val; 44 44 }; 45 45 46 - static struct wl12xx_platform_data *wl12xx_board_data; 47 - 48 46 static struct sdio_func *wl_to_func(struct wl1251 *wl) 49 47 { 50 48 struct wl1251_sdio *wl_sdio = wl->if_priv; ··· 217 219 .power = wl1251_sdio_set_power, 218 220 }; 219 221 220 - static int wl1251_platform_probe(struct platform_device *pdev) 221 - { 222 - if (pdev->id != -1) { 223 - wl1251_error("can only handle single device"); 224 - return -ENODEV; 225 - } 226 - 227 - wl12xx_board_data = pdev->dev.platform_data; 228 - return 0; 229 - } 230 - 231 - /* 232 - * Dummy platform_driver for passing platform_data to this driver, 233 - * until we have a way to pass this through SDIO subsystem or 234 - * some other way. 235 - */ 236 - static struct platform_driver wl1251_platform_driver = { 237 - .driver = { 238 - .name = "wl1251_data", 239 - .owner = THIS_MODULE, 240 - }, 241 - .probe = wl1251_platform_probe, 242 - }; 243 - 244 222 static int wl1251_sdio_probe(struct sdio_func *func, 245 223 const struct sdio_device_id *id) 246 224 { ··· 224 250 struct wl1251 *wl; 225 251 struct ieee80211_hw *hw; 226 252 struct wl1251_sdio *wl_sdio; 253 + const struct wl12xx_platform_data *wl12xx_board_data; 227 254 228 255 hw = wl1251_alloc_hw(); 229 256 if (IS_ERR(hw)) ··· 251 276 wl->if_priv = wl_sdio; 252 277 wl->if_ops = &wl1251_sdio_ops; 253 278 279 + wl12xx_board_data = wl12xx_get_platform_data(); 254 280 if (wl12xx_board_data != NULL) { 255 281 wl->set_power = wl12xx_board_data->set_power; 256 282 wl->irq = wl12xx_board_data->irq; ··· 354 378 { 355 379 int err; 356 380 357 - err = platform_driver_register(&wl1251_platform_driver); 358 - if (err) { 359 - wl1251_error("failed to register platform driver: %d", err); 360 - return err; 361 - } 362 - 363 381 err = sdio_register_driver(&wl1251_sdio_driver); 364 382 if (err) 365 383 wl1251_error("failed to register sdio driver: %d", err); ··· 363 393 static void __exit wl1251_sdio_exit(void) 364 394 { 365 395 sdio_unregister_driver(&wl1251_sdio_driver); 366 - platform_driver_unregister(&wl1251_platform_driver); 367 396 wl1251_notice("unloaded"); 368 397 } 369 398
+1 -1
drivers/net/wireless/wl12xx/Kconfig
··· 52 52 53 53 config WL12XX_PLATFORM_DATA 54 54 bool 55 - depends on WL1271_SDIO != n 55 + depends on WL1271_SDIO != n || WL1251_SDIO != n 56 56 default y