Commit 91147a6c authored by Luciano Coelho's avatar Luciano Coelho

wlcore: use wl12xx_platform_data pointer from wlcore_pdev_data

Just a small cleanup to use the pointer provided by wlcore_pdev_data
instead of using a separate pointer then copying.
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent afb43e6d
...@@ -217,7 +217,6 @@ static struct wl1271_if_operations sdio_ops = { ...@@ -217,7 +217,6 @@ static struct wl1271_if_operations sdio_ops = {
static int wl1271_probe(struct sdio_func *func, static int wl1271_probe(struct sdio_func *func,
const struct sdio_device_id *id) const struct sdio_device_id *id)
{ {
struct wl12xx_platform_data *wlan_data;
struct wlcore_platdev_data *pdev_data; struct wlcore_platdev_data *pdev_data;
struct wl12xx_sdio_glue *glue; struct wl12xx_sdio_glue *glue;
struct resource res[1]; struct resource res[1];
...@@ -251,9 +250,9 @@ static int wl1271_probe(struct sdio_func *func, ...@@ -251,9 +250,9 @@ static int wl1271_probe(struct sdio_func *func,
/* Use block mode for transferring over one block size of data */ /* Use block mode for transferring over one block size of data */
func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE; func->card->quirks |= MMC_QUIRK_BLKSZ_FOR_BYTE_MODE;
wlan_data = wl12xx_get_platform_data(); pdev_data->pdata = wl12xx_get_platform_data();
if (IS_ERR(wlan_data)) { if (IS_ERR(pdev_data->pdata)) {
ret = PTR_ERR(wlan_data); ret = PTR_ERR(pdev_data->pdata);
dev_err(glue->dev, "missing wlan platform data: %d\n", ret); dev_err(glue->dev, "missing wlan platform data: %d\n", ret);
goto out_free_glue; goto out_free_glue;
} }
...@@ -263,7 +262,7 @@ static int wl1271_probe(struct sdio_func *func, ...@@ -263,7 +262,7 @@ static int wl1271_probe(struct sdio_func *func,
dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags); dev_dbg(glue->dev, "sdio PM caps = 0x%x\n", mmcflags);
if (mmcflags & MMC_PM_KEEP_POWER) if (mmcflags & MMC_PM_KEEP_POWER)
wlan_data->pwr_in_suspend = true; pdev_data->pdata->pwr_in_suspend = true;
sdio_set_drvdata(func, glue); sdio_set_drvdata(func, glue);
...@@ -292,7 +291,7 @@ static int wl1271_probe(struct sdio_func *func, ...@@ -292,7 +291,7 @@ static int wl1271_probe(struct sdio_func *func,
memset(res, 0x00, sizeof(res)); memset(res, 0x00, sizeof(res));
res[0].start = wlan_data->irq; res[0].start = pdev_data->pdata->irq;
res[0].flags = IORESOURCE_IRQ; res[0].flags = IORESOURCE_IRQ;
res[0].name = "irq"; res[0].name = "irq";
...@@ -302,8 +301,6 @@ static int wl1271_probe(struct sdio_func *func, ...@@ -302,8 +301,6 @@ static int wl1271_probe(struct sdio_func *func,
goto out_dev_put; goto out_dev_put;
} }
pdev_data->pdata = wlan_data;
ret = platform_device_add_data(glue->core, pdev_data, ret = platform_device_add_data(glue->core, pdev_data,
sizeof(*pdev_data)); sizeof(*pdev_data));
if (ret) { if (ret) {
......
...@@ -327,23 +327,23 @@ static struct wl1271_if_operations spi_ops = { ...@@ -327,23 +327,23 @@ static struct wl1271_if_operations spi_ops = {
static int wl1271_probe(struct spi_device *spi) static int wl1271_probe(struct spi_device *spi)
{ {
struct wl12xx_spi_glue *glue; struct wl12xx_spi_glue *glue;
struct wl12xx_platform_data *pdata;
struct wlcore_platdev_data *pdev_data; struct wlcore_platdev_data *pdev_data;
struct resource res[1]; struct resource res[1];
int ret = -ENOMEM; int ret = -ENOMEM;
pdata = spi->dev.platform_data;
if (!pdata) {
dev_err(&spi->dev, "no platform data\n");
return -ENODEV;
}
pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL);
if (!pdev_data) { if (!pdev_data) {
dev_err(&spi->dev, "can't allocate platdev_data\n"); dev_err(&spi->dev, "can't allocate platdev_data\n");
goto out; goto out;
} }
pdev_data->pdata = spi->dev.platform_data;
if (!pdev_data->pdata) {
dev_err(&spi->dev, "no platform data\n");
ret = -ENODEV;
goto out_free_pdev_data;
}
pdev_data->if_ops = &spi_ops; pdev_data->if_ops = &spi_ops;
glue = kzalloc(sizeof(*glue), GFP_KERNEL); glue = kzalloc(sizeof(*glue), GFP_KERNEL);
...@@ -387,8 +387,6 @@ static int wl1271_probe(struct spi_device *spi) ...@@ -387,8 +387,6 @@ static int wl1271_probe(struct spi_device *spi)
goto out_dev_put; goto out_dev_put;
} }
pdev_data->pdata = pdata;
ret = platform_device_add_data(glue->core, pdev_data, ret = platform_device_add_data(glue->core, pdev_data,
sizeof(*pdev_data)); sizeof(*pdev_data));
if (ret) { if (ret) {
......
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