aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2013-01-25 04:57:48 -0500
committerLuciano Coelho <coelho@ti.com>2013-02-08 03:05:02 -0500
commitafb43e6d88e587441c960a5d214d2c698d076c9c (patch)
treeb8df657e3e4e54c71e95f3972d7b9b05e286188d /drivers/net/wireless/ti
parent3a0a8d961e20132272887d9826738ce9b4d818f7 (diff)
wlcore: remove if_ops from platform_data
We can't pass pointers from the platform data to the modules, because with DT it cannot be done. Those pointers are not set by the board files anyway. It's the bus modules that set them, so they can be safely removed from the platform data without changing any board files. Create a new structure that the bus modules pass to wlcore. This structure contains the if_ops pointers and a pointer to the actual platform data. Signed-off-by: Luciano Coelho <coelho@ti.com> Reviewed-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r--drivers/net/wireless/ti/wl12xx/main.c3
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c5
-rw-r--r--drivers/net/wireless/ti/wlcore/sdio.c22
-rw-r--r--drivers/net/wireless/ti/wlcore/spi.c20
-rw-r--r--drivers/net/wireless/ti/wlcore/wlcore_i.h5
5 files changed, 44 insertions, 11 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
index 3254bfc81a2a..09694e39bb14 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -1703,7 +1703,8 @@ static struct ieee80211_sta_ht_cap wl12xx_ht_cap = {
1703static int wl12xx_setup(struct wl1271 *wl) 1703static int wl12xx_setup(struct wl1271 *wl)
1704{ 1704{
1705 struct wl12xx_priv *priv = wl->priv; 1705 struct wl12xx_priv *priv = wl->priv;
1706 struct wl12xx_platform_data *pdata = wl->pdev->dev.platform_data; 1706 struct wlcore_platdev_data *pdev_data = wl->pdev->dev.platform_data;
1707 struct wl12xx_platform_data *pdata = pdev_data->pdata;
1707 1708
1708 wl->rtable = wl12xx_rtable; 1709 wl->rtable = wl12xx_rtable;
1709 wl->num_tx_desc = WL12XX_NUM_TX_DESCRIPTORS; 1710 wl->num_tx_desc = WL12XX_NUM_TX_DESCRIPTORS;
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 9a66acf1205f..cd70335cd5e8 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5966,7 +5966,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
5966{ 5966{
5967 struct wl1271 *wl = context; 5967 struct wl1271 *wl = context;
5968 struct platform_device *pdev = wl->pdev; 5968 struct platform_device *pdev = wl->pdev;
5969 struct wl12xx_platform_data *pdata = pdev->dev.platform_data; 5969 struct wlcore_platdev_data *pdev_data = pdev->dev.platform_data;
5970 struct wl12xx_platform_data *pdata = pdev_data->pdata;
5970 unsigned long irqflags; 5971 unsigned long irqflags;
5971 int ret; 5972 int ret;
5972 5973
@@ -5995,7 +5996,7 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
5995 5996
5996 wl->irq = platform_get_irq(pdev, 0); 5997 wl->irq = platform_get_irq(pdev, 0);
5997 wl->platform_quirks = pdata->platform_quirks; 5998 wl->platform_quirks = pdata->platform_quirks;
5998 wl->if_ops = pdata->ops; 5999 wl->if_ops = pdev_data->if_ops;
5999 6000
6000 if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) 6001 if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
6001 irqflags = IRQF_TRIGGER_RISING; 6002 irqflags = IRQF_TRIGGER_RISING;
diff --git a/drivers/net/wireless/ti/wlcore/sdio.c b/drivers/net/wireless/ti/wlcore/sdio.c
index d4f184e2efed..1f6f6e30daca 100644
--- a/drivers/net/wireless/ti/wlcore/sdio.c
+++ b/drivers/net/wireless/ti/wlcore/sdio.c
@@ -218,6 +218,7 @@ static int wl1271_probe(struct sdio_func *func,
218 const struct sdio_device_id *id) 218 const struct sdio_device_id *id)
219{ 219{
220 struct wl12xx_platform_data *wlan_data; 220 struct wl12xx_platform_data *wlan_data;
221 struct wlcore_platdev_data *pdev_data;
221 struct wl12xx_sdio_glue *glue; 222 struct wl12xx_sdio_glue *glue;
222 struct resource res[1]; 223 struct resource res[1];
223 mmc_pm_flag_t mmcflags; 224 mmc_pm_flag_t mmcflags;
@@ -228,10 +229,18 @@ static int wl1271_probe(struct sdio_func *func,
228 if (func->num != 0x02) 229 if (func->num != 0x02)
229 return -ENODEV; 230 return -ENODEV;
230 231
232 pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL);
233 if (!pdev_data) {
234 dev_err(&func->dev, "can't allocate platdev_data\n");
235 goto out;
236 }
237
238 pdev_data->if_ops = &sdio_ops;
239
231 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 240 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
232 if (!glue) { 241 if (!glue) {
233 dev_err(&func->dev, "can't allocate glue\n"); 242 dev_err(&func->dev, "can't allocate glue\n");
234 goto out; 243 goto out_free_pdev_data;
235 } 244 }
236 245
237 glue->dev = &func->dev; 246 glue->dev = &func->dev;
@@ -256,8 +265,6 @@ static int wl1271_probe(struct sdio_func *func,
256 if (mmcflags & MMC_PM_KEEP_POWER) 265 if (mmcflags & MMC_PM_KEEP_POWER)
257 wlan_data->pwr_in_suspend = true; 266 wlan_data->pwr_in_suspend = true;
258 267
259 wlan_data->ops = &sdio_ops;
260
261 sdio_set_drvdata(func, glue); 268 sdio_set_drvdata(func, glue);
262 269
263 /* Tell PM core that we don't need the card to be powered now */ 270 /* Tell PM core that we don't need the card to be powered now */
@@ -295,8 +302,10 @@ static int wl1271_probe(struct sdio_func *func,
295 goto out_dev_put; 302 goto out_dev_put;
296 } 303 }
297 304
298 ret = platform_device_add_data(glue->core, wlan_data, 305 pdev_data->pdata = wlan_data;
299 sizeof(*wlan_data)); 306
307 ret = platform_device_add_data(glue->core, pdev_data,
308 sizeof(*pdev_data));
300 if (ret) { 309 if (ret) {
301 dev_err(glue->dev, "can't add platform data\n"); 310 dev_err(glue->dev, "can't add platform data\n");
302 goto out_dev_put; 311 goto out_dev_put;
@@ -315,6 +324,9 @@ out_dev_put:
315out_free_glue: 324out_free_glue:
316 kfree(glue); 325 kfree(glue);
317 326
327out_free_pdev_data:
328 kfree(pdev_data);
329
318out: 330out:
319 return ret; 331 return ret;
320} 332}
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index 2d700b7ae14c..d437f4d28bd0 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -328,6 +328,7 @@ static int wl1271_probe(struct spi_device *spi)
328{ 328{
329 struct wl12xx_spi_glue *glue; 329 struct wl12xx_spi_glue *glue;
330 struct wl12xx_platform_data *pdata; 330 struct wl12xx_platform_data *pdata;
331 struct wlcore_platdev_data *pdev_data;
331 struct resource res[1]; 332 struct resource res[1];
332 int ret = -ENOMEM; 333 int ret = -ENOMEM;
333 334
@@ -337,12 +338,18 @@ static int wl1271_probe(struct spi_device *spi)
337 return -ENODEV; 338 return -ENODEV;
338 } 339 }
339 340
340 pdata->ops = &spi_ops; 341 pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL);
342 if (!pdev_data) {
343 dev_err(&spi->dev, "can't allocate platdev_data\n");
344 goto out;
345 }
346
347 pdev_data->if_ops = &spi_ops;
341 348
342 glue = kzalloc(sizeof(*glue), GFP_KERNEL); 349 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
343 if (!glue) { 350 if (!glue) {
344 dev_err(&spi->dev, "can't allocate glue\n"); 351 dev_err(&spi->dev, "can't allocate glue\n");
345 goto out; 352 goto out_free_pdev_data;
346 } 353 }
347 354
348 glue->dev = &spi->dev; 355 glue->dev = &spi->dev;
@@ -380,7 +387,10 @@ static int wl1271_probe(struct spi_device *spi)
380 goto out_dev_put; 387 goto out_dev_put;
381 } 388 }
382 389
383 ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata)); 390 pdev_data->pdata = pdata;
391
392 ret = platform_device_add_data(glue->core, pdev_data,
393 sizeof(*pdev_data));
384 if (ret) { 394 if (ret) {
385 dev_err(glue->dev, "can't add platform data\n"); 395 dev_err(glue->dev, "can't add platform data\n");
386 goto out_dev_put; 396 goto out_dev_put;
@@ -399,6 +409,10 @@ out_dev_put:
399 409
400out_free_glue: 410out_free_glue:
401 kfree(glue); 411 kfree(glue);
412
413out_free_pdev_data:
414 kfree(pdev_data);
415
402out: 416out:
403 return ret; 417 return ret;
404} 418}
diff --git a/drivers/net/wireless/ti/wlcore/wlcore_i.h b/drivers/net/wireless/ti/wlcore/wlcore_i.h
index 20316ac328a2..c845b0ef7f4b 100644
--- a/drivers/net/wireless/ti/wlcore/wlcore_i.h
+++ b/drivers/net/wireless/ti/wlcore/wlcore_i.h
@@ -206,6 +206,11 @@ struct wl1271_if_operations {
206 void (*set_block_size) (struct device *child, unsigned int blksz); 206 void (*set_block_size) (struct device *child, unsigned int blksz);
207}; 207};
208 208
209struct wlcore_platdev_data {
210 struct wl12xx_platform_data *pdata;
211 struct wl1271_if_operations *if_ops;
212};
213
209#define MAX_NUM_KEYS 14 214#define MAX_NUM_KEYS 14
210#define MAX_KEY_SIZE 32 215#define MAX_KEY_SIZE 32
211 216