diff options
Diffstat (limited to 'drivers/gpio/gpio-ep93xx.c')
-rw-r--r-- | drivers/gpio/gpio-ep93xx.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/drivers/gpio/gpio-ep93xx.c b/drivers/gpio/gpio-ep93xx.c index 80829f3c6543..dcc2bb4074ef 100644 --- a/drivers/gpio/gpio-ep93xx.c +++ b/drivers/gpio/gpio-ep93xx.c | |||
@@ -344,37 +344,24 @@ static int ep93xx_gpio_probe(struct platform_device *pdev) | |||
344 | { | 344 | { |
345 | struct ep93xx_gpio *ep93xx_gpio; | 345 | struct ep93xx_gpio *ep93xx_gpio; |
346 | struct resource *res; | 346 | struct resource *res; |
347 | void __iomem *mmio; | ||
348 | int i; | 347 | int i; |
349 | int ret; | 348 | struct device *dev = &pdev->dev; |
350 | 349 | ||
351 | ep93xx_gpio = kzalloc(sizeof(*ep93xx_gpio), GFP_KERNEL); | 350 | ep93xx_gpio = devm_kzalloc(dev, sizeof(struct ep93xx_gpio), GFP_KERNEL); |
352 | if (!ep93xx_gpio) | 351 | if (!ep93xx_gpio) |
353 | return -ENOMEM; | 352 | return -ENOMEM; |
354 | 353 | ||
355 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 354 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
356 | if (!res) { | 355 | ep93xx_gpio->mmio_base = devm_ioremap_resource(dev, res); |
357 | ret = -ENXIO; | 356 | if (IS_ERR(ep93xx_gpio->mmio_base)) |
358 | goto exit_free; | 357 | return PTR_ERR(ep93xx_gpio->mmio_base); |
359 | } | ||
360 | |||
361 | if (!request_mem_region(res->start, resource_size(res), pdev->name)) { | ||
362 | ret = -EBUSY; | ||
363 | goto exit_free; | ||
364 | } | ||
365 | |||
366 | mmio = ioremap(res->start, resource_size(res)); | ||
367 | if (!mmio) { | ||
368 | ret = -ENXIO; | ||
369 | goto exit_release; | ||
370 | } | ||
371 | ep93xx_gpio->mmio_base = mmio; | ||
372 | 358 | ||
373 | for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) { | 359 | for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) { |
374 | struct bgpio_chip *bgc = &ep93xx_gpio->bgc[i]; | 360 | struct bgpio_chip *bgc = &ep93xx_gpio->bgc[i]; |
375 | struct ep93xx_gpio_bank *bank = &ep93xx_gpio_banks[i]; | 361 | struct ep93xx_gpio_bank *bank = &ep93xx_gpio_banks[i]; |
376 | 362 | ||
377 | if (ep93xx_gpio_add_bank(bgc, &pdev->dev, mmio, bank)) | 363 | if (ep93xx_gpio_add_bank(bgc, &pdev->dev, |
364 | ep93xx_gpio->mmio_base, bank)) | ||
378 | dev_warn(&pdev->dev, "Unable to add gpio bank %s\n", | 365 | dev_warn(&pdev->dev, "Unable to add gpio bank %s\n", |
379 | bank->label); | 366 | bank->label); |
380 | } | 367 | } |
@@ -382,13 +369,6 @@ static int ep93xx_gpio_probe(struct platform_device *pdev) | |||
382 | ep93xx_gpio_init_irq(); | 369 | ep93xx_gpio_init_irq(); |
383 | 370 | ||
384 | return 0; | 371 | return 0; |
385 | |||
386 | exit_release: | ||
387 | release_mem_region(res->start, resource_size(res)); | ||
388 | exit_free: | ||
389 | kfree(ep93xx_gpio); | ||
390 | dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, ret); | ||
391 | return ret; | ||
392 | } | 372 | } |
393 | 373 | ||
394 | static struct platform_driver ep93xx_gpio_driver = { | 374 | static struct platform_driver ep93xx_gpio_driver = { |