diff options
Diffstat (limited to 'drivers/net/wireless/ti/wlcore/spi.c')
| -rw-r--r-- | drivers/net/wireless/ti/wlcore/spi.c | 37 | 
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c index a519bc3adec..e2644783268 100644 --- a/drivers/net/wireless/ti/wlcore/spi.c +++ b/drivers/net/wireless/ti/wlcore/spi.c @@ -270,7 +270,7 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,  					     void *buf, size_t len, bool fixed)  {  	struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent); -	struct spi_transfer t[2 * WSPI_MAX_NUM_OF_CHUNKS]; +	struct spi_transfer t[2 * (WSPI_MAX_NUM_OF_CHUNKS + 1)];  	struct spi_message m;  	u32 commands[WSPI_MAX_NUM_OF_CHUNKS];  	u32 *cmd; @@ -324,25 +324,30 @@ static struct wl1271_if_operations spi_ops = {  	.set_block_size = NULL,  }; -static int __devinit wl1271_probe(struct spi_device *spi) +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; -	pdata = spi->dev.platform_data; -	if (!pdata) { +	pdev_data = kzalloc(sizeof(*pdev_data), GFP_KERNEL); +	if (!pdev_data) +		goto out; + +	pdev_data->pdata = spi->dev.platform_data; +	if (!pdev_data->pdata) {  		dev_err(&spi->dev, "no platform data\n"); -		return -ENODEV; +		ret = -ENODEV; +		goto out_free_pdev_data;  	} -	pdata->ops = &spi_ops; +	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; @@ -359,7 +364,7 @@ static int __devinit wl1271_probe(struct spi_device *spi)  		goto out_free_glue;  	} -	glue->core = platform_device_alloc("wl12xx", -1); +	glue->core = platform_device_alloc("wl12xx", PLATFORM_DEVID_AUTO);  	if (!glue->core) {  		dev_err(glue->dev, "can't allocate platform_device\n");  		ret = -ENOMEM; @@ -380,7 +385,8 @@ static int __devinit wl1271_probe(struct spi_device *spi)  		goto out_dev_put;  	} -	ret = platform_device_add_data(glue->core, pdata, sizeof(*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,16 +405,19 @@ out_dev_put:  out_free_glue:  	kfree(glue); + +out_free_pdev_data: +	kfree(pdev_data); +  out:  	return ret;  } -static int __devexit wl1271_remove(struct spi_device *spi) +static int wl1271_remove(struct spi_device *spi)  {  	struct wl12xx_spi_glue *glue = spi_get_drvdata(spi); -	platform_device_del(glue->core); -	platform_device_put(glue->core); +	platform_device_unregister(glue->core);  	kfree(glue);  	return 0; @@ -422,7 +431,7 @@ static struct spi_driver wl1271_spi_driver = {  	},  	.probe		= wl1271_probe, -	.remove		= __devexit_p(wl1271_remove), +	.remove		= wl1271_remove,  };  static int __init wl1271_init(void)  |