linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler()
@ 2022-06-27 20:59 Tom Rix
  2022-06-28  7:12 ` Conor.Dooley
  2022-07-26 14:22 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Rix @ 2022-06-27 20:59 UTC (permalink / raw)
  To: lewis.hanly, conor.dooley, a.zummo, alexandre.belloni, daire.mcnamara
  Cc: linux-riscv, linux-rtc, linux-kernel, Tom Rix

cppcheck reports
[drivers/rtc/rtc-mpfs.c:219]: (style) Variable 'pending' is assigned a value that is never used.

The fetched CONTROL_REG stored in pending is unused and partially
duplicates the functionality of the later call to mpfs_rtc_clear().  This looks
like leftover development code, so remove pending.

Fixes: 0b31d703598d ("rtc: Add driver for Microchip PolarFire SoC")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/rtc/rtc-mpfs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/rtc/rtc-mpfs.c b/drivers/rtc/rtc-mpfs.c
index db9c638e50f7..f14d1925e0c9 100644
--- a/drivers/rtc/rtc-mpfs.c
+++ b/drivers/rtc/rtc-mpfs.c
@@ -213,10 +213,7 @@ static inline struct clk *mpfs_rtc_init_clk(struct device *dev)
 static irqreturn_t mpfs_rtc_wakeup_irq_handler(int irq, void *dev)
 {
 	struct mpfs_rtc_dev *rtcdev = dev;
-	unsigned long pending;
 
-	pending = readl(rtcdev->base + CONTROL_REG);
-	pending &= CONTROL_ALARM_ON_BIT;
 	mpfs_rtc_clear_irq(rtcdev);
 
 	rtc_update_irq(rtcdev->rtc, 1, RTC_IRQF | RTC_AF);
-- 
2.27.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler()
  2022-06-27 20:59 [PATCH] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler() Tom Rix
@ 2022-06-28  7:12 ` Conor.Dooley
  2022-07-26 14:22 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Conor.Dooley @ 2022-06-28  7:12 UTC (permalink / raw)
  To: trix, Lewis.Hanly, a.zummo, alexandre.belloni, Daire.McNamara
  Cc: linux-riscv, linux-rtc, linux-kernel

On 27/06/2022 21:59, Tom Rix wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> cppcheck reports
> [drivers/rtc/rtc-mpfs.c:219]: (style) Variable 'pending' is assigned a value that is never used.
> 
> The fetched CONTROL_REG stored in pending is unused and partially
> duplicates the functionality of the later call to mpfs_rtc_clear().  This looks
> like leftover development code, so remove pending.

It predates my involvement with the driver so I am not sure why
exactly it was introduced, but it looks to me to be surplus to
requirements.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

> 
> Fixes: 0b31d703598d ("rtc: Add driver for Microchip PolarFire SoC")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>   drivers/rtc/rtc-mpfs.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-mpfs.c b/drivers/rtc/rtc-mpfs.c
> index db9c638e50f7..f14d1925e0c9 100644
> --- a/drivers/rtc/rtc-mpfs.c
> +++ b/drivers/rtc/rtc-mpfs.c
> @@ -213,10 +213,7 @@ static inline struct clk *mpfs_rtc_init_clk(struct device *dev)
>   static irqreturn_t mpfs_rtc_wakeup_irq_handler(int irq, void *dev)
>   {
>          struct mpfs_rtc_dev *rtcdev = dev;
> -       unsigned long pending;
> 
> -       pending = readl(rtcdev->base + CONTROL_REG);
> -       pending &= CONTROL_ALARM_ON_BIT;
>          mpfs_rtc_clear_irq(rtcdev);
> 
>          rtc_update_irq(rtcdev->rtc, 1, RTC_IRQF | RTC_AF);
> --
> 2.27.0
> 

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler()
  2022-06-27 20:59 [PATCH] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler() Tom Rix
  2022-06-28  7:12 ` Conor.Dooley
@ 2022-07-26 14:22 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2022-07-26 14:22 UTC (permalink / raw)
  To: lewis.hanly, conor.dooley, trix, daire.mcnamara, a.zummo
  Cc: linux-riscv, linux-kernel, linux-rtc

On Mon, 27 Jun 2022 16:59:43 -0400, Tom Rix wrote:
> cppcheck reports
> [drivers/rtc/rtc-mpfs.c:219]: (style) Variable 'pending' is assigned a value that is never used.
> 
> The fetched CONTROL_REG stored in pending is unused and partially
> duplicates the functionality of the later call to mpfs_rtc_clear().  This looks
> like leftover development code, so remove pending.
> 
> [...]

Applied, thanks!

[1/1] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler()
      commit: 3fa0cb37bda9d45d3c6f07e67051e7118d3ffe63

Best regards,

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2022-07-26 14:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 20:59 [PATCH] rtc: remove 'pending' variable from mpfs_rtc_wakeup_irq_handler() Tom Rix
2022-06-28  7:12 ` Conor.Dooley
2022-07-26 14:22 ` 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).