[PATCH v2 2/2] rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-R

Minying Lin mimi05633 at gmail.com
Thu Aug 10 21:28:40 AEST 2023


>
> Dear Alexandre and Krzysztof,


> Thank you for your comments.

I will remove the comparison between DT compatible and chip data.



> Best regards,

Mia


> Alexandre Belloni <alexandre.belloni at bootlin.com> 於 2023年8月10日 星期四寫道:

On 09/08/2023 16:29:33+0200, Krzysztof Kozlowski wrote:

> On 09/08/2023 11:51, Mia Lin wrote:

> > - flags = NCT3018Y_BIT_TWO;

> > - err = i2c_smbus_write_byte_data(client, NCT3018Y_REG_CTRL, flags);

> > - if (err < 0) {

> > - dev_dbg(&client->dev, "Unable to write NCT3018Y_REG_CTRL\n");

> > - return err;

> > + flags = i2c_smbus_read_byte_data(client, NCT3018Y_REG_PART);

> > + if (flags < 0) {

> > + dev_dbg(&client->dev, "%s: read error\n", __func__);

> > + return flags;

> > + } else if (flags & NCT3018Y_REG_PART_NCT3018Y) {

> > + if (!(flags & data->part_number))

> > + dev_warn(&client->dev, "%s: part_num=0x%x but
> NCT3018Y_REG_PART=0x%x\n",

> > + __func__, data->part_number, flags);

> > + flags = NCT3018Y_BIT_HF;

> > + err = i2c_smbus_write_byte_data(client, NCT3018Y_REG_CTRL, flags);

> > + if (err < 0) {

> > + dev_dbg(&client->dev, "Unable to write NCT3018Y_REG_CTRL\n");

> > + return err;

> > + }

> > + } else if (flags & NCT3018Y_REG_PART_NCT3015Y) {

> > + if (!(flags & data->part_number))

> > + dev_warn(&client->dev, "%s: part_num=0x%x but
> NCT3018Y_REG_PART=0x%x\n",

> > + __func__, data->part_number, flags);

>

> I don't think this is correct. Kernel's job is not to verify the DT...

> and why would it verify the device based on DT? You have here device

> detection so use it directly without this dance of comparing with

> compatible/match data.

>


> I fully agree here, either you trust your DT or the device ID but do not

use both.


>
> --

Alexandre Belloni, co-owner and COO, Bootlin

Embedded Linux and Kernel engineering

https://bootlin.com


>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20230810/22a4a896/attachment.htm>


More information about the openbmc mailing list