projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gpio: tc3589x: use managed resources
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
gpio
/
gpio-tc3589x.c
diff --git
a/drivers/gpio/gpio-tc3589x.c
b/drivers/gpio/gpio-tc3589x.c
index 1019320984d778f8fd51a26d3be93551349feef8..113e50cb1f59ef6faba33b93a5a4773c2cf9ced2 100644
(file)
--- a/
drivers/gpio/gpio-tc3589x.c
+++ b/
drivers/gpio/gpio-tc3589x.c
@@
-329,7
+329,8
@@
static int tc3589x_gpio_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
if (irq < 0)
return irq;
- tc3589x_gpio = kzalloc(sizeof(struct tc3589x_gpio), GFP_KERNEL);
+ tc3589x_gpio = devm_kzalloc(&pdev->dev, sizeof(struct tc3589x_gpio),
+ GFP_KERNEL);
if (!tc3589x_gpio)
return -ENOMEM;
if (!tc3589x_gpio)
return -ENOMEM;
@@
-354,23
+355,25
@@
static int tc3589x_gpio_probe(struct platform_device *pdev)
ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
TC3589x_RSTCTRL_GPIRST, 0);
if (ret < 0)
ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
TC3589x_RSTCTRL_GPIRST, 0);
if (ret < 0)
-
goto out_free
;
+
return ret
;
ret = tc3589x_gpio_irq_init(tc3589x_gpio, np);
if (ret)
ret = tc3589x_gpio_irq_init(tc3589x_gpio, np);
if (ret)
-
goto out_free
;
+
return ret
;
- ret = request_threaded_irq(irq, NULL, tc3589x_gpio_irq, IRQF_ONESHOT,
- "tc3589x-gpio", tc3589x_gpio);
+ ret = devm_request_threaded_irq(&pdev->dev,
+ irq, NULL, tc3589x_gpio_irq,
+ IRQF_ONESHOT, "tc3589x-gpio",
+ tc3589x_gpio);
if (ret) {
dev_err(&pdev->dev, "unable to get irq: %d\n", ret);
if (ret) {
dev_err(&pdev->dev, "unable to get irq: %d\n", ret);
-
goto out_free
;
+
return ret
;
}
ret = gpiochip_add(&tc3589x_gpio->chip);
if (ret) {
dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret);
}
ret = gpiochip_add(&tc3589x_gpio->chip);
if (ret) {
dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret);
-
goto out_freeirq
;
+
return ret
;
}
if (pdata && pdata->setup)
}
if (pdata && pdata->setup)
@@
-379,12
+382,6
@@
static int tc3589x_gpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, tc3589x_gpio);
return 0;
platform_set_drvdata(pdev, tc3589x_gpio);
return 0;
-
-out_freeirq:
- free_irq(irq, tc3589x_gpio);
-out_free:
- kfree(tc3589x_gpio);
- return ret;
}
static int tc3589x_gpio_remove(struct platform_device *pdev)
}
static int tc3589x_gpio_remove(struct platform_device *pdev)
@@
-392,7
+389,6
@@
static int tc3589x_gpio_remove(struct platform_device *pdev)
struct tc3589x_gpio *tc3589x_gpio = platform_get_drvdata(pdev);
struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
struct tc3589x_gpio_platform_data *pdata = tc3589x->pdata->gpio;
struct tc3589x_gpio *tc3589x_gpio = platform_get_drvdata(pdev);
struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
struct tc3589x_gpio_platform_data *pdata = tc3589x->pdata->gpio;
- int irq = platform_get_irq(pdev, 0);
int ret;
if (pdata && pdata->remove)
int ret;
if (pdata && pdata->remove)
@@
-405,10
+401,6
@@
static int tc3589x_gpio_remove(struct platform_device *pdev)
return ret;
}
return ret;
}
- free_irq(irq, tc3589x_gpio);
-
- kfree(tc3589x_gpio);
-
return 0;
}
return 0;
}