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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user