From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E0E02BCF46 for ; Sat, 4 Apr 2026 12:14:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775304861; cv=none; b=iWhjdFvUToTEnZZ3JbdvVa/yycFZqcVjG7sz2AuBogC6eK10tLXTa1j/V/lYkd7+ZqTXoOwg5JiLewhYhdeRLlU2Amep7H+SHlCp3t5aSOkbUe6FjDR2dhmmxkE6o4HLDh0ecJ/MifkgtUtDRVaBQyY0W9bEdEoe93myrb5FxTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775304861; c=relaxed/simple; bh=B+FFJlG9I0es6ItMp/T4cf2Il3Yl939RKeCZg93gvZ8=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc; b=TxOTi3temMwYy3zfs32zcrWiLgr5I8IMiHul5xEJ04iQdmhHVLQiM3xzPyuy9oPOHwhH1gCJOmR+QmCVPOSBsXY86nYbr6z/So5UFs4r6fD94iaq4VwcQ9MpsPWuiJXCmKfC3UIsmuRe45EFPJ5hbcvrxxyj8J5AYRbJ1LvALtc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=KtXdlhLY; arc=none smtp.client-ip=95.215.58.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="KtXdlhLY" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1775304856; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Tq3CAU+GJ7ey73YVLTN7mJUUKEcBxwO36rlxkF7sSk8=; b=KtXdlhLYthwHmNsJP/oOAlhHbixQNQJvqpZS2NBZtzgazluOgti1VjttD2E1n4lDlIlnQo cX61mJTU+t3Mzxnycw79YRP7PjXWiPF2pKTM6ZfMR+hugscOhm6HPdaAmzgvgnuQ9nb53n JXX3W4LT07EE6hbYcKnJhpVhCwMBBNg= Date: Sat, 04 Apr 2026 12:14:14 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Frank Wunderlich" Message-ID: TLS-Required: No Subject: "gpiolib: remove redundant callback check" causes regression when gpio_chip.get_direction callback is not implemented To: "Bartosz Golaszewski" Cc: "Daniel Golle" , linux-kernel@vger.kernel.org, "Linus Walleij" X-Migadu-Flow: FLOW_OUT Hi i stumbled over your commit 471e998c0e31 "gpiolib: remove redundant callb= ack check" in=20 kernel=207.0 (6.19-rc6+ should be affected) because i get some traces on = my mt7988 board when calling "cat /sys/kernel/debug/gpio": [ 33.903162] gpio-chip: pinctrl_moore base: 200 offset: 0 [ 33.908489] ------------[ cut here ]------------ [ 33.913095] WARNING: drivers/gpio/gpiolib.c:424 at gpiochip_get_direct= ion+0x60/0x78, CPU#0: cat/3421 [ 33.922216] Modules linked in: [ 33.925262] CPU: 0 UID: 0 PID: 3421 Comm: cat Tainted: G W = 7.0.0-rc6-bpi-r4-rc6 #9 PREEMPTLAZY=20 [=20 33.935423] Tainted: [W]=3DWARN [ 33.938380] Hardware name: Bananapi BPI-R4 Pro 8X (DT) [ 33.943506] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYP= E=3D--) [ 33.950454] pc : gpiochip_get_direction+0x60/0x78 [ 33.955148] lr : gpiochip_get_direction+0x30/0x78 [ 33.959841] sp : ffffffc088463ae0 [ 33.963145] x29: ffffffc088463ae0 x28: ffffff80c02e1c17 x27: ffffff80c= 01073f0 [ 33.970271] x26: ffffffc08123e448 x25: ffffff80c02e1c18 x24: ffffff80c= 01682a0 [ 33.977397] x23: 0000000000000000 x22: ffffff80c02e1c18 x21: ffffff80c= 02e1800 [ 33.984523] x20: 0000000000000015 x19: ffffff80c01682a0 x18: 00000000f= fffffff [ 33.991649] x17: 0000000000000000 x16: 0000000000000000 x15: 000000000= 0000006 [ 33.998774] x14: 00000000ffffffea x13: ffffffc088463858 x12: ffffffc08= 1979ce8 [ 34.005901] x11: 0000000000000001 x10: 0000000000000001 x9 : 000000000= 0017fe8 [ 34.013027] x8 : ffffffc081921c70 x7 : c0000000ffffefff x6 : 000000000= 0057fa8 [ 34.020154] x5 : ffffff80ff746688 x4 : 0000000000000000 x3 : 000000000= 0000000 [ 34.027280] x2 : 0000000000000000 x1 : ffffff80c908c880 x0 : 000000000= 000002c [ 34.034405] Call trace: [ 34.036841] gpiochip_get_direction+0x60/0x78 (P) [ 34.041536] gpiod_get_direction+0x90/0x188 [ 34.045710] gpiolib_seq_show+0x2b4/0x414 [ 34.049710] seq_read_iter+0xe0/0x498 [ 34.053362] seq_read+0xe8/0x128 [ 34.056580] full_proxy_read+0x6c/0xa8 [ 34.060320] vfs_read+0xa4/0x300 [ 34.063539] ksys_read+0x6c/0x104 [ 34.066846] __arm64_sys_read+0x1c/0x28 [ 34.070673] invoke_syscall+0x48/0x10c [ 34.074413] el0_svc_common.constprop.0+0x40/0xe0 [ 34.079106] do_el0_svc+0x1c/0x28 [ 34.082411] el0_svc+0x34/0x108 [ 34.085545] el0t_64_sync_handler+0xa0/0xe4 [ 34.089720] el0t_64_sync+0x19c/0x1a0 [ 34.093373] ---[ end trace 0000000000000000 ]--- with e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_= direction()") you introduced a new helper which calls WARN_ON if the callback is not defined, and with removing the= pre-check this WARN is now printed on every gpio-controller which does not implement the gpio_chip.get_directio= n callback. as you see in my debug (first line) it affects pinctrl_moore driver which= contructs the gpiochip callbacks here: https://elixir.bootlin.com/linux/v7.0-rc6/source/drivers/pinctrl/mediatek= /pinctrl-moore.c#L562 please let me know if this is now invalid and need to be fixed in drive, = but imho the WARN_ON here is wrong (optional callback) beause direction of pins is correctly printed like this after t= he traces: gpiochip0: 84 GPIOs, parent: platform/1001f000.pinctrl, pinctrl_moore: gpio-0 ( |tx-disable ) in lo=20 =20gpio-1 ( |mod-def0 ) in hi IRQ ACTIVE= LOW gpio-2 ( |los ) in hi IRQ=20 =20gpio-12 ( |cd ) in lo IRQ ACTIVE= LOW gpio-13 ( |reset ) in hi IRQ ACTIVE L= OW gpio-14 ( |WPS ) in hi IRQ ACTIVE L= OW gpio-21 ( |tx-disable ) out hi=20 =20gpio-63 ( |pcie-3-hog ) out hi=20 =20gpio-69 ( |mod-def0 ) in lo IRQ ACTIVE= LOW gpio-70 ( |los ) in hi IRQ=20 =20gpio-79 ( |pcie-2-hog ) out hi=20 =20gpio-82 ( |PHY reset ) out hi ACTIVE LOW gpio-83 ( |PHY reset ) out hi ACTIVE LOW regards Frank