Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1715967imn; Sun, 31 Jul 2022 19:22:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vbYQBWEh33hvmC4+unS+dDvQP4SjN+lzzB/JnrzNY+NIB7azx5hU/0tM0F6fQ/t9oiAChq X-Received: by 2002:a17:907:75e9:b0:72b:2ddb:41fe with SMTP id jz9-20020a17090775e900b0072b2ddb41femr10823334ejc.329.1659320574558; Sun, 31 Jul 2022 19:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659320574; cv=none; d=google.com; s=arc-20160816; b=hYcwvzQaCxUdxvyGZQomu4RvSiAeSSH4WPkm0wjteFXc41MY5FZTVc0S5umy+ENj1h eUQSdUsSJx96esYklS5CyZHvXfSW0RaecsXr8x0REB6PeOFD5hpECnIEwhCkK1ElMilg cCTjklAkgVlii79AG/XrhSjgwZDFQoNEN65edYz/gsfZ6EnhK7DZ4olzAzkb7NL8V2KT nkeHRyuhjbvGc6YFbkbgT2K6QoV3aTZm69gBOetwKtR5GMaS5KjavwFP2UxjPevx3h4A +wzv4zkd+MuOBGBFFHnuB9oP+oTAjTWdgkt1zKNeT/Gj4ry5PV9s3IpkOhfb81eHcReF F+7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cts89Urg1Uc0LBv0m8WUOVTMu8H/nP9lQWVspGvxl/M=; b=mbwRVItH/GgeTNmMgTD62YrCtCHDi11mOnrcrDMaN0Fe4cy1F3Fov2FxNse77oobun 67H1BoNzThxtwl/NGMoHGnyDY0qwD0CmGTD50itojHsZ2IQnCBBIubDBMtJoA35EdpZN GeCBoDy2dfUf4FnUyQr301YNxK9x/Vbs2wpOi6MF66KQQLvoAutE2oHvBZFkrUnLtbQD FFX06sJ4ysuIO07fsLu5/KrQmJO8J5Mf4yuj5cdH7zMCL63PO5cmWmEBNbx+WzXaSAPb m9qvIiLc1l/JGdoNPNpbUAphOmVRxQdx6WwcxWiyeKsmGI0QIwuPHAgrg/P1Ez2wmWCQ ZKzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Yoyl7sbl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt18-20020a1709072d9200b0072ef491cc0dsi10854130ejc.113.2022.07.31.19.22.29; Sun, 31 Jul 2022 19:22:54 -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=@gmail.com header.s=20210112 header.b=Yoyl7sbl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236386AbiHABwq (ORCPT + 99 others); Sun, 31 Jul 2022 21:52:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229569AbiHABwo (ORCPT ); Sun, 31 Jul 2022 21:52:44 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31033101EC; Sun, 31 Jul 2022 18:52:43 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id v16-20020a17090abb9000b001f25244c65dso13637293pjr.2; Sun, 31 Jul 2022 18:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=cts89Urg1Uc0LBv0m8WUOVTMu8H/nP9lQWVspGvxl/M=; b=Yoyl7sblFAAr4nHx9Dw11RXEAxdHiU4x6bJUImWzvGs8+ogPEAD8n1G3W4OLAvcriP XTjhuYo6QuntcB3so/5xBNA2YDR+GYuYl+MZ0EdsQ6oJ9YdTl7y2uDLaLvcOgbdfUou9 IOdgeaItYpET9I6Feq6O2WIx51DSLd7xTJFLL9+JzLCWhwQGXTYIZESs+dmFF8CjJlk9 NeT1k58fdutlDBeJEzgOHs8rAg67bFvrfwaHaEaqe7HLu/2q+J+IU5f8UrHjXFS+YNDD xFaYIKJeH8S0d4LD2LMFOdMj4JIVaPCdSsYES8eAZLX1eDD9AKBzaM3M0LpLtKWJ36PM VR6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=cts89Urg1Uc0LBv0m8WUOVTMu8H/nP9lQWVspGvxl/M=; b=xpa/oTCqJLOTi11UoSP3HD4ysuWco9ydaPoCvynLkhLvj6p/To98EUZ9HD518XtuvQ n9S9FzZdGd3QOqNgDgFw9hIB4wuk7XAE7Irz0TrR3V1MNukIPMjVFhu899P61nlBQaDK pV0l+Ea4VGi/+qx28AiFioP4dJkhc6PXwzZ4YljtpXk2taNjznY+qLBB8rFvL+a33CMz bPMdql38fOQv7rELtgKoYnAIVHnJW1UTRQ72JtB875j+bft2p4KBgqosV3x2B0thn/ul lOlMD7l+Qh72wqs2uJs7VEArCj46LHdIhX0Ac0HMzeMUpcXiquOOJHLR/2k5HBKFy3SY 4vGA== X-Gm-Message-State: ACgBeo0ZHS+4wIFsN6Ha5DukIhIU6LTBkyQKR5s3zwOGzGu5rq9zbNYd vSaWitxdbRx+TYx5HI0QglA= X-Received: by 2002:a17:903:11d1:b0:16c:defc:a098 with SMTP id q17-20020a17090311d100b0016cdefca098mr14349003plh.50.1659318762325; Sun, 31 Jul 2022 18:52:42 -0700 (PDT) Received: from [10.10.4.41] (125-228-123-29.hinet-ip.hinet.net. [125.228.123.29]) by smtp.gmail.com with ESMTPSA id v10-20020a63f20a000000b0041b672e93c2sm6292529pgh.17.2022.07.31.18.52.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Jul 2022 18:52:41 -0700 (PDT) Message-ID: <4ea235d1-46c1-87de-760f-dc4775007ae0@gmail.com> Date: Mon, 1 Aug 2022 09:50:28 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v5 2/2] iio: humidity: hdc100x: add manufacturer and device ID check Content-Language: en-US To: Jonathan Cameron Cc: Andy Shevchenko , Lars-Peter Clausen , Patrick Williams , Potin Lai , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220728125435.3336618-1-potin.lai.pt@gmail.com> <20220728125435.3336618-3-potin.lai.pt@gmail.com> <20220731130959.50826fc4@jic23-huawei> From: Potin Lai In-Reply-To: <20220731130959.50826fc4@jic23-huawei> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 7/31/22 20:09, Jonathan Cameron wrote: > On Thu, 28 Jul 2022 12:54:35 +0000 > Potin Lai wrote: > >> Add manufacturer and device ID checking during probe, and skip the >> checking if chip model not supported. >> >> Supported: >> - HDC1000 >> - HDC1010 >> - HDC1050 >> - HDC1080 >> >> Not supported: >> - HDC1008 >> >> Signed-off-by: Potin Lai > I need some more information on the 'why' of this patch. There are a number > of drivers that do a similar ID check but in recent times, that approach has > been considered wrong because it breaks potential use of multiple compatible > entries in device tree. If a new device comes along and is backwards > compatible with an existing one (maybe has new features, but using them is > optional) then we want to have an entry that looks like > > compatible = "ti,hdc1099", "ti,hdc1080" > > If the new ID is not supported by the kernel that is being used, we still > want the driver to 'work' using the fallback compatible. > > As such, we no generally do the following. > > 1) If we have a match to a device we know about but it's not the one the > firmware tells us to expect, print a warning but operate as if the firmware > had been correct - particularly if we know the parts aren't compatible > with each other. (this bit is optional as we should be able to assume firmware > doesn't do stupid things :) > 2) If we don't match at all, print a warning about an unknown device but carry > on with assumption that the firmware is correct and this new device ID is > backwards compatible with the provided fallback compatible. > > So if this is just a bit of defensive programming (rather than necessary for some > reason not yet explained) then change from returning an error on probe() to > printing an warning message but continuing anyway. (which is part (2) of the > above) Hi Jonathan, In our hardware board, we have "ti,hdc1080" as main source, and "silabs,si7020" for 2nd source. This two chip are locate at same bus and same slave address, and we want to use multiple compatibles to support both chips with single device node in device tree.   Ex: compatible = "ti,hdc1099", "silabs,si7020";   In order to support this, I need to add ID checking mechanism into the current hdc100x driver, so the si7020 chip will fail to probe with hdc100x driver (because the ID checking is not failed), then success probe with si7020.   Base on you explanation, it looks multiple compatibles is not suitable in this case? Would you mind advise us what would be the better approach for our case? Thanks, Potin