summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Breathitt Gray <vilhelm.gray@gmail.com>2017-01-24 15:01:04 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-01-26 09:55:25 -0500
commit2141b0a1d718d5f75b581530ef4f9641c7c4284c (patch)
treee786bb3b31a47c83ab14d0ebd82db5cf9dfd3b50
parent837143d356fd066ed6fb0a3a91700d66a7916841 (diff)
gpio: gpio-mm: Utilize devm_ functions in driver probe callback
The devm_ resource manager functions allow memory to be automatically released when a device is unbound. This patch takes advantage of the resource manager functions and replaces the gpiochip_add_data call with the devm_gpiochip_add_data call. In addition, the gpiomm_remove function has been removed as no longer necessary due to the use of the relevant devm_ resource manager functions. Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/gpio/gpio-gpio-mm.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/drivers/gpio/gpio-gpio-mm.c b/drivers/gpio/gpio-gpio-mm.c
index 093489556c54..393c8f9cf30d 100644
--- a/drivers/gpio/gpio-gpio-mm.c
+++ b/drivers/gpio/gpio-gpio-mm.c
@@ -263,7 +263,7 @@ static int gpiomm_probe(struct device *dev, unsigned int id)
263 263
264 dev_set_drvdata(dev, gpiommgpio); 264 dev_set_drvdata(dev, gpiommgpio);
265 265
266 err = gpiochip_add_data(&gpiommgpio->chip, gpiommgpio); 266 err = devm_gpiochip_add_data(dev, &gpiommgpio->chip, gpiommgpio);
267 if (err) { 267 if (err) {
268 dev_err(dev, "GPIO registering failed (%d)\n", err); 268 dev_err(dev, "GPIO registering failed (%d)\n", err);
269 return err; 269 return err;
@@ -282,21 +282,11 @@ static int gpiomm_probe(struct device *dev, unsigned int id)
282 return 0; 282 return 0;
283} 283}
284 284
285static int gpiomm_remove(struct device *dev, unsigned int id)
286{
287 struct gpiomm_gpio *const gpiommgpio = dev_get_drvdata(dev);
288
289 gpiochip_remove(&gpiommgpio->chip);
290
291 return 0;
292}
293
294static struct isa_driver gpiomm_driver = { 285static struct isa_driver gpiomm_driver = {
295 .probe = gpiomm_probe, 286 .probe = gpiomm_probe,
296 .driver = { 287 .driver = {
297 .name = "gpio-mm" 288 .name = "gpio-mm"
298 }, 289 },
299 .remove = gpiomm_remove
300}; 290};
301 291
302module_isa_driver(gpiomm_driver, num_gpiomm); 292module_isa_driver(gpiomm_driver, num_gpiomm);