[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202308091936514bb18c4e@mail.local>
Date: Wed, 9 Aug 2023 21:36:51 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc: Mia Lin <mimi05633@...il.com>, avifishman70@...il.com,
tmaimon77@...il.com, tali.perry1@...il.com, venture@...gle.com,
yuenn@...gle.com, benjaminfair@...gle.com, a.zummo@...ertech.it,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org,
conor+dt@...nel.org, KWLIU@...oton.com, JJLIU0@...oton.com,
KFLIN@...oton.com, mylin1@...oton.com, openbmc@...ts.ozlabs.org,
linux-rtc@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] rtc: nuvoton: Compatible with NCT3015Y-R and
NCT3018Y-R
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
Powered by blists - more mailing lists