lkml.org 
[lkml]   [2023]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 2/2] rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-R
From
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.

Best regards,
Krzysztof

\
 
 \ /
  Last update: 2023-08-09 16:30    [W:0.047 / U:1.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site