From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Alessandro Zummo <a.zummo@towertech.it>,
Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-rtc@vger.kernel.org,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: [PATCH v3 2/2] rtc: s5m: use devm_i2c_new_dummy_device()
Date: Thu, 7 Jan 2021 14:42:03 +0100 [thread overview]
Message-ID: <20210107134203.9388-2-brgl@bgdev.pl> (raw)
In-Reply-To: <20210107134203.9388-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Use the managed variant of i2c_new_dummy_device() to shrink code and
remove the goto label. We can drop the remove callback now too.
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
v1 -> v2:
- remove the remove() callback
v2 -> v3:
- fix an error pointed out by the build robot
drivers/rtc/rtc-s5m.c | 34 ++++++++--------------------------
1 file changed, 8 insertions(+), 26 deletions(-)
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index e0011d3cf61b..b492070afe6a 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -760,7 +760,8 @@ static int s5m_rtc_probe(struct platform_device *pdev)
return -ENODEV;
}
- info->i2c = i2c_new_dummy_device(s5m87xx->i2c->adapter, RTC_I2C_ADDR);
+ info->i2c = devm_i2c_new_dummy_device(&pdev->dev, s5m87xx->i2c->adapter,
+ RTC_I2C_ADDR);
if (IS_ERR(info->i2c)) {
dev_err(&pdev->dev, "Failed to allocate I2C for RTC\n");
return PTR_ERR(info->i2c);
@@ -768,10 +769,9 @@ static int s5m_rtc_probe(struct platform_device *pdev)
info->regmap = devm_regmap_init_i2c(info->i2c, regmap_cfg);
if (IS_ERR(info->regmap)) {
- ret = PTR_ERR(info->regmap);
dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n",
- ret);
- goto err;
+ PTR_ERR(info->regmap));
+ return PTR_ERR(info->regmap);
}
info->dev = &pdev->dev;
@@ -781,10 +781,9 @@ static int s5m_rtc_probe(struct platform_device *pdev)
if (s5m87xx->irq_data) {
info->irq = regmap_irq_get_virq(s5m87xx->irq_data, alarm_irq);
if (info->irq <= 0) {
- ret = -EINVAL;
dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
alarm_irq);
- goto err;
+ return -EINVAL;
}
}
@@ -799,10 +798,8 @@ static int s5m_rtc_probe(struct platform_device *pdev)
info->rtc_dev = devm_rtc_device_register(&pdev->dev, "s5m-rtc",
&s5m_rtc_ops, THIS_MODULE);
- if (IS_ERR(info->rtc_dev)) {
- ret = PTR_ERR(info->rtc_dev);
- goto err;
- }
+ if (IS_ERR(info->rtc_dev))
+ return PTR_ERR(info->rtc_dev);
if (!info->irq) {
dev_info(&pdev->dev, "Alarm IRQ not available\n");
@@ -815,23 +812,9 @@ static int s5m_rtc_probe(struct platform_device *pdev)
if (ret < 0) {
dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
info->irq, ret);
- goto err;
+ return ret;
}
- return 0;
-
-err:
- i2c_unregister_device(info->i2c);
-
- return ret;
-}
-
-static int s5m_rtc_remove(struct platform_device *pdev)
-{
- struct s5m_rtc_info *info = platform_get_drvdata(pdev);
-
- i2c_unregister_device(info->i2c);
-
return 0;
}
@@ -876,7 +859,6 @@ static struct platform_driver s5m_rtc_driver = {
.pm = &s5m_rtc_pm_ops,
},
.probe = s5m_rtc_probe,
- .remove = s5m_rtc_remove,
.id_table = s5m_rtc_id,
};
--
2.29.1
next prev parent reply other threads:[~2021-01-07 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 13:42 [PATCH 1/2] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski
2021-01-07 13:42 ` Bartosz Golaszewski [this message]
2021-01-07 15:00 ` [PATCH v3 2/2] rtc: s5m: use devm_i2c_new_dummy_device() kernel test robot
2021-01-07 18:20 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210107134203.9388-2-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=a.zummo@towertech.it \
--cc=alexandre.belloni@bootlin.com \
--cc=b.zolnierkie@samsung.com \
--cc=bgolaszewski@baylibre.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).