Messages in this thread | | | From | Jingbao Qiu <> | Date | Wed, 24 Apr 2024 15:35:57 +0800 | 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
| |