summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-ds2404.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-04-19 10:25:01 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-04-19 22:37:17 +0200
commitd9aa5ca429ad30dde96e5966173d18004f16f312 (patch)
treedcbc32ecf87a0903fc6cc975616c3d0b16248f74 /drivers/rtc/rtc-ds2404.c
parentc7ac260fe76fa69caa62fe8e7eef544f7962bf33 (diff)
rtc: ds2404: simplify .probe and remove .remove
Use devm_add_action_or_reset to simplify .probe and remove .remove Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-ds2404.c')
-rw-r--r--drivers/rtc/rtc-ds2404.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
index c6b73dcf9d62..1e9f429ada64 100644
--- a/drivers/rtc/rtc-ds2404.c
+++ b/drivers/rtc/rtc-ds2404.c
@@ -72,7 +72,7 @@ err_request:
return err;
}
-static void ds2404_gpio_unmap(struct ds2404 *chip)
+static void ds2404_gpio_unmap(void *data)
{
int i;
@@ -218,7 +218,11 @@ static int rtc_probe(struct platform_device *pdev)
retval = ds2404_gpio_map(chip, pdev, pdata);
if (retval)
- goto err_chip;
+ return retval;
+
+ retval = devm_add_action_or_reset(&pdev->dev, ds2404_gpio_unmap, chip);
+ if (retval)
+ return retval;
dev_info(&pdev->dev, "using GPIOs RST:%d, CLK:%d, DQ:%d\n",
chip->gpio[DS2404_RST].gpio, chip->gpio[DS2404_CLK].gpio,
@@ -231,29 +235,14 @@ static int rtc_probe(struct platform_device *pdev)
retval = rtc_register_device(chip->rtc);
if (retval)
- goto err_io;
+ return retval;
ds2404_enable_osc(&pdev->dev);
return 0;
-
-err_io:
- ds2404_gpio_unmap(chip);
-err_chip:
- return retval;
-}
-
-static int rtc_remove(struct platform_device *dev)
-{
- struct ds2404 *chip = platform_get_drvdata(dev);
-
- ds2404_gpio_unmap(chip);
-
- return 0;
}
static struct platform_driver rtc_device_driver = {
.probe = rtc_probe,
- .remove = rtc_remove,
.driver = {
.name = "ds2404",
},