Commit e4b3fdb8 authored by Grazvydas Ignotas's avatar Grazvydas Ignotas Committed by John W. Linville

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: default avatarGrazvydas Ignotas <notasas@gmail.com>
Acked-by: default avatarKalle Valo <kvalo@adurom.com>
Acked-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 1d4b89f2
...@@ -642,31 +642,13 @@ static void __init omap3pandora_init_irq(void) ...@@ -642,31 +642,13 @@ static void __init omap3pandora_init_irq(void)
omap_gpio_init(); omap_gpio_init();
} }
static void pandora_wl1251_set_power(bool enable) static void __init pandora_wl1251_init(void)
{
/*
* Keep power always on until wl1251_sdio driver learns to re-init
* the chip after powering it down and back up.
*/
}
static struct wl12xx_platform_data pandora_wl1251_pdata = {
.set_power = pandora_wl1251_set_power,
.use_eeprom = true,
};
static struct platform_device pandora_wl1251_data = {
.name = "wl1251_data",
.id = -1,
.dev = {
.platform_data = &pandora_wl1251_pdata,
},
};
static void pandora_wl1251_init(void)
{ {
struct wl12xx_platform_data pandora_wl1251_pdata;
int ret; int ret;
memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq");
if (ret < 0) if (ret < 0)
goto fail; goto fail;
...@@ -679,6 +661,11 @@ static void pandora_wl1251_init(void) ...@@ -679,6 +661,11 @@ static void pandora_wl1251_init(void)
if (pandora_wl1251_pdata.irq < 0) if (pandora_wl1251_pdata.irq < 0)
goto fail_irq; goto fail_irq;
pandora_wl1251_pdata.use_eeprom = true;
ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
if (ret < 0)
goto fail_irq;
return; return;
fail_irq: fail_irq:
...@@ -691,7 +678,6 @@ static struct platform_device *omap3pandora_devices[] __initdata = { ...@@ -691,7 +678,6 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
&pandora_leds_gpio, &pandora_leds_gpio,
&pandora_keys_gpio, &pandora_keys_gpio,
&pandora_dss_device, &pandora_dss_device,
&pandora_wl1251_data,
&pandora_vwlan_device, &pandora_vwlan_device,
}; };
......
...@@ -43,8 +43,6 @@ struct wl1251_sdio { ...@@ -43,8 +43,6 @@ struct wl1251_sdio {
u32 elp_val; u32 elp_val;
}; };
static struct wl12xx_platform_data *wl12xx_board_data;
static struct sdio_func *wl_to_func(struct wl1251 *wl) static struct sdio_func *wl_to_func(struct wl1251 *wl)
{ {
struct wl1251_sdio *wl_sdio = wl->if_priv; struct wl1251_sdio *wl_sdio = wl->if_priv;
...@@ -219,30 +217,6 @@ static struct wl1251_if_operations wl1251_sdio_ops = { ...@@ -219,30 +217,6 @@ static struct wl1251_if_operations wl1251_sdio_ops = {
.power = wl1251_sdio_set_power, .power = wl1251_sdio_set_power,
}; };
static int wl1251_platform_probe(struct platform_device *pdev)
{
if (pdev->id != -1) {
wl1251_error("can only handle single device");
return -ENODEV;
}
wl12xx_board_data = pdev->dev.platform_data;
return 0;
}
/*
* Dummy platform_driver for passing platform_data to this driver,
* until we have a way to pass this through SDIO subsystem or
* some other way.
*/
static struct platform_driver wl1251_platform_driver = {
.driver = {
.name = "wl1251_data",
.owner = THIS_MODULE,
},
.probe = wl1251_platform_probe,
};
static int wl1251_sdio_probe(struct sdio_func *func, static int wl1251_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id) const struct sdio_device_id *id)
{ {
...@@ -250,6 +224,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, ...@@ -250,6 +224,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
struct wl1251 *wl; struct wl1251 *wl;
struct ieee80211_hw *hw; struct ieee80211_hw *hw;
struct wl1251_sdio *wl_sdio; struct wl1251_sdio *wl_sdio;
const struct wl12xx_platform_data *wl12xx_board_data;
hw = wl1251_alloc_hw(); hw = wl1251_alloc_hw();
if (IS_ERR(hw)) if (IS_ERR(hw))
...@@ -276,6 +251,7 @@ static int wl1251_sdio_probe(struct sdio_func *func, ...@@ -276,6 +251,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
wl->if_priv = wl_sdio; wl->if_priv = wl_sdio;
wl->if_ops = &wl1251_sdio_ops; wl->if_ops = &wl1251_sdio_ops;
wl12xx_board_data = wl12xx_get_platform_data();
if (wl12xx_board_data != NULL) { if (wl12xx_board_data != NULL) {
wl->set_power = wl12xx_board_data->set_power; wl->set_power = wl12xx_board_data->set_power;
wl->irq = wl12xx_board_data->irq; wl->irq = wl12xx_board_data->irq;
...@@ -378,12 +354,6 @@ static int __init wl1251_sdio_init(void) ...@@ -378,12 +354,6 @@ static int __init wl1251_sdio_init(void)
{ {
int err; int err;
err = platform_driver_register(&wl1251_platform_driver);
if (err) {
wl1251_error("failed to register platform driver: %d", err);
return err;
}
err = sdio_register_driver(&wl1251_sdio_driver); err = sdio_register_driver(&wl1251_sdio_driver);
if (err) if (err)
wl1251_error("failed to register sdio driver: %d", err); wl1251_error("failed to register sdio driver: %d", err);
...@@ -393,7 +363,6 @@ static int __init wl1251_sdio_init(void) ...@@ -393,7 +363,6 @@ static int __init wl1251_sdio_init(void)
static void __exit wl1251_sdio_exit(void) static void __exit wl1251_sdio_exit(void)
{ {
sdio_unregister_driver(&wl1251_sdio_driver); sdio_unregister_driver(&wl1251_sdio_driver);
platform_driver_unregister(&wl1251_platform_driver);
wl1251_notice("unloaded"); wl1251_notice("unloaded");
} }
......
...@@ -52,5 +52,5 @@ config WL1271_SDIO ...@@ -52,5 +52,5 @@ config WL1271_SDIO
config WL12XX_PLATFORM_DATA config WL12XX_PLATFORM_DATA
bool bool
depends on WL1271_SDIO != n depends on WL1271_SDIO != n || WL1251_SDIO != n
default y default y
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment