* [PATCH 1/3] rtc: da9052: convert to devm_rtc_allocate_device
@ 2020-03-06 7:35 Alexandre Belloni
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2020-03-06 7:35 UTC (permalink / raw)
To: Support Opensource, Alessandro Zummo, Alexandre Belloni
Cc: linux-rtc, linux-kernel
This allows further improvement of the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-da9052.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 204eb7cf1aa4..e159c5911122 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -298,12 +298,12 @@ static int da9052_rtc_probe(struct platform_device *pdev)
rtc_err(rtc, "Failed to disable TICKS: %d\n", ret);
device_init_wakeup(&pdev->dev, true);
- rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &da9052_rtc_ops, THIS_MODULE);
-
+ rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc))
return PTR_ERR(rtc->rtc);
+ rtc->rtc->ops = &da9052_rtc_ops;
+
ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM",
da9052_rtc_irq, rtc);
if (ret != 0) {
@@ -311,7 +311,7 @@ static int da9052_rtc_probe(struct platform_device *pdev)
return ret;
}
- return 0;
+ return rtc_register_device(rtc->rtc);
}
static struct platform_driver da9052_rtc_driver = {
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH 1/3] rtc: da9052: convert to devm_rtc_allocate_device
2020-03-06 7:35 Alexandre Belloni
@ 2020-03-12 17:11 ` Adam Thomson
0 siblings, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2020-03-12 17:11 UTC (permalink / raw)
To: Alexandre Belloni, Support Opensource, Alessandro Zummo
Cc: linux-rtc, linux-kernel
On 06 March 2020 07:36, Alexandre Belloni wrote:
> This allows further improvement of the driver.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/rtc-da9052.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
> index 204eb7cf1aa4..e159c5911122 100644
> --- a/drivers/rtc/rtc-da9052.c
> +++ b/drivers/rtc/rtc-da9052.c
> @@ -298,12 +298,12 @@ static int da9052_rtc_probe(struct platform_device
> *pdev)
> rtc_err(rtc, "Failed to disable TICKS: %d\n", ret);
>
> device_init_wakeup(&pdev->dev, true);
> - rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
> - &da9052_rtc_ops, THIS_MODULE);
> -
> + rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
> if (IS_ERR(rtc->rtc))
> return PTR_ERR(rtc->rtc);
>
> + rtc->rtc->ops = &da9052_rtc_ops;
> +
> ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM",
> da9052_rtc_irq, rtc);
> if (ret != 0) {
> @@ -311,7 +311,7 @@ static int da9052_rtc_probe(struct platform_device
> *pdev)
> return ret;
> }
>
> - return 0;
> + return rtc_register_device(rtc->rtc);
It seems with this change there's no tidy up around the IRQ.
da9052_request_irq() isn't calling a devm_* function so I'm not sure how the
IRQ is being freed on failure. In actual fact it looks like there's no _remove()
function for this driver which, although that's a separate topic.
> }
>
> static struct platform_driver da9052_rtc_driver = {
> --
> 2.24.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/3] rtc: da9052: convert to devm_rtc_allocate_device
@ 2020-03-06 7:35 Alexandre Belloni
2020-03-12 17:11 ` Adam Thomson
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2020-03-06 7:35 UTC (permalink / raw)
To: Support Opensource, Alessandro Zummo, Alexandre Belloni
Cc: linux-rtc, linux-kernel
This allows further improvement of the driver.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-da9052.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
index 204eb7cf1aa4..e159c5911122 100644
--- a/drivers/rtc/rtc-da9052.c
+++ b/drivers/rtc/rtc-da9052.c
@@ -298,12 +298,12 @@ static int da9052_rtc_probe(struct platform_device *pdev)
rtc_err(rtc, "Failed to disable TICKS: %d\n", ret);
device_init_wakeup(&pdev->dev, true);
- rtc->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
- &da9052_rtc_ops, THIS_MODULE);
-
+ rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(rtc->rtc))
return PTR_ERR(rtc->rtc);
+ rtc->rtc->ops = &da9052_rtc_ops;
+
ret = da9052_request_irq(rtc->da9052, DA9052_IRQ_ALARM, "ALM",
da9052_rtc_irq, rtc);
if (ret != 0) {
@@ -311,7 +311,7 @@ static int da9052_rtc_probe(struct platform_device *pdev)
return ret;
}
- return 0;
+ return rtc_register_device(rtc->rtc);
}
static struct platform_driver da9052_rtc_driver = {
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-12 17:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06 7:35 [PATCH 1/3] rtc: da9052: convert to devm_rtc_allocate_device Alexandre Belloni
2020-03-06 7:35 Alexandre Belloni
2020-03-12 17:11 ` Adam Thomson
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).