Re: [PATCH v8 2/2] rtc: sophgo: add rtc support for Sophgo CV1800 SoC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux