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: 1958746 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=C3pOQdlM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-i2c+bounces-4832-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WJrmp70HJz1xqj for ; Wed, 10 Jul 2024 18:36:26 +1000 (AEST) 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 108171C214EB for ; Wed, 10 Jul 2024 08:36:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E792813C68A; Wed, 10 Jul 2024 08:36:04 +0000 (UTC) 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" X-Original-To: linux-i2c@vger.kernel.org Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 5BF5C12C81D for ; Wed, 10 Jul 2024 08:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600564; cv=none; b=jt1ab7wtkpxMJClCOFWz8KRA8NnEocoKCwbr46mSrew2pLovu77HzDpMC//oV9PKVuplh1Eag6X+6edwrXHsR62cjZpEwOicrOLT52H+9msh4KKMGMwNvOH/en5QbKswYn59mXF1CXAle8lYi7inQd7JbbM3ToUcCs5sCbFBgfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600564; 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=gLJwAbNoWQR/Y0IYeCsN52rBcwMNI14iD3ccOBXSmhiGhYzUexE2VmhcYTAJFGyZMs/HdIfjFtxtzLCoXojYRH+qHBc+t+rDV8l/v0H+LwUKXCYt67NEMm8zk3UODxCo99YZA2Thvf/ywcsZ+yfYqWb927EVIeu9J67N64tdlbU= 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.43 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 Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-58ef19aa6b3so3425195a12.1 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=UTfoGhy2YqeCUaRmwNacMuQ2TsOUFPMCd2dly4MjuLxVmpUyvlOpo0zDjBlUpB+wLx IFlbWn2M6VNKJ/TkqMm/DyLtTroha4GU8kHY0Ign5OXhI9qDduusmNUiKi/650lW7/zU oV+RqOE8TVeqISZty4+4bLK0MTJXiBiUbl9r1a9xp7L6Sl22faCmd5x9jvPfRxKhFxOr EFhsguhkjyHwlZdHlWp/dD5L+mQeDJ2vj3BYsiGetEZmepKBhQ0cLRJD0ON/0P2fweeH U2E8CfQNf5d89wqoUvspkySXlwEmq40kLKm8VdJkk4nM1tLrO88aBha+O2eAfbFpGm5e X0HQ== X-Gm-Message-State: AOJu0YxCIQj9jx+QXkgKHME0zYvfQjAjUD7dmLwFrVhFt3pirfd+xbOd tLFgHcyuhZG2YHMGE1fCl0L6zfK8zsWM/SoAeUMT9pk+jHB6cTmY9cOhRYnEMUeDI2XKbJB0V5Z 4 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-i2c@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: 1958747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=xcMXW36M; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-i2c+bounces-4833-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WJrmr34PQz1xqj for ; Wed, 10 Jul 2024 18:36:28 +1000 (AEST) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E0472845C6 for ; Wed, 10 Jul 2024 08:36:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B29313C908; Wed, 10 Jul 2024 08:36:06 +0000 (UTC) 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" X-Original-To: linux-i2c@vger.kernel.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 A264D13C3F2 for ; Wed, 10 Jul 2024 08:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720600565; cv=none; b=oGZIpTSS0/cNUAkGQ/37GHy4V+/txT/6XcAoY1/2DZ+ByIjSb2E9C9+Ra56cKa4rKDJTGm636ek7XwOtPAzyMEEZpKCSvv5Z2wel6OW0fZ8WznRsPVxTNfioE1GAxLrxfzms79dJzHQqwI8lKrfLY3PLc4QUE/J4ilHoteZlLfE= 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.50 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 Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a77bf336171so106423266b.1 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=dZ/bkMkhDmkIA6no3lf3zCn/DJavl768SijIGITMkNfhFUeY5p/4vKarbtCX6CZpSc hk3Ax8qmepWEJneqDkJUTmn3WV/BF4JFBA18GksjsEGBi8bjyddi8EfqS5V1eaJkxTAw R8kUti9wohs72Zwnx8UAYCt87d1aLd6N3JIbleEPBOqRjR8pHUdXklgZxUU0i/wB/XIp 5FEtnysUP4uZAKoyz3gtatTcqxIyetFlYKfztM18RFZiHda2eduFqIjX2dqWvFrf45SV y0QjzKV3+XYh76ckMsoo0Ps7h3q03H8P7VoakL3z/ji8a3o27opGCOUoivsYfKegGw1r hK5w== X-Gm-Message-State: AOJu0YzcXhDs6TIjtjXPfi1jWL+1W8d8R4hLOy47Jx9rago7lwgBuRwW 2xLwSNBKuVA4+jPpEJwiaBNXV2F/MfYjPog5R4IP25TuLNYVUMpSj948/VwfxB4= 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-i2c@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);