linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] rtc: s5m: driver improvements
@ 2021-01-14 10:22 Bartosz Golaszewski
  2021-01-14 10:22 ` [PATCH v5 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2021-01-14 10:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz, Alessandro Zummo,
	Alexandre Belloni
  Cc: linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This is a set of improvements for the rtc-s5m driver. The first patch
is new in v4: I noticed the I2C regmap is not selected by this driver's
Kconfig. Two subsequent patches were already submitted separately.

v1 -> v2:
- remove the remove() callback

v2 -> v3:
- fix an error pointed out by the build robot

v3 -> v4:
- add patch 1/3: ("rtc: s5m: select REGMAP_I2C")
- fix issues raised by the kernel bot

v4 -> v5:
- change the order of the patches to keep them bisectable

Bartosz Golaszewski (3):
  rtc: s5m: select REGMAP_I2C
  rtc: s5m: use devm_i2c_new_dummy_device()
  rtc: s5m: check the return value of s5m8767_rtc_init_reg()

 drivers/rtc/Kconfig   |  1 +
 drivers/rtc/rtc-s5m.c | 33 +++++++++------------------------
 2 files changed, 10 insertions(+), 24 deletions(-)

-- 
2.29.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v5 1/3] rtc: s5m: select REGMAP_I2C
  2021-01-14 10:22 [PATCH v5 0/3] rtc: s5m: driver improvements Bartosz Golaszewski
@ 2021-01-14 10:22 ` Bartosz Golaszewski
  2021-01-14 10:22 ` [PATCH v5 2/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2021-01-14 10:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz, Alessandro Zummo,
	Alexandre Belloni
  Cc: linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

The rtc-s5m uses the I2C regmap but doesn't select it in Kconfig so
depending on the configuration the build may fail. Fix it.

Fixes: 959df7778bbd ("rtc: Enable compile testing for Maxim and Samsung drivers")
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/rtc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 6123f9f4fbc9..e4bef40831c7 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -692,6 +692,7 @@ config RTC_DRV_S5M
 	tristate "Samsung S2M/S5M series"
 	depends on MFD_SEC_CORE || COMPILE_TEST
 	select REGMAP_IRQ
+	select REGMAP_I2C
 	help
 	  If you say yes here you will get support for the
 	  RTC of Samsung S2MPS14 and S5M PMIC series.
-- 
2.29.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v5 2/3] rtc: s5m: use devm_i2c_new_dummy_device()
  2021-01-14 10:22 [PATCH v5 0/3] rtc: s5m: driver improvements Bartosz Golaszewski
  2021-01-14 10:22 ` [PATCH v5 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski
@ 2021-01-14 10:22 ` Bartosz Golaszewski
  2021-01-14 10:22 ` [PATCH v5 3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski
  2021-01-16 22:23 ` [PATCH v5 0/3] rtc: s5m: driver improvements Alexandre Belloni
  3 siblings, 0 replies; 6+ messages in thread
From: Bartosz Golaszewski @ 2021-01-14 10:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz, Alessandro Zummo,
	Alexandre Belloni
  Cc: linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski

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>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/rtc/rtc-s5m.c | 31 +++++++------------------------
 1 file changed, 7 insertions(+), 24 deletions(-)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index eb9dde4095a9..858d5f0e860f 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);
@@ -771,7 +772,7 @@ static int s5m_rtc_probe(struct platform_device *pdev)
 		ret = PTR_ERR(info->regmap);
 		dev_err(&pdev->dev, "Failed to allocate RTC register map: %d\n",
 				ret);
-		goto err;
+		return ret;
 	}
 
 	info->dev = &pdev->dev;
@@ -781,10 +782,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;
 		}
 	}
 
@@ -797,10 +797,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");
@@ -813,23 +811,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;
 }
 
@@ -874,7 +858,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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v5 3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg()
  2021-01-14 10:22 [PATCH v5 0/3] rtc: s5m: driver improvements Bartosz Golaszewski
  2021-01-14 10:22 ` [PATCH v5 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski
  2021-01-14 10:22 ` [PATCH v5 2/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski
@ 2021-01-14 10:22 ` Bartosz Golaszewski
  2021-01-15 15:21   ` Krzysztof Kozlowski
  2021-01-16 22:23 ` [PATCH v5 0/3] rtc: s5m: driver improvements Alexandre Belloni
  3 siblings, 1 reply; 6+ messages in thread
From: Bartosz Golaszewski @ 2021-01-14 10:22 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz, Alessandro Zummo,
	Alexandre Belloni
  Cc: linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This function can fail if regmap operations fail so check its return
value in probe().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/rtc/rtc-s5m.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c
index 858d5f0e860f..80b66f16db89 100644
--- a/drivers/rtc/rtc-s5m.c
+++ b/drivers/rtc/rtc-s5m.c
@@ -791,6 +791,8 @@ static int s5m_rtc_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, info);
 
 	ret = s5m8767_rtc_init_reg(info);
+	if (ret)
+		return ret;
 
 	device_init_wakeup(&pdev->dev, 1);
 
-- 
2.29.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg()
  2021-01-14 10:22 ` [PATCH v5 3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski
@ 2021-01-15 15:21   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2021-01-15 15:21 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski

On Thu, Jan 14, 2021 at 11:22:19AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> This function can fail if regmap operations fail so check its return
> value in probe().
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
>  drivers/rtc/rtc-s5m.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v5 0/3] rtc: s5m: driver improvements
  2021-01-14 10:22 [PATCH v5 0/3] rtc: s5m: driver improvements Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2021-01-14 10:22 ` [PATCH v5 3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski
@ 2021-01-16 22:23 ` Alexandre Belloni
  3 siblings, 0 replies; 6+ messages in thread
From: Alexandre Belloni @ 2021-01-16 22:23 UTC (permalink / raw)
  To: Alessandro Zummo, Bartosz Golaszewski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski
  Cc: Alexandre Belloni, linux-kernel, linux-rtc, linux-samsung-soc,
	Bartosz Golaszewski

On Thu, 14 Jan 2021 11:22:16 +0100, Bartosz Golaszewski wrote:
> This is a set of improvements for the rtc-s5m driver. The first patch
> is new in v4: I noticed the I2C regmap is not selected by this driver's
> Kconfig. Two subsequent patches were already submitted separately.
> 
> v1 -> v2:
> - remove the remove() callback
> 
> [...]

Applied, thanks!

[1/3] rtc: s5m: select REGMAP_I2C
      commit: 1f0cbda3b452b520c5f3794f8f0e410e8bc7386a
[2/3] rtc: s5m: use devm_i2c_new_dummy_device()
      commit: 7db7ad0817fe7d3c6fcbd9402deb7509b2851f06
[3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg()
      commit: 3be95d277484117f248b2f7e8cb8d14cb38dbb04

Best regards,
-- 
Alexandre Belloni <alexandre.belloni@bootlin.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-16 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 10:22 [PATCH v5 0/3] rtc: s5m: driver improvements Bartosz Golaszewski
2021-01-14 10:22 ` [PATCH v5 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski
2021-01-14 10:22 ` [PATCH v5 2/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski
2021-01-14 10:22 ` [PATCH v5 3/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski
2021-01-15 15:21   ` Krzysztof Kozlowski
2021-01-16 22:23 ` [PATCH v5 0/3] rtc: s5m: driver improvements Alexandre Belloni

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).