aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-oc-tiny.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi-oc-tiny.c')
-rw-r--r--drivers/spi/spi-oc-tiny.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index 58deb79d046b..333cb1badcd7 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -285,7 +285,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
285 285
286static int tiny_spi_probe(struct platform_device *pdev) 286static int tiny_spi_probe(struct platform_device *pdev)
287{ 287{
288 struct tiny_spi_platform_data *platp = pdev->dev.platform_data; 288 struct tiny_spi_platform_data *platp = dev_get_platdata(&pdev->dev);
289 struct tiny_spi *hw; 289 struct tiny_spi *hw;
290 struct spi_master *master; 290 struct spi_master *master;
291 struct resource *res; 291 struct resource *res;
@@ -315,15 +315,11 @@ static int tiny_spi_probe(struct platform_device *pdev)
315 315
316 /* find and map our resources */ 316 /* find and map our resources */
317 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 317 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
318 if (!res) 318 hw->base = devm_ioremap_resource(&pdev->dev, res);
319 goto exit_busy; 319 if (IS_ERR(hw->base)) {
320 if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res), 320 err = PTR_ERR(hw->base);
321 pdev->name)) 321 goto exit;
322 goto exit_busy; 322 }
323 hw->base = devm_ioremap_nocache(&pdev->dev, res->start,
324 resource_size(res));
325 if (!hw->base)
326 goto exit_busy;
327 /* irq is optional */ 323 /* irq is optional */
328 hw->irq = platform_get_irq(pdev, 0); 324 hw->irq = platform_get_irq(pdev, 0);
329 if (hw->irq >= 0) { 325 if (hw->irq >= 0) {
@@ -337,8 +333,10 @@ static int tiny_spi_probe(struct platform_device *pdev)
337 if (platp) { 333 if (platp) {
338 hw->gpio_cs_count = platp->gpio_cs_count; 334 hw->gpio_cs_count = platp->gpio_cs_count;
339 hw->gpio_cs = platp->gpio_cs; 335 hw->gpio_cs = platp->gpio_cs;
340 if (platp->gpio_cs_count && !platp->gpio_cs) 336 if (platp->gpio_cs_count && !platp->gpio_cs) {
341 goto exit_busy; 337 err = -EBUSY;
338 goto exit;
339 }
342 hw->freq = platp->freq; 340 hw->freq = platp->freq;
343 hw->baudwidth = platp->baudwidth; 341 hw->baudwidth = platp->baudwidth;
344 } else { 342 } else {
@@ -365,8 +363,6 @@ static int tiny_spi_probe(struct platform_device *pdev)
365exit_gpio: 363exit_gpio:
366 while (i-- > 0) 364 while (i-- > 0)
367 gpio_free(hw->gpio_cs[i]); 365 gpio_free(hw->gpio_cs[i]);
368exit_busy:
369 err = -EBUSY;
370exit: 366exit:
371 spi_master_put(master); 367 spi_master_put(master);
372 return err; 368 return err;