lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAhV-H4rrQ5v85TXSF-oFAxSxFgvvXR+O2YmDhOPhCcwuOzVuA@mail.gmail.com>
Date: Fri, 29 Nov 2024 17:57:48 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Ming Wang <wangming01@...ngson.cn>
Cc: Alexandre Belloni <alexandre.belloni@...tlin.com>, Keguang Zhang <keguang.zhang@...il.com>, 
	Jiaxun Yang <jiaxun.yang@...goat.com>, WANG Xuerui <git@...0n.name>, 
	Binbin Zhou <zhoubinbin@...ngson.cn>, linux-rtc@...r.kernel.org, 
	linux-kernel@...r.kernel.org, lixuefeng@...ngson.cn, gaojuxin@...ngson.cn
Subject: Re: [PATCH] rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr

Hi,

On Thu, Nov 28, 2024 at 3:02 PM Ming Wang <wangming01@...ngson.cn> wrote:
>
> The TOY_MATCH0_REG should be cleared to 0 in the RTC interrupt handler,
> otherwise the interrupt cannot be cleared, which will cause the
> loongson_rtc_isr to be triggered multiple times.
Function names usually use () postfixes, e.g., loongson_rtc_isr() and
loongson_rtc_handler().

>
> The previous code cleared TOY_MATCH0_REG in the loongson_rtc_handler,
> which is an ACPI interrupt. This did not prevent loongson_rtc_isr
> from being triggered multiple times.
>
> This commit moves the clearing of TOY_MATCH0_REG to the loongson_rtc_isr
> to ensure that the interrupt is properly cleared.
>
> Fixes: 1b733a9ebc3d ("rtc: Add rtc driver for the Loongson family chips")
> Signed-off-by: Ming Wang <wangming01@...ngson.cn>
> ---
>  drivers/rtc/rtc-loongson.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-loongson.c b/drivers/rtc/rtc-loongson.c
> index e8ffc1ab90b0..0aa30095978b 100644
> --- a/drivers/rtc/rtc-loongson.c
> +++ b/drivers/rtc/rtc-loongson.c
> @@ -114,6 +114,12 @@ static irqreturn_t loongson_rtc_isr(int irq, void *id)
>         struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id;
>
>         rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF);
> +
> +       /*
> +        * The TOY_MATCH0_REG should be cleared 0 here,
> +        * otherwise the interrupt cannot be cleared.
> +        */
> +       regmap_write(priv->regmap, TOY_MATCH0_REG, 0);
There is usually a blank line before the return statement.

Huacai

>         return IRQ_HANDLED;
>  }
>
> @@ -131,11 +137,7 @@ static u32 loongson_rtc_handler(void *id)
>         writel(RTC_STS, priv->pm_base + PM1_STS_REG);
>         spin_unlock(&priv->lock);
>
> -       /*
> -        * The TOY_MATCH0_REG should be cleared 0 here,
> -        * otherwise the interrupt cannot be cleared.
> -        */
> -       return regmap_write(priv->regmap, TOY_MATCH0_REG, 0);
> +       return ACPI_INTERRUPT_HANDLED;
>  }
>
>  static int loongson_rtc_set_enabled(struct device *dev)
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ