lkml.org 
[lkml]   [2024]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 2/2] rtc: sophgo: add rtc support for Sophgo CV1800 SoC
Hello,

On 04/02/2024 12:41:43+0800, Jingbao Qiu wrote:
> +#define REG_ENABLE_FUN BIT(0)
> +#define REG_DISABLE_FUN 0x00UL

I don't feel like these two macros make your code clearer, you should
probably simply use 0 and 1 in the proper locations.

> +static irqreturn_t cv1800_rtc_irq_handler(int irq, void *dev_id)
> +{
> + struct rtc_device *rtc = dev_id;
> +
> + rtc_update_irq(rtc, 1, RTC_IRQF | RTC_AF);

I'm pretty sure this would result in a crash...

> +
> + return IRQ_HANDLED;
> +}
> +
> + ret = devm_request_irq(&pdev->dev, rtc->irq, cv1800_rtc_irq_handler,
> + IRQF_TRIGGER_HIGH, "alarm", &pdev->dev);

.. you probably want to use rtc->rtc_dev here to fix this.

This also means that you have to request the irq late, else you are open
t a race condition anyway.

> + if (ret)
> + return dev_err_probe(&pdev->dev, ret,
> + "cannot register interrupt handler\n");
> +

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

\
 
 \ /
  Last update: 2024-04-17 23:23    [W:0.031 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site