[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJRtX8Ttwfj4+TcXu34ecNZjkdsrcb6rjovGMwpiwJhzcneB6Q@mail.gmail.com>
Date: Wed, 24 Apr 2024 15:35:57 +0800
From: Jingbao Qiu <qiujingbao.dlmu@...il.com>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
paul.walmsley@...ive.com, palmer@...belt.com, aou@...s.berkeley.edu,
linux-rtc@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, dlan@...too.org, inochiama@...look.com
Subject: Re: [PATCH v8 2/2] rtc: sophgo: add rtc support for Sophgo CV1800 SoC
Hi, Alexandre
I'm glad to receive your reply.
> I don't feel like these two macros make your code clearer, you should
> probably simply use 0 and 1 in the proper locations.
>
I will use 0/1 replace this macros.
> > +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...
Yes, it did happen. Because I inserted an incorrect pointer.
>
> > +
> > + 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.
I am very sorry about this bug.
I will use rtc->rtc_dev to fix it and request irq after
devm_rtc_allocate_device.
Best regards
Jingbao Qiu
Powered by blists - more mailing lists