* [PATCH v4 0/3] rtc: s5m: driver improvements @ 2021-01-11 12:40 Bartosz Golaszewski 2021-01-11 12:40 ` [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Bartosz Golaszewski @ 2021-01-11 12:40 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> Hopefully this time the kernel bot won't complain anymore... 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 Bartosz Golaszewski (3): rtc: s5m: select REGMAP_I2C rtc: s5m: check the return value of s5m8767_rtc_init_reg() rtc: s5m: use devm_i2c_new_dummy_device() 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] 9+ messages in thread
* [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C 2021-01-11 12:40 [PATCH v4 0/3] rtc: s5m: driver improvements Bartosz Golaszewski @ 2021-01-11 12:40 ` Bartosz Golaszewski 2021-01-11 13:33 ` Krzysztof Kozlowski 2021-01-11 12:40 ` [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski 2021-01-11 12:40 ` [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski 2 siblings, 1 reply; 9+ messages in thread From: Bartosz Golaszewski @ 2021-01-11 12:40 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. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> --- 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] 9+ messages in thread
* Re: [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C 2021-01-11 12:40 ` [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski @ 2021-01-11 13:33 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2021-01-11 13:33 UTC (permalink / raw) To: Bartosz Golaszewski Cc: Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni, linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski On Mon, Jan 11, 2021 at 01:40:25PM +0100, Bartosz Golaszewski wrote: > 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. > > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> > --- > drivers/rtc/Kconfig | 1 + > 1 file changed, 1 insertion(+) > Fixes: 959df7778bbd ("rtc: Enable compile testing for Maxim and Samsung drivers") Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() 2021-01-11 12:40 [PATCH v4 0/3] rtc: s5m: driver improvements Bartosz Golaszewski 2021-01-11 12:40 ` [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski @ 2021-01-11 12:40 ` Bartosz Golaszewski 2021-01-11 13:35 ` Krzysztof Kozlowski 2021-01-11 12:40 ` [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski 2 siblings, 1 reply; 9+ messages in thread From: Bartosz Golaszewski @ 2021-01-11 12:40 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 eb9dde4095a9..e0011d3cf61b 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] 9+ messages in thread
* Re: [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() 2021-01-11 12:40 ` [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski @ 2021-01-11 13:35 ` Krzysztof Kozlowski 2021-01-11 14:11 ` Bartosz Golaszewski 0 siblings, 1 reply; 9+ messages in thread From: Krzysztof Kozlowski @ 2021-01-11 13:35 UTC (permalink / raw) To: Bartosz Golaszewski Cc: Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni, linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski On Mon, Jan 11, 2021 at 01:40:26PM +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(+) > > diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c > index eb9dde4095a9..e0011d3cf61b 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; You leak I2C device. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() 2021-01-11 13:35 ` Krzysztof Kozlowski @ 2021-01-11 14:11 ` Bartosz Golaszewski 2021-01-11 14:12 ` Krzysztof Kozlowski 0 siblings, 1 reply; 9+ messages in thread From: Bartosz Golaszewski @ 2021-01-11 14:11 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni, Linux Kernel Mailing List, linux-samsung-soc, linux-rtc, Bartosz Golaszewski On Mon, Jan 11, 2021 at 2:35 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On Mon, Jan 11, 2021 at 01:40:26PM +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(+) > > > > diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c > > index eb9dde4095a9..e0011d3cf61b 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; > > You leak I2C device. > Yes, the next patch fixes it but I changed the order. Actually this can be moved after 3/3 with no conflicts when applying. Bartosz ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() 2021-01-11 14:11 ` Bartosz Golaszewski @ 2021-01-11 14:12 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2021-01-11 14:12 UTC (permalink / raw) To: Bartosz Golaszewski Cc: Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni, Linux Kernel Mailing List, linux-samsung-soc, linux-rtc, Bartosz Golaszewski On Mon, Jan 11, 2021 at 03:11:24PM +0100, Bartosz Golaszewski wrote: > On Mon, Jan 11, 2021 at 2:35 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > > > On Mon, Jan 11, 2021 at 01:40:26PM +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(+) > > > > > > diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c > > > index eb9dde4095a9..e0011d3cf61b 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; > > > > You leak I2C device. > > > > Yes, the next patch fixes it but I changed the order. Actually this > can be moved after 3/3 with no conflicts when applying. Yes, but for bisecting and any backporting (e.g. with autosel) the order is quite important. Please resend with new order. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() 2021-01-11 12:40 [PATCH v4 0/3] rtc: s5m: driver improvements Bartosz Golaszewski 2021-01-11 12:40 ` [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski 2021-01-11 12:40 ` [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski @ 2021-01-11 12:40 ` Bartosz Golaszewski 2021-01-11 13:36 ` Krzysztof Kozlowski 2 siblings, 1 reply; 9+ messages in thread From: Bartosz Golaszewski @ 2021-01-11 12:40 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> --- 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 e0011d3cf61b..80b66f16db89 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; } } @@ -799,10 +799,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 +813,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 +860,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] 9+ messages in thread
* Re: [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() 2021-01-11 12:40 ` [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski @ 2021-01-11 13:36 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2021-01-11 13:36 UTC (permalink / raw) To: Bartosz Golaszewski Cc: Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni, linux-kernel, linux-samsung-soc, linux-rtc, Bartosz Golaszewski On Mon, Jan 11, 2021 at 01:40:27PM +0100, Bartosz Golaszewski wrote: > 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> > --- > drivers/rtc/rtc-s5m.c | 31 +++++++------------------------ > 1 file changed, 7 insertions(+), 24 deletions(-) Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-01-11 14:13 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-11 12:40 [PATCH v4 0/3] rtc: s5m: driver improvements Bartosz Golaszewski 2021-01-11 12:40 ` [PATCH v4 1/3] rtc: s5m: select REGMAP_I2C Bartosz Golaszewski 2021-01-11 13:33 ` Krzysztof Kozlowski 2021-01-11 12:40 ` [PATCH v4 2/3] rtc: s5m: check the return value of s5m8767_rtc_init_reg() Bartosz Golaszewski 2021-01-11 13:35 ` Krzysztof Kozlowski 2021-01-11 14:11 ` Bartosz Golaszewski 2021-01-11 14:12 ` Krzysztof Kozlowski 2021-01-11 12:40 ` [PATCH v4 3/3] rtc: s5m: use devm_i2c_new_dummy_device() Bartosz Golaszewski 2021-01-11 13:36 ` Krzysztof Kozlowski
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).