Skip to content

Commit e4b3fdb

Browse files
notazlinvjw
authored andcommitted
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 <[email protected]> Signed-off-by: Grazvydas Ignotas <[email protected]> Acked-by: Kalle Valo <[email protected]> Acked-by: Luciano Coelho <[email protected]> Acked-by: Tony Lindgren <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent 1d4b89f commit e4b3fdb

File tree

3 files changed

+12
-57
lines changed

3 files changed

+12
-57
lines changed

arch/arm/mach-omap2/board-omap3pandora.c

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -642,31 +642,13 @@ static void __init omap3pandora_init_irq(void)
642642
omap_gpio_init();
643643
}
644644

645-
static void pandora_wl1251_set_power(bool enable)
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)
645+
static void __init pandora_wl1251_init(void)
667646
{
647+
struct wl12xx_platform_data pandora_wl1251_pdata;
668648
int ret;
669649

650+
memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
651+
670652
ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq");
671653
if (ret < 0)
672654
goto fail;
@@ -679,6 +661,11 @@ static void pandora_wl1251_init(void)
679661
if (pandora_wl1251_pdata.irq < 0)
680662
goto fail_irq;
681663

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+
682669
return;
683670

684671
fail_irq:
@@ -691,7 +678,6 @@ static struct platform_device *omap3pandora_devices[] __initdata = {
691678
&pandora_leds_gpio,
692679
&pandora_keys_gpio,
693680
&pandora_dss_device,
694-
&pandora_wl1251_data,
695681
&pandora_vwlan_device,
696682
};
697683

drivers/net/wireless/wl1251/sdio.c

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ struct wl1251_sdio {
4343
u32 elp_val;
4444
};
4545

46-
static struct wl12xx_platform_data *wl12xx_board_data;
47-
4846
static struct sdio_func *wl_to_func(struct wl1251 *wl)
4947
{
5048
struct wl1251_sdio *wl_sdio = wl->if_priv;
@@ -219,37 +217,14 @@ static struct wl1251_if_operations wl1251_sdio_ops = {
219217
.power = wl1251_sdio_set_power,
220218
};
221219

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-
246220
static int wl1251_sdio_probe(struct sdio_func *func,
247221
const struct sdio_device_id *id)
248222
{
249223
int ret;
250224
struct wl1251 *wl;
251225
struct ieee80211_hw *hw;
252226
struct wl1251_sdio *wl_sdio;
227+
const struct wl12xx_platform_data *wl12xx_board_data;
253228

254229
hw = wl1251_alloc_hw();
255230
if (IS_ERR(hw))
@@ -276,6 +251,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
276251
wl->if_priv = wl_sdio;
277252
wl->if_ops = &wl1251_sdio_ops;
278253

254+
wl12xx_board_data = wl12xx_get_platform_data();
279255
if (wl12xx_board_data != NULL) {
280256
wl->set_power = wl12xx_board_data->set_power;
281257
wl->irq = wl12xx_board_data->irq;
@@ -378,12 +354,6 @@ static int __init wl1251_sdio_init(void)
378354
{
379355
int err;
380356

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-
387357
err = sdio_register_driver(&wl1251_sdio_driver);
388358
if (err)
389359
wl1251_error("failed to register sdio driver: %d", err);
@@ -393,7 +363,6 @@ static int __init wl1251_sdio_init(void)
393363
static void __exit wl1251_sdio_exit(void)
394364
{
395365
sdio_unregister_driver(&wl1251_sdio_driver);
396-
platform_driver_unregister(&wl1251_platform_driver);
397366
wl1251_notice("unloaded");
398367
}
399368

drivers/net/wireless/wl12xx/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ config WL1271_SDIO
5252

5353
config WL12XX_PLATFORM_DATA
5454
bool
55-
depends on WL1271_SDIO != n
55+
depends on WL1271_SDIO != n || WL1251_SDIO != n
5656
default y

0 commit comments

Comments
 (0)