Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: cs5535: Switch to using managed resources with devm_

This change switches to devm_request_region to request region
and hence simplifies the module unload and does away with
release_region in remove function.

Cc: linux-gpio@vger.kernel.org
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Pramod Gurav and committed by
Linus Walleij
3eebd613 4515b76d

+3 -8
+3 -8
drivers/gpio/gpio-cs5535.c
··· 322 322 goto done; 323 323 } 324 324 325 - if (!request_region(res->start, resource_size(res), pdev->name)) { 325 + if (!devm_request_region(&pdev->dev, res->start, resource_size(res), 326 + pdev->name)) { 326 327 dev_err(&pdev->dev, "can't request region\n"); 327 328 goto done; 328 329 } ··· 349 348 /* finally, register with the generic GPIO API */ 350 349 err = gpiochip_add(&cs5535_gpio_chip.chip); 351 350 if (err) 352 - goto release_region; 351 + goto done; 353 352 354 353 return 0; 355 354 356 - release_region: 357 - release_region(res->start, resource_size(res)); 358 355 done: 359 356 return err; 360 357 } 361 358 362 359 static int cs5535_gpio_remove(struct platform_device *pdev) 363 360 { 364 - struct resource *r; 365 - 366 361 gpiochip_remove(&cs5535_gpio_chip.chip); 367 362 368 - r = platform_get_resource(pdev, IORESOURCE_IO, 0); 369 - release_region(r->start, resource_size(r)); 370 363 return 0; 371 364 } 372 365