Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp257801rwl; Wed, 9 Aug 2023 14:10:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGF6PvIhUuAm6TMiq+tl6xovq+oeAmlfb0C2HiB0kGN6XT5hboaVfpZ4eRGeOvwRfuHwnY1 X-Received: by 2002:adf:fdc6:0:b0:317:731c:4d80 with SMTP id i6-20020adffdc6000000b00317731c4d80mr371454wrs.24.1691615417840; Wed, 09 Aug 2023 14:10:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691615417; cv=none; d=google.com; s=arc-20160816; b=bkmIZY7SH+jzYjYNVtlABdQhw3BQCbsEiyslK/W87WicO48rGm3tXPZYM/TMdxXpc8 BH0/n5OaBKXtpDBL2dlAslE5sgC3dNNHwKl9XN2CNxcrL5hLjZ+zlZQI7wQoqgXahq/d xgjagK7q+zfrTbavEmXZT+iHW0OaI31Mup2QYwORROcP6XcAixXi1bIAyLp/CKLxOfOO 3ULiAOztKhjeNEhKxCfXaliHtnT1/4h3D/xq3h46ym1yG9hGPhIiOzWlvMM+yyrMl8uq 9gFS3Hs/iAioo45IlA9YfhNiqF9bwh3LCMg1jmtySAqXVMmwrdrEKlS3y5XlM1io3Pcq cA9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kPW09UgKy6OANt/oXizeTaW2z/JDlSP2rAujG/yz74A=; fh=U1JVIPEJJwjdYr4TnGDsc4xTwnQEU1Uz503WyjvJtqY=; b=YnO+F8qZNsNf7D2vIyfc9pC2tOd8BQixz3NvkyrT0kx/2Ss7/KxohYghvcEGz/r9Pk pAt0oooRZacFUkP6UJn0KSRtRWOpzFHWzUdaoVZg653U1DI2v0TyVvj1/q9q08XEjuVW B/agMX1TT7MDT0xdWigEAMsLUHbDNelqCwrWyIHq5vPqEoCVSJB+TtObMlxH86wURE22 aUY2Vf7VfZ3EHRU/Sx8sL9MSXE8tBGELnFlS8FPZUhSnWsvM0MaCNpGMPg836Cw5hZ4J L3104ke5oPBr02uRsafpx1Yh4Z6Nb+7/spoNp3dfqOQOsmiVEbqvDh6Y9g1/W+sSEElI 2vqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=DoqQ00h4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020aa7c655000000b005222b4faaf1si4528985edr.356.2023.08.09.14.09.53; Wed, 09 Aug 2023 14:10:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=DoqQ00h4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbjHITg7 (ORCPT + 99 others); Wed, 9 Aug 2023 15:36:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbjHITg4 (ORCPT ); Wed, 9 Aug 2023 15:36:56 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4186AFE; Wed, 9 Aug 2023 12:36:55 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id E0116E0002; Wed, 9 Aug 2023 19:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691609813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kPW09UgKy6OANt/oXizeTaW2z/JDlSP2rAujG/yz74A=; b=DoqQ00h4N3l8g82I0ZotMLLrmV7473F2CyG7q/pznoEogewJrHwAkvN1zwBTHDr2r2X3pY z56QJ9ivJ/1lakTN8M+qJDTvNIYTtgroEgjI7nO/4NULO4bInyb8umVaWQi5K+9I+I/sRA U4j0JGmVFKcOaEvdJQzvqo8QXzvhk+9ubmU7BPDe1b5HfUgj2di7T8SQ2my0//xOnxVCE2 7DvgyRj/UEerXl44O9lmj/PVzlrx7Xz4sZOKFXD5SVudeu7UXzAYIDP16+3/4llE1EH9If wSXKimT3fE4W06XQeoXRb/EtbNYTy9ubL3zZG9NCjfkMrsWcRLCV5WxHPvm/MQ== Date: Wed, 9 Aug 2023 21:36:51 +0200 From: Alexandre Belloni To: Krzysztof Kozlowski Cc: Mia Lin , avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, a.zummo@towertech.it, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, KWLIU@nuvoton.com, JJLIU0@nuvoton.com, KFLIN@nuvoton.com, mylin1@nuvoton.com, openbmc@lists.ozlabs.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] rtc: nuvoton: Compatible with NCT3015Y-R and NCT3018Y-R Message-ID: <202308091936514bb18c4e@mail.local> References: <20230809095112.2836-1-mimi05633@gmail.com> <20230809095112.2836-3-mimi05633@gmail.com> <50bedd75-bcd6-d7bc-26c0-b8c00f99779a@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50bedd75-bcd6-d7bc-26c0-b8c00f99779a@linaro.org> X-GND-Sasl: alexandre.belloni@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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