Commit 2141b0a1 authored by William Breathitt Gray's avatar William Breathitt Gray Committed by Linus Walleij

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: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 837143d3
...@@ -263,7 +263,7 @@ static int gpiomm_probe(struct device *dev, unsigned int id) ...@@ -263,7 +263,7 @@ static int gpiomm_probe(struct device *dev, unsigned int id)
dev_set_drvdata(dev, gpiommgpio); dev_set_drvdata(dev, gpiommgpio);
err = gpiochip_add_data(&gpiommgpio->chip, gpiommgpio); err = devm_gpiochip_add_data(dev, &gpiommgpio->chip, gpiommgpio);
if (err) { if (err) {
dev_err(dev, "GPIO registering failed (%d)\n", err); dev_err(dev, "GPIO registering failed (%d)\n", err);
return err; return err;
...@@ -282,21 +282,11 @@ static int gpiomm_probe(struct device *dev, unsigned int id) ...@@ -282,21 +282,11 @@ static int gpiomm_probe(struct device *dev, unsigned int id)
return 0; return 0;
} }
static int gpiomm_remove(struct device *dev, unsigned int id)
{
struct gpiomm_gpio *const gpiommgpio = dev_get_drvdata(dev);
gpiochip_remove(&gpiommgpio->chip);
return 0;
}
static struct isa_driver gpiomm_driver = { static struct isa_driver gpiomm_driver = {
.probe = gpiomm_probe, .probe = gpiomm_probe,
.driver = { .driver = {
.name = "gpio-mm" .name = "gpio-mm"
}, },
.remove = gpiomm_remove
}; };
module_isa_driver(gpiomm_driver, num_gpiomm); module_isa_driver(gpiomm_driver, num_gpiomm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment