Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp16380lqm; Mon, 10 Jun 2024 11:11:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/Ay7TOrsfoshZnbBoyiZ1QK3i2etvA8MbB9K6/NPoxlLHP/PuRONBzoG9ndrI7MM9or46aOq4jUnU2JHttS0Ciat52HWtELuff0wuAA== X-Google-Smtp-Source: AGHT+IFvvNnn/+LKZFDAS6IMuD2ZCgpFlx5+Age8HkFuNTxA1g62qShrcoTkGxaK1yH1JNG+zent X-Received: by 2002:a05:6808:2e9b:b0:3d2:29d6:fe8e with SMTP id 5614622812f47-3d229d700f0mr4895805b6e.8.1718043072286; Mon, 10 Jun 2024 11:11:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718043072; cv=pass; d=google.com; s=arc-20160816; b=zlkaFppFOEJiqQ3VuEIaj/hzSsb00euqxXxfdBHnWoJOX6mCHmTIl+BN2JJdNtFl5A MNU0uryDAHKLQvtYPUOpwjCXOQNcb0b7YVmk4cPQvHJ+n9Wd7PiuydEzm9rj/vEdmA5D St8Zj9znHZsFaC8LNHj0xmT+4coGvSm2b8FEKtxGpx2hSrQYyA1FB8WvHBHvverbfK6T kdx5Vhk9zbqFZbDUDODwAciwMlIDSiaH9jQUYXEkzOgWi5uSBx43/urrwCC6864+NI96 oH7ovRcV8L/JUukTjpeKUhraaZT28mwuYGKtPYTpIEuQHoV0evyMd5iROGeFDkr4VcMO 5vTg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:sender:dkim-signature; bh=YeKd4x9T4zcAkJm59oT5TgzREq4OVAwAGCECxqy0L7k=; fh=ibCiQk+gU2WgJFqJ5bbTgrAKEzZPuNRIWVbpA9npyUA=; b=taghm806GltvLSZ0Dw13bIZBwvBPssrf+TE0zUHoIyERGfJWuD1Iraigippq4F50js WjP7NY/LFPTf/1ciIQ3enuI5BGqLod3adSpbLaEcnk6xRmlBc1TE2yykBgGEcJFfQCOj iUGmhZPdVyX7mBcgdDj3poqZUMep4H8atUmrDyndhs1IHiRyT33TRCEnfK0hvjIKb4IJ s3EHw393OWjWQU1otEqhzZqf0VlKykaTGm0USV5L1/ERutrN6JqNo3pLmhzFfuewN5Gy dZM5Q6vZYxWsyG498fm+5RpCzWWePwKMAC+navcvh2HbQ8uBXuxNAMkTqupgOxHrD979 j6YQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BUtY+BeO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-208712-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208712-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-48c41d42c4bsi1046835137.168.2024.06.10.11.11.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 11:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208712-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BUtY+BeO; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-208712-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208712-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E7B811C223D4 for ; Mon, 10 Jun 2024 18:11:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9841B14B963; Mon, 10 Jun 2024 18:10:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BUtY+BeO" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 5E566757E3; Mon, 10 Jun 2024 18:10:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718043052; cv=none; b=OhLxgpQ35wUM9vi5EfgrlCuSjpkupSPPVO3+RJp8CcQ+Lvf7q3PEOeZ7112jVduaDnvrruJXi+ACNg2XX6mKnh/v2/8P62dGayZMEhxr3JZbzGEQgVPvfLCsBBYseX53cA8bWzzxt3qYabi8HO+1EL9jo6ql4eNpicHNmV4Za8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718043052; c=relaxed/simple; bh=0eeEmyGuqeL83TJD2e5vEhbVdH476h+TQmS/Nc07uOY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=lyLR5QbF4Bb7gsB4EnK6jadLDkNpj0Kjch3bP4LIM6zaxUi7/M4uO+R36rlRC8F6H0JGWCqru0qXcj+08jiyh4Mb/SRty2lbjlb1K3Dwr129go3c5yDAv+Afalk38CHgH+0g8/PxTzHPx/17WqqCNwqpnkPx+aIS57NJE4h4Gz8= 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=BUtY+BeO; arc=none smtp.client-ip=209.85.214.172 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-pl1-f172.google.com with SMTP id d9443c01a7336-1f6f38b1ab0so1139135ad.1; Mon, 10 Jun 2024 11:10:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718043050; x=1718647850; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=YeKd4x9T4zcAkJm59oT5TgzREq4OVAwAGCECxqy0L7k=; b=BUtY+BeO4lzwfa/i/S5DNaRGJnxF2aNjiWNYw2cWc/d8nlaaT5Fq2hB2G1P19Lihnn AkfqQLvM2fsEjp1YSVjj+v6E7Ponu6m7mdnGW+2oY1h4EY/46esCZpRb1G4Ajgq6AJ99 Ghz2yQyEifpVk+aRg3JdM4MS7BtQXihHb+m/pB/ghZS5Y/ykrRDX703VlzVkEwgHK1gy DiAqodvx8ad9e4PgTQYRVu8YR+zzbizbdbHYVeYClAx3ifuc9f9LB5Sx21W54q1GsRp3 hH61cxyLhAjFdDLvHmRbSOZGEY6pTz6qxhv49JskN4b08HdRA+235y552mMbrA/GHTcy YQgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718043050; x=1718647850; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YeKd4x9T4zcAkJm59oT5TgzREq4OVAwAGCECxqy0L7k=; b=BH4Mfdwbq4//SUneyNlIMSy3xHzvvFdvWzJXv5Yszj69HkWbiFbygMzCoON6pLq2pB 3afj2twApvOYy79N4Lu9itFAONnECDbxMjvS69VIU74mhjLF8cVX3UFCjHgipjh/3/V3 QyXe99fBGm0sjhBKzb06QYORnIWEf31fXCFtpgUEQjAkJOhtQhOiAUCZfheZntSVMEC8 o5JdN1rubazxeZOvPdO0BUvw1NjbBhB/k4VI441A8Yn0U2gOtX4mIXQpHzphFjdpB80n FK0UHLWOLDhqBiGMlZK6fyGxbfoafvzxgVvRg9XY9bC7l2J+BG2CD8AQVCgJzc0rWDu2 JuTg== X-Forwarded-Encrypted: i=1; AJvYcCVtJFbWg24BM5SV+8BPli7WzK/K4JQcxe11ihsvsybgy5DEYmU7coAM152GbNvtyU9cyeE6YyFYpvB8JagHJAuRge+ADDzy+QI3fulJ X-Gm-Message-State: AOJu0YwtDPmTn+xYJSWVANHvGTWtoxn3GVtWyEVTVs9PBBlhNVmhgFDE q0YuLZoY3BV6NnNenv01sJH+K51oMERxVif1CLZsUqC63eHujCfZIYeCsw== X-Received: by 2002:a17:903:41cd:b0:1f7:2479:a52b with SMTP id d9443c01a7336-1f72479abfcmr13253745ad.65.1718043050147; Mon, 10 Jun 2024 11:10:50 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6bd7695ddsm85604285ad.63.2024.06.10.11.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 11:10:49 -0700 (PDT) Sender: Guenter Roeck From: Guenter Roeck To: linux-hwmon@vger.kernel.org Cc: Rob Herring , linux-kernel@vger.kernel.org, Peter Yin , Potin Lai , Daniel Matyas , Andrew Davis , Krzysztof Kozlowski , Guenter Roeck Subject: [PATCH 0/4] hwmon: Update handling of chip-id enums Date: Mon, 10 Jun 2024 11:10:42 -0700 Message-Id: <20240610181046.1991436-1-linux@roeck-us.net> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit With the transition to use device_get_match_data() or i2c_get_match_data() instead of i2c_match_id() and of_match_device(), the assumption was made that the data pointer in struct i2c_device_id and struct of_device_id must not be NULL (0). Initial patches changed enums used in those data pointers to start with 1. However, it turns out that this is only necessary if device_get_match_data() is used. i2c_get_match_data() calls device_get_match_data() and uses i2c_match_id() as fallback if device_get_match_data() returns NULL. Therefore, it is perfectly valid to keep using 0 as starting enum value as long as struct i2c_device_id is complete and matches the data in struct of_device_id. It is confusing to have some drivers start enums with 0 and others starting them with 1, even more so if that is done inconsistently and/or if enums starting with 1 are used to index arrays. Let enums start with index 0 where possible, and otherwise explain why the index has to start with 1. ---------------------------------------------------------------- Guenter Roeck (4): hwmon: (pmbus/lm25066) Let enum chips start with index 0 hwmon: (nct6775) Let enum kinds start with index 0 hwmon: (pmbus/mp2856) Let enum chips start with index 0 hwmon: (pmbus/max31827) Explain why enum chips must not start with 0 drivers/hwmon/max31827.c | 5 +++++ drivers/hwmon/nct6775.h | 2 +- drivers/hwmon/pmbus/lm25066.c | 2 +- drivers/hwmon/pmbus/mp2856.c | 8 ++++---- 4 files changed, 11 insertions(+), 6 deletions(-)