[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOoeyxUOZSA++uprMZ+4rbjb1zuyPUi6728Cx8sudRaizqSwnA@mail.gmail.com>
Date: Mon, 23 Dec 2024 09:50:56 +0800
From: Ming Yu <a0282524688@...il.com>
To: Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: tmyu0@...oton.com, lee@...nel.org, linus.walleij@...aro.org, brgl@...ev.pl,
andi.shyti@...nel.org, mkl@...gutronix.de, mailhol.vincent@...adoo.fr,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, wim@...ux-watchdog.org,
linux@...ck-us.net, jdelvare@...e.com, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org,
linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-rtc@...r.kernel.org
Subject: Re: [PATCH v3 7/7] rtc: Add Nuvoton NCT6694 RTC support
Dear Alexandre,
Thank you for your comments,
Alexandre Belloni <alexandre.belloni@...tlin.com> 於 2024年12月16日 週一 下午6:42寫道:
>
> On 10/12/2024 18:45:24+0800, Ming Yu wrote:
> > +static int nct6694_rtc_probe(struct platform_device *pdev)
> > +{
> > + struct nct6694_rtc_data *data;
> > + struct nct6694 *nct6694 = dev_get_drvdata(pdev->dev.parent);
> > + int ret, irq;
> > +
> > + irq = irq_create_mapping(nct6694->domain, NCT6694_IRQ_RTC);
> > + if (!irq)
> > + return -EINVAL;
> > +
> > + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> > + if (!data)
> > + return -ENOMEM;
> > +
> > + data->xmit_buf = devm_kcalloc(&pdev->dev, NCT6694_MAX_PACKET_SZ,
> > + sizeof(unsigned char), GFP_KERNEL);
> > + if (!data->xmit_buf)
> > + return -ENOMEM;
> > +
> > + data->rtc = devm_rtc_allocate_device(&pdev->dev);
> > + if (IS_ERR(data->rtc))
> > + return PTR_ERR(data->rtc);
> > +
> > + data->nct6694 = nct6694;
> > + data->rtc->ops = &nct6694_rtc_ops;
> > + data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
> > + data->rtc->range_max = RTC_TIMESTAMP_END_2099;
> > +
> > + mutex_init(&data->lock);
>
> You should use rtc_lock/rtc_unlock instead of having your own lock. The
> core will take and release the lock appropriately before calling the
> rtc_ops so you only have to do it in the irq handler.
>
Understood. I will make the modifications in the next patch.
> > +
> > + device_set_wakeup_capable(&pdev->dev, 1);
>
> This will cause a memory leak later on, see the discussion here:
>
> https://lore.kernel.org/linux-rtc/a88475b6-08bf-4c7c-ad63-efd1f29307e3@pf.is.s.u-tokyo.ac.jp/T/#mf51fdce6036efa3ea12fe75bd5126d4ac0c6813e
>
Okay! I will drop it and add device_init_wakeup() in the next patch.
Best regards,
Ming
Powered by blists - more mailing lists