From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796020221; b=C7pKVr7IqLs9+NbtVcdksJuCFF0ovsyUU0Xy3MZL57kPh2lM8+Y7wtcugTAzacTKwc9X P1bShizl6U9M1hH7TqYPjko5q1wpCSi8Y+w0bTbYKEtmvPxZrjJ5daFwwWPYVNQDG+uV7 xwCXjBkgb9ggzzml4uIE3uNHIqTUc0d4keqliBtlqG/ME8pSuSPepSqlh+p5zqCd21XH+ xvlSz1BYCi4bEvwAs69XzO32EdXu+Mf4pZgWzwEPeetAI83uKF/A6tqKw5AvCeur/Cm+/ Xw2EQXNLUozc3/aIWunrpHHRjDyjBxNzdwKnRoTqa4SOeOkxYzSzTfc3Px8kE4Xv9fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796020221; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=mbRCQ4hTY+Kjiy4fRUKanEk/yMd17FKToOUXq2lP1kU=; b=rPb805yR1NBmdubWOcB7+qDGI5MmKMz3666Oy1/hCnG8No7CHHJcMRqkBdWHbh5qb7gY uzdQU7o70cFnk6zJyMcnguRFhcpHnTjyVqzvDrYXr7TtSbBEkIcDB9msO3jzyx69/wHy7 srjD7pWXqmx8EscIjbP19XUS7Q6vo2aGhT8ytKWPU4iYVjZAKUUxATFbLpwIO0TXoKyl4 TrFICWWz21zg6vKQGnOYVwy01AbMltpmnQIpWPIw0hXmgybaQOpPLww8WMyfMX9MQ0pw9 r1UtTYpq97UxG51sp5BslfeK75aH7JSU1BrpYQCho/wB1vdCWMD9akFZdmiEQZOAGhQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WNpubllM; arc=none smtp.remote-ip=209.85.210.178 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47D18606A337 for ; Mon, 30 Nov 2026 06:30:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47D18606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=WNpubllM Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-8a4c72951b8so6423700b3a.3 for ; Sun, 29 Nov 2026 22:30:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796020217; x=1796625017; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=mbRCQ4hTY+Kjiy4fRUKanEk/yMd17FKToOUXq2lP1kU=; b=WNpubllMeVc/lPZYm2/mjXdPRDSCJjRbI8Is7vxYrj3ZtObT6sLtOUAA74cxWbBeN1 XUxAQvhLweABaXBhEV0vpNXL06u4AcX0MyBZDdKPef3UH32kBMK+BA+PLOCoJCyAIZSp 1ibCpHcM2RRBKpoJ9Yx+u5lPZnPhmAQBNvEHbRp9U+T5MKLZ1X5GE+2eYduIp2iaIFlL UcJsfuack0itPmeCE0AvUvVVvJTRcWAygBjUmgrsRYpKO+EogXtisdjjepOKU06A7MCD LMLAojzdZipZafIv0wyZpSm2n9FEIW1GPPSRmTUyapeNid/TC9joeyELVT5bd5sizpix BezA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796020217; x=1796625017; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mbRCQ4hTY+Kjiy4fRUKanEk/yMd17FKToOUXq2lP1kU=; b=qV3JQqLu0RZqQO9wZvW/V1MXUdyT65R1gHdy8xessX8BoRCrYEDg8cwv8K2n3MC5C7 gW0Z/TYtemVHlEU18IvFnB5fujwhGaf/NrQp6HKaYK6V+utQpWpuHnjB0WDvkyjCZn39 YwPgKZ4uIXpk3hzhN4ynTIgY/DgU3mZgMYPefjdbEE0/OCgGafv+oZ6mHrurDuEt2Tg2 hO1QHSguYtDXB1BwS0P3avwHVRJiPWfZ8kiF9p558VL1/cBOWCjRdXsEV5CYex/q+LgH V5HsowTmB7zDJ3tNBUgpZgDo17QQvpil/hzKFNrR895vg6iE5sQrh7Gp/d3pgawQFT5D +10A== X-Forwarded-Encrypted: i=1; AL+hErGNPwDa7sVCr8sVc/564cb1QQmb7ezbyyVvFDNiGKLHl5FgfXENbRYtjwnaEMTcp8x6f5dx80PooKZnK5s=@vger.kernel.org X-Gm-Message-State: APuU4Z+7Y4BtN4fjgJtpwLtp/JoLXkvq3M5cEq0SsweQvK8CGy2gGZUT /zoZC6CJ394hmX7w6NOYSZ/IvGA2B/69zX+ZXYUiufEOEbl0wrWc4Qg/fjlSZ9N9 X-Gm-Gg: AZFdTZcOKeWUYjXiJ3AuiT1tMUBziop1fEFAnn/fxqr4SXuuyLclsfmcGTz8SyN8+j9 MUVTRkRmwtuNWCEevUMcmaGWjTlNUzcEQaQiUo533GGuGwbjQMXEtx+x8rAR2lNhaWhVYtFeT4z QEq2uO5Zc+xtC+ZvrTGQh/ueymQ5jLxQ3+SdY3th25cuLiuJsTeKYPEq6dBn3btcfL1HCLo/pgJ 18/LXCLiXngML3+Zh/ZIQn1+pmbAiEtRQBCoDD+GB9sH2O16HrMXG+cDTvEAjK08m+rnSlEC68e Nt6FgwafV0oVacus/q17rbrjKiXu9FCntWg4R3W+QhEfH1TDVa6z3TMAooO5Kkz4yPUQoOrwH/A aQBVIc3wGVgYo3f8MfX9QE5+R6B0cgPz5/gjtDU2M8mnCmYArhVTGseEjEHJ43e7so3kMSQJYkp x70kIOKwAHLKi0fbnWxFxks74LT1OmU/pbf7mGfJslifXm5iECaVLyVH6ZkBgdA6Ll3b11a62gC 9wShD/nxfp8wgoczhLR5Y7ScbYujv93qdc3Paof/acYzi8yBWscmML5/9vQ3dsd4HPXjqsus7t3 mIe9tN9LYg6FusITLUPMyXog8NVsxxntVyZykCMobBcVncbZraLalrasdg8sw2QxT5qAAwlRWqP wUikhFWo= X-Received: by 2002:aa7:9312:0:b0:8b1:e8dc:c8a1 with SMTP id d2e1a72fcca58-8c87bcbd110mr33982459b3a.22.1796020216326; Sun, 29 Nov 2026 22:30:16 -0800 (PST) Received: from DESKTOP-TPPBPA1 (36-226-254-86.dynamic-ip.hinet.net. [36.226.254.86]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c8707792e8sm17490365b3a.7.2026.11.29.22.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 22:30:15 -0800 (PST) From: Lin Tzu Yang To: Linus Walleij , Andrea della Porta Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: rp1: Return -EINVAL for pin settings that are not enabled Date: Mon, 30 Nov 2026 14:30:13 +0800 Message-ID: <20261130063013.830741-1-rongh7426@gmail.com> X-Mailer: git-send-email 2.51.1.windows.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit struct pinconf_ops says that pin_config_get() should return -EINVAL for a setting that is supported but not enabled. rp1_pinconf_get() returns 0 with an argument of 0 instead, so callers can't tell an enabled setting from a disabled one. This shows up in debugfs, where the generic pinconf dump lists every bias setting for every pin. With a pull-up set on GPIO17 of a Raspberry Pi 5, pinconf-pins shows: pin 17 (gpio17): input bias disabled, input bias pull down (0 ohms), input bias pull up (1 ohms), output drive strength (4 mA), input enabled, input schmitt enabled, output enabled, slew rate (0x0) Return -EINVAL when a boolean setting is not enabled. The slew rate is reported as a value, and 0 (slow) is a valid one, so leave it as is. Tested on a Raspberry Pi 5 with the Raspberry Pi OS 6.18.39 kernel, whose rp1_pinconf_get() has the same structure, by setting each bias on GPIO17 through gpiolib and reading pinconf-pins: - before: all 54 pins list all three bias settings, and all list both input and output enabled - after: GPIO17 lists only the bias that was set, no pin lists more than one bias, and the 26 pins that list both input and output enabled really have both enabled The mainline change is build tested. The bug was found and the patch written with the help of an AI coding assistant (Claude). I tested it on hardware and reviewed the change. Fixes: e3ce7b897388 ("pinctrl: rp1: Implement RaspberryPi RP1 pinmux/pinconf support") Signed-off-by: Lin Tzu Yang --- drivers/pinctrl/pinctrl-rp1.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rp1.c b/drivers/pinctrl/pinctrl-rp1.c index dd0e85c2ca..7fabd61de5 100644 --- a/drivers/pinctrl/pinctrl-rp1.c +++ b/drivers/pinctrl/pinctrl-rp1.c @@ -1545,6 +1545,13 @@ static int rp1_pinconf_get(struct pinctrl_dev *pctldev, unsigned int offset, return -ENOTSUPP; } + /* + * A boolean setting that is supported but not enabled must return + * -EINVAL. The slew rate is a value, and 0 (slow) is valid. + */ + if (!arg && param != PIN_CONFIG_SLEW_RATE) + return -EINVAL; + *config = pinconf_to_config_packed(param, arg); return 0; -- 2.47.3