Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1283619lqe; Mon, 8 Apr 2024 04:50:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrQTimstrotbnuxR4affBC2+7LRIOKGghEybxw2EYDZsyZpFxazRo6pXp0Bt2eq1bomH7ERUSB8DlvNtKJHzomTNZYCrUaqt9vQKum2A== X-Google-Smtp-Source: AGHT+IGvJUyrYHDeC4fQd3EuBPSLYKPHYGY2yOHbmiQeW0rXS/pAvKggRHAKGzKmRABo3LWcuAD3 X-Received: by 2002:a17:90a:4dc6:b0:2a2:21e6:229a with SMTP id r6-20020a17090a4dc600b002a221e6229amr6725992pjl.35.1712577000812; Mon, 08 Apr 2024 04:50:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712577000; cv=pass; d=google.com; s=arc-20160816; b=vjJU5+e/IVGHjZI4uHZ12Y6OT+G82q/jW1Z5eO3ayFlk3rTp69/h1mqr6QbbLxK+cZ 68uCKZHue/l/kJIJXrdpC/VfDo9Ufy9XQJ+Ru9hECm/VrgJLSa5SBkzvTbbNoU5/k8HX TqEfUs4zusn6bDKjD7WqoV9iqJ9Mje1/6ad6voNh7plL4PWeWfevnYpCmI/0uK9wN3Dk lZuPpA/uhWuadQTw/oHhaJva/TiFmCg3PxTTDuBcS6StxeOu4MnxRrMTRIl0JOfDefIC OfoEQUiih++z8YjiVoib74+W5ftii4vhpcNEHnhhbcdJPgQbj7JwI633XFVNvjZJFgCo fCWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=cMyACkH/7gkijJXbfsrdkRAuYsDQYSZJdsM+qnK7di8=; fh=nST697/MveYlSF0hnsAHaE+92k1YodC49yTip4aWrXY=; b=SwaBMPskiEYNeQ+OzM9IiXVHS8Wn0bHdxpmW2zqGGBwcrea0+kOa4QsCWghTCYk/El Hyz2lUu60oJv+CadcZ6Xpmaf/ItYLQfXTt4kSo11H89lNZPQUEVc7h83q93o640dfUew K/iAseEqMcSx4n8cBKxOSiNGkgRcVhpf8Lh31yVT3HDKCGxlPk8QVwLX/fd8rXZitBat 3peU+dhZ6F7wX+ezM6C5FTvjpK8DnO/tApR92aNlEseGAwNfV1akEt3nOC/Bn9Xhwkdu rWpwtzlN53SaoBa82IfKPN7q08qIH8MfT9VFXc8WZqfZT8nbziRMhA3snBGCjb1jbB/2 BdfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FaKOiWZw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-135284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135284-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id mp8-20020a17090b190800b002a4b06cadffsi4046942pjb.138.2024.04.08.04.50.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 04:50:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FaKOiWZw; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-135284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135284-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 66049B22752 for ; Mon, 8 Apr 2024 11:49:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 936D86A01B; Mon, 8 Apr 2024 11:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FaKOiWZw" Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D92669DF5; Mon, 8 Apr 2024 11:49:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712576988; cv=none; b=AxeC4ElZjxOsgRqXZD/+oz8aFHaLf0+fBNfdgrPcOKoQM0Q3K4hHriVfu3U2GuawEtODjWBDoDT2g7Z5rGvHHcABbTxSGI+yuPPhDdu3uq9ksTyKuDkCcEPpL6eFj7bbD8Picbjz+uHrX91MD69XJ6HnAkJHuQnq1Z7C+z3evpY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712576988; c=relaxed/simple; bh=t/PziARB1DDQE+QkAYx3JX2/jBRkYdtjisvnQqQaxO0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tb2asdzueIA8+DiRQMiJuT97qmYaWR/HzDsxFQ6nLZvkveFUuiL2vEBfrIiZDgWQDMWpmTJCxtDZJyGcXn1bxkuMWarl0TCaD+n+I48A0YdEKhJ37/O2EqEQ+Bslh/N+UEnnxURVlx4kr3aI5bAdwnmNdI3tzq84HwZ11BW5Noo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FaKOiWZw; arc=none smtp.client-ip=209.85.161.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5aa26990d5aso928578eaf.1; Mon, 08 Apr 2024 04:49:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712576985; x=1713181785; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=cMyACkH/7gkijJXbfsrdkRAuYsDQYSZJdsM+qnK7di8=; b=FaKOiWZw7sHCxVFQwnzayexd4GVpu9M7qLPDnUIMEOh7ENXrvDKBneRHHpwNgeRMeE 7QADzb/6CnBsKNYwddMNWkTH6lCIJNdZujF2ojbOwGjsCMXitpWyRaQY2skS9f8YqgX0 b4Le7CZ2zPOHnbBYkseseetRIYlJSd67gf8DOgJlBZIAKXVlP8/ckd8vrcNfmqYqpNju VzxNq/fyA4HeHGi96UKi2+YcUbJsOgmpJhj6dTzo7WDQ19fqkpgkuMm/9W/jMu36rY6d rgO8JFxoBaqYbFRZZCjmTdYcelo1qwqpZJy+x/VlGqI/1WGEUtK9ln/AJVQGHenl99nH 7fXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712576985; x=1713181785; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cMyACkH/7gkijJXbfsrdkRAuYsDQYSZJdsM+qnK7di8=; b=Vo6zJWW7n24N7rbEB0b6N746WBqKGC9xbI2C+z4YvWaMrObgKrDEzRbV54K9JdK7Oo xZsuI8FTsXzp7AK3iIfWxCr6SYSGvKGNgy6M+wJitvQTyaNVrHu9+2ORHy1vGbO4g1iv j/BiS2VH3GSNn+v676bm5KnsUy2F5g5uaQuqXvpB+l+4Mo7/Nw7MRXPP+Nw6E5TZkPGR LnbmPJcgu2hNnrRIPBTi+mcjGvvbJb2bdW2Szkx/e8JGAlnKI2zZ0Yf2nOVnltcWa3uj G3w9HsxYYR0TGWSHmZnOeQaT4HNgDAHwxGLBf3ALyynaKGb/UqgjW9qXfE0i2URwbrae 8OXg== X-Forwarded-Encrypted: i=1; AJvYcCVAg4xsfovIA+XFkycBDuVudHYhm7LppFiNrQBr+9b63el3F4wmkmt0v2vRo5N/k6usWWkg91bxXKyY6LyIzAwY4V9MMYkZyySCZbwtCHAY1RkUQD5ezcUBU4HgK7/vZdV2nsDKAHxERI4= X-Gm-Message-State: AOJu0Yx3aLvudTndp94PN4CrgQk7lPm7JIFSvUh1DJy6c5wGnA1LXcwT PA7zmhMbnYfwixSPR+nLT1UsGR0ZNwzE+m6vR6Rd22Oe1e2UleuD X-Received: by 2002:a05:6358:5c16:b0:183:e337:8eb8 with SMTP id x22-20020a0563585c1600b00183e3378eb8mr10155239rwe.13.1712576985067; Mon, 08 Apr 2024 04:49:45 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l23-20020a635717000000b005cd835182c5sm6341216pgb.79.2024.04.08.04.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 04:49:44 -0700 (PDT) Sender: Guenter Roeck Date: Mon, 8 Apr 2024 04:49:43 -0700 From: Guenter Roeck To: Andrew Davis Cc: Jean Delvare , Juerg Haefliger , Riku Voipio , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/31] Remove use of i2c_match_id in HWMON Message-ID: References: <20240403203633.914389-1-afd@ti.com> <0e43aa83-2e02-49e2-96b8-24cac0362a7b@roeck-us.net> <77b2f8ce-0b71-4a7a-81bc-a64a1af3566d@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <77b2f8ce-0b71-4a7a-81bc-a64a1af3566d@ti.com> On Wed, Apr 03, 2024 at 05:06:43PM -0500, Andrew Davis wrote: > On 4/3/24 4:30 PM, Guenter Roeck wrote: > > On Wed, Apr 03, 2024 at 03:36:02PM -0500, Andrew Davis wrote: > > > Hello all, > > > > > > Goal here is to remove the i2c_match_id() function from all drivers. > > > Using i2c_get_match_data() can simplify code and has some other > > > benefits described in the patches. > > > > > > > The return value from i2c_match_id() is typically an integer (chip ID) > > starting with 0. Previously it has been claimed that this would be > > unacceptable for i2c_get_match_data(), and chip IDs were changed to start > > with 1. Commit ac0c26bae662 ("hwmon: (lm25066) Use i2c_get_match_data()") > > is an example. Either this series is wrong, or the previous claim that > > chip IDs (i.e., the content of .driver_data or .data) must not be 0 was > > wrong. Which one is it ? I find it very confusing that the chip type for > > some drivers now starts with 1 and for others with 0. Given that, I am not > > inclined to accept this series unless it is explained in detail why the > > chip type enum in, for example, drivers/hwmon/pmbus/lm25066.c has to start > > with one but is ok to start with 0 for all drivers affected by this > > series. Quite frankly, even if there is some kind of explanation, I am not > > sure if I am going to accept it because future driver developers won't > > know if they have to start chip types with 0 or 1. > > > > i2c_get_match_data() has no issue with returning 0 when the driver_data > for the match is also 0 (as it will be when the chip type is 0 here). > > The confusion might be that returning 0 is also considered a failure code. > This is a problem in general with returning errors in-band with data, and > that is nothing new as i2c_match_id() does the same thing. > > Actually, i2c_match_id() is worse as most of these drivers take the result > from that and immediately dereference it. Meaning if i2c_match_id() ever did > failed to find a match, they would crash before this series. Luckily i2c_match_id() > can't fail to find a match as far as I can tell, and so for the same reason > neither can i2c_get_match_data(), which means if 0 is returned it is always > because the chip ID was actually 0. > > At some point we should switch all the *_get_match_data() functions to > return an error code and put the match if found as a argument pointer. > Forcing everyone to changing the chip type to avoid 0 as done in > ac0c26bae662 is the wrong way to fix an issue like that. > That doesn't really answer my question. It does not explain why it was necessary to change the chip ID base for other drivers from 0 to 1, but not for the drivers in this series. I fail to see the difference, and I have to assume that others looking into the code will have the same problem. Guenter