From patchwork Wed Jul 10 08:35:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13729013 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 6251D13BACC for ; Wed, 10 Jul 2024 08:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600565; cv=none; b=KPvNbByROVUV4iAkZr9GCiXrWsG0vYT4F0s7WBpFLpMt2RfwrhQqdwCeeI5IILlKpyCjltk1kgv8ITBYpznzEqfYGx+xBWsWVBmW9k9gXg7MdVu5xLEpZgaq1YkyGNb9MDKMo93oErx4Gt7prpbg5RqTztxk9Zohk6XkFXQ2t24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600565; c=relaxed/simple; bh=qTQ3UWIZkYcA9uMA+grXZJkdzTrMK9+HUUH/Sy4ciJ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YjqvQudbQWOWy4RqAILuIgilaJviP9xJF8L7S4upcKcqUU3Ff4/6s9NJ/InsYKZZgyqI3T5A5i0Ga3A3pPYfmeaOL3dovtENAaQ8wTr2qqmpLDgvHuRHtwmqey4lGussd22tQiASuUly1p3kbQoUcgiDfkBdxbyovHrBtpnZK/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=C3pOQdlM; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="C3pOQdlM" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-57ccd1111b0so4166184a12.3 for ; Wed, 10 Jul 2024 01:36:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1720600561; x=1721205361; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u+LuniVT5zVpACFSlfXMmMucxSXmhbUp2skok1yx31w=; b=C3pOQdlMolJl/U0/DnXQ4w20n6I/7jWaWej5m4XszHxx9oPRky3MvyCTFlEMQwLMaE 85lEBX5hRsJzdxAzeRSmUkz+Ob71/pYbxJ1B0IJJBFKvKrXUamGNA2URYUDvcKVdd5ww vqupoYb7WMvjCf44259UFEmTM3htuE/ga1JOmVXL200/notmQHCxD4dG0TSy4IDJ/ivF q2Qsrkgi5l9l6nUGgYPE4TTE4fExRaptrYsS4ox0L7asnSnE8HGMNRrQGpbqcQVbHvyW VlMsthKh24PUFxO6Ze2og1YoijEXOHXwaffBYMsXG2UsvUUZ45py3mLXoUzcyMQP7d1o Q+6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720600561; x=1721205361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u+LuniVT5zVpACFSlfXMmMucxSXmhbUp2skok1yx31w=; b=UTEuS0rG6onveVXUDYpXvMHuuPwSrWDTWjxuxzYNoYU76rgVy26uQdPXbRmkfKDArP cUxv1dgkKmr8Zgr8h/bhi/9BFDA4umcEL9NhVlbAOvqVKv7XICA0jItHtonhyDCogDyu KrH3hq45XKez0Y3ahtpCSd+u3+muCF8pFszeGlr4GDTIMPnM1FhF8xIe33AhJ7I6TkhO sFmPRuC3UOuJSRX0xVw/rWgQ0Tzn/uALEoT5enuApFLM32pZ1BnAYavkjCF1yRBBaNOA 27Jk65COJ2i5IFhSmex9GH7ZnFTKcC9HH4IdBsoqqi9PBceLY13X/9Wdormk2/bUq63f 1k+Q== X-Forwarded-Encrypted: i=1; AJvYcCVspJRkdGPBLV4V8Yv9Gte+udF5jOTSGPhETUJXmFDfJXkyGi3Un6485SU03kLH6IjK7SVu2NkWlsRlDpoQdbDVM3NMZShTQFeb1gU= X-Gm-Message-State: AOJu0Yz6jgUygvOO7CSIXNseVFndRotG5X8wd7QZaZfhera4kg9vBm9c CdbO5Ix1i3UeMU/26RTLZOcjE4DPPcoOlspAG11FUg70ZD2TAtlOqDVNKFaE4+s= X-Google-Smtp-Source: AGHT+IG1/g6VKJsqOdFLGbUabCQ4yZ7xC9SaPhJNdEZyyY2wp1Ue1izNQNKphBJMtdMgoZIJdz00KQ== X-Received: by 2002:aa7:ce1a:0:b0:57c:5f77:1136 with SMTP id 4fb4d7f45d1cf-594bb7745f7mr3895404a12.24.1720600560707; Wed, 10 Jul 2024 01:36:00 -0700 (PDT) Received: from localhost (p50915eb1.dip0.t-ipconnect.de. [80.145.94.177]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bd459ddasm1952203a12.64.2024.07.10.01.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 01:36:00 -0700 (PDT) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Delphine CC Chiu , Jean Delvare , Guenter Roeck Cc: linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH 1/2] hwmon: (pmbus/ltc4286) Improve device matching Date: Wed, 10 Jul 2024 10:35:44 +0200 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1462; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=qTQ3UWIZkYcA9uMA+grXZJkdzTrMK9+HUUH/Sy4ciJ8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmjkfi+nnx52u5YMCmVnj130/0fj61p6tB5bVeE HVTmgcRfJ+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZo5H4gAKCRCPgPtYfRL+ TthUB/4xxPXTVmB5CkcLl7vWDDtpthBfp7tYx49xfv8vt3aH8AhPHqP6+P7rbsDhpetpWnoc0nE ECcEjoW4BRJ2H8L5RWTDbXB/s5SxHTzSVivh+MhJ5cfykyQVOus1+LG9Rjk0lNH63LNcWxTrdWi Adl4SE/hPBlmI4hkMqfi2smy8CSsfp6GTp+cQNshPOP2t5hmgucjEiLuCHK6TJeeTuEHD+M7SaI hHrD6vdp7ZX6fwlsvQbYy0TcRH/IvpAZQlhwwWD262k4ERcqsKfoadexeAXPpb2a76PdVcn7nBV uqzGIcem3jkbhhY7Yg2nL2JgscQ+ASph4TfgO2G/iTGsXpEL X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 The devices supported by this driver report the model name in their register space. The way this is evaluated allows longer strings than the driver's model list. Document this behaviour in a code comment to lessen the surprise for the next reader. Additionally emit the reported model name in case of a mismatch. Signed-off-by: Uwe Kleine-König --- drivers/hwmon/pmbus/ltc4286.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/pmbus/ltc4286.c b/drivers/hwmon/pmbus/ltc4286.c index 9e7ceeb7e789..2e5532300eff 100644 --- a/drivers/hwmon/pmbus/ltc4286.c +++ b/drivers/hwmon/pmbus/ltc4286.c @@ -95,13 +95,19 @@ static int ltc4286_probe(struct i2c_client *client) "Failed to read manufacturer model\n"); } - for (mid = ltc4286_id; mid->name[0]; mid++) { + for (mid = ltc4286_id; mid->name[0]; mid++) + /* + * Note that by limiting the comparison to strlen(mid->name) + * chars, the device reporting "lTc4286chocolade" is accepted, + * too. + */ if (!strncasecmp(mid->name, block_buffer, strlen(mid->name))) break; - } + if (!mid->name[0]) return dev_err_probe(&client->dev, -ENODEV, - "Unsupported device\n"); + "Unsupported device (reported: \"%*pE\")\n", + ret, block_buffer); if (of_property_read_u32(client->dev.of_node, "shunt-resistor-micro-ohms", &rsense)) From patchwork Wed Jul 10 08:35:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13729012 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 A47CF13C679 for ; Wed, 10 Jul 2024 08:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600565; cv=none; b=SlizsmCDgfshvnTjn1Wjk/BTB5tuyKlg4eBOJy0x+yqdiUlL2o8cNpUULIYMJyG3h6mmXSEBsW0x85eUX/dwkNDdmWOa5TW8D7juB+9FO89TRAl4Je2+r/GA2elv/b9tlryzJy6CPpeiY+/gfUsk+eLtrppEjoPEjYdxfxCWHxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600565; c=relaxed/simple; bh=ZzznhNzrTYFcBYnQOf8W5bFtcIQqhHtFbQxNQUsNaCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YN54/53xye5wEKmN5XMeionJPCjGWAsHbmlZJHjIZwXF35jT+iZXeeLEN264Tef8DAFLOmfu6r+wqaFU9GFlxn9SoDSv7+7nYM8GAz8haafptZnHOecr3mwuAjKnJmhhwo10cZ/UztHsdKyBJ9yLrKmA0NobDV8xnmez/bZ/EjA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=xcMXW36M; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="xcMXW36M" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a77d85f7fa3so86203966b.0 for ; Wed, 10 Jul 2024 01:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1720600562; x=1721205362; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qtiZJz2W0rGE08L3FMzbwurxCmSUlaZ4kv0pzdE/HcM=; b=xcMXW36MRJJFPD5oYZhphsTMPvx00mV4noULY4oCYYOEiFVmOwfseFh/YXhoJX2qvw HUT6VFQytiyV0h0f9THyEI4lr4WQZO/tJqx5v2eEmmKCRHTnmVQky4sMTIMcpoU7klif CPF7NfxyLI5BWLqaTaYc3iOjjcaTT1vmIDgIgfan3CYd9P9wM0IrXe7orssus+JfHnm6 j/aRWw/JyMnOJIuG0zE4jvbE29/7XjgliMp/4YwEDdB1R0oxVuiFIzfryiU0Ozyt2kPB 80i8tGcuPOGS/AnC5jB5UFVFRduvwKpFD10NwaYIFr7dZRNt+yCs0ZiPVoED3po0H9xn cw/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720600562; x=1721205362; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qtiZJz2W0rGE08L3FMzbwurxCmSUlaZ4kv0pzdE/HcM=; b=YOZaWlURftgFR/KuzchuC1dqLFOfbvJ+ytmGziFO5M2KCGdGOHkjCFgxaR0U50ZPrk LmKtDfFEGx6Ui1gpBklHRJwGeFeJ7JtuQ5YbGOtFGzwBnu9qMyJhe+hrmvD6rMF53Dmq BhIpc3IiGZo0ECCLaYLn7L7fYC+ZAs4MYVeMo3tMB8goFQtBT9W6UKWC/5YChru2YiBi /RdJOY+3ZmKhORA/OABAly0D0213NX1Wu9CnmpoNncE2elhTSVBMD8vYpy6LZkHpkOlt VxnJOB9or9hZIdxkByC+jUplZD7AOLSPp9rWMCCNyK7ZG7DjAZaZHde7Kdk3xOLxavRW 7d9Q== X-Forwarded-Encrypted: i=1; AJvYcCXnj0XUIrbKjoCfpgGsJtz1CbfXYa7KeBUGJnePGTfMktJPdW++5+ockl/4zDGH24FxDTTCeWh90jQZ6sXqTf0Rhswik4DHHNsKQeg= X-Gm-Message-State: AOJu0Ywn1wG9mLNJ6OTO3mFeUlDx0hUJxiBM8GNLoFkaIU8XJYjaqFhh W9fm39l1AQjUUGgU1MvD5HYHlgvvFkv1qBZh31MgKKvoAWxosh8TyWbNdqnvS78= X-Google-Smtp-Source: AGHT+IHmg0OgyKBW6vIDhYtSio0IQUsZ8nZs+BYpy92cQRqb+msUxjYJNfY8L5F79CmeK1zyuxUyGA== X-Received: by 2002:a17:907:3f22:b0:a6f:20e0:1d1a with SMTP id a640c23a62f3a-a780d30a933mr432314166b.33.1720600561993; Wed, 10 Jul 2024 01:36:01 -0700 (PDT) Received: from localhost (p50915eb1.dip0.t-ipconnect.de. [80.145.94.177]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a780a8541f7sm140222566b.154.2024.07.10.01.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 01:36:01 -0700 (PDT) From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Delphine CC Chiu , Jean Delvare , Guenter Roeck Cc: linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org Subject: [PATCH 2/2] hwmon: (pmbus/ltc4286) Drop unused i2c device ids Date: Wed, 10 Jul 2024 10:35:45 +0200 Message-ID: <9a48ba0368e0c8cddc94c5e4cf3edd7eadc03a2d.1720600141.git.u.kleine-koenig@baylibre.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-hwmon@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=733; i=u.kleine-koenig@baylibre.com; h=from:subject:message-id; bh=ZzznhNzrTYFcBYnQOf8W5bFtcIQqhHtFbQxNQUsNaCU=; b=owGbwMvMwMXY3/A7olbonx/jabUkhrQ+9yemfswZ/OunnNrmpd6xROFPhFRWc8aS+TGhH/4mf HZg1lnVyWjMwsDIxSArpshi37gm06pKLrJz7b/LMINYmUCmMHBxCsBE2A3Z/ztN9GZnOywSclD8 Y4RE1gtrC38FMYezRSaBXMyiDIfO2oY/2JAr6zZDW1HUQWy22i3bk2+tJ339fVbz4NzzR1KFpyi a/isw2GETFcK1lVeIUWG1avPqDYe3vdAr6rV0XRTVMtfVbZvDzZsmeSY+UyU7bvI/TOKx+PKUq7 M2a4XsQ555S5WK18Xvb9hh9jmOv9z74I1dj1PYBbLvK/6M+SCg811y3w02c+HVrhrdtR31ffwRH T9n3I/K2/ukUsbR9sObLwxfIipstj0JsfykL7xLdV4if/2SULboF4LrTyl1Gp9y3H9T5Nkxv3KW xcUOVw6XljPwchVphj9W3b/1ntj1Q2nBdVL8sz9rFNsBAA== X-Developer-Key: i=u.kleine-koenig@baylibre.com; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 The driver doesn't make use of the different numbers assigned to the different devices. So drop them. Signed-off-by: Uwe Kleine-König --- drivers/hwmon/pmbus/ltc4286.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/pmbus/ltc4286.c b/drivers/hwmon/pmbus/ltc4286.c index 2e5532300eff..28aa211700fe 100644 --- a/drivers/hwmon/pmbus/ltc4286.c +++ b/drivers/hwmon/pmbus/ltc4286.c @@ -58,8 +58,8 @@ static struct pmbus_driver_info ltc4286_info = { }; static const struct i2c_device_id ltc4286_id[] = { - { "ltc4286", 0 }, - { "ltc4287", 1 }, + { "ltc4286", }, + { "ltc4287", }, {} }; MODULE_DEVICE_TABLE(i2c, ltc4286_id);