summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/ti/wlcore/spi.c
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2013-01-25 11:57:48 +0200
committerLuciano Coelho <coelho@ti.com>2013-02-08 10:05:02 +0200
commitafb43e6d88e587441c960a5d214d2c698d076c9c (patch)
treeb8df657e3e4e54c71e95f3972d7b9b05e286188d /drivers/net/wireless/ti/wlcore/spi.c
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/wlcore/spi.c')
-rw-r--r--drivers/net/wireless/ti/wlcore/spi.c20
1 files changed, 17 insertions, 3 deletions
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)
{
struct wl12xx_spi_glue *glue;
struct wl12xx_platform_data *pdata;
+ struct wlcore_platdev_data *pdev_data;
struct resource res[1];
int ret = -ENOMEM;
@@ -337,12 +338,18 @@ static int wl1271_probe(struct spi_device *spi)
return -ENODEV;
}
- pdata->ops = &spi_ops;
+ pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL);
+ if (!pdev_data) {
+ dev_err(&spi->dev, "can't allocate platdev_data\n");
+ goto out;
+ }
+
+ pdev_data->if_ops = &spi_ops;
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(&spi->dev, "can't allocate glue\n");
- goto out;
+ goto out_free_pdev_data;
}
glue->dev = &spi->dev;
@@ -380,7 +387,10 @@ static int wl1271_probe(struct spi_device *spi)
goto out_dev_put;
}
- ret = platform_device_add_data(glue->core, pdata, sizeof(*pdata));
+ pdev_data->pdata = pdata;
+
+ ret = platform_device_add_data(glue->core, pdev_data,
+ sizeof(*pdev_data));
if (ret) {
dev_err(glue->dev, "can't add platform data\n");
goto out_dev_put;
@@ -399,6 +409,10 @@ out_dev_put:
out_free_glue:
kfree(glue);
+
+out_free_pdev_data:
+ kfree(pdev_data);
+
out:
return ret;
}