Re: [PATCH] gpio: shared: call gpio_chip::of_xlate() if set
From: Konrad Dybcio
Date: Fri Mar 27 2026 - 09:12:21 EST
On 3/17/26 11:12 AM, Jon Hunter wrote:
> Hi Bartosz,
>
> On 16/03/2026 13:52, Bartosz Golaszewski wrote:
>> OF-based GPIO controller drivers may provide a translation function that
>> calculates the real chip offset from whatever devicetree sources
>> provide. We need to take this into account in the shared GPIO management
>> and call of_xlate() if it's provided and adjust the entry->offset we
>> initially set when scanning the tree.
>>
>> To that end: modify the shared GPIO API to take the GPIO chip as
>> argument on setup (to avoid having to rcu_dereference() it from the GPIO
>> device) and protect the access to entry->offset with the existing lock.
>>
>> Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
>> Reported-by: Jon Hunter <jonathanh@xxxxxxxxxx>
>> Closes: https://lore.kernel.org/all/921ba8ce-b18e-4a99-966d-c763d22081e2@xxxxxxxxxx/
>> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
>> ---
[...]
> Thanks for sending this. However, I am seeing a different issue now ...
>
> ------------[ cut here ]------------
> WARNING: drivers/gpio/gpiolib-shared.c:499 at gpio_shared_add_proxy_lookup+0x118/0x1d8, CPU#8: swapper/0/1
Not only this, this breaks suspend on the Qualcomm X1E CRD (probably all
/most QC devices by extension)
+CC Abel, Sibi in case this is what you've been chasing
with the patch:
[rootfs ]# echo mem > /sys/power/state
[ 226.043580] PM: suspend entry (deep)
[ 226.047470] Filesystems sync: 0.000 seconds
[ 226.058513] Freezing user space processes
[ 226.066296] Freezing user space processes completed (elapsed 0.003 seconds)
[ 226.073489] OOM killer disabled.
[ 226.076843] Freezing remaining freezable tasks
[ 226.082353] Freezing remaining freezable tasks completed (elapsed 0.000 seconds)
(give it some time, it dies)
without the patch:
[rootfs ]# echo mem > /sys/power/state [ 38.047570] PM: suspend entry (deep)
[ 38.053506] Filesystems sync: 0.001 seconds
[ 38.082615] Freezing user space processes
[ 38.092528] Freezing user space processes completed (elapsed 0.005 seconds)
[ 38.099860] OOM killer disabled.
[ 38.103222] Freezing remaining freezable tasks
[ 38.110329] Freezing remaining freezable tasks completed (elapsed 0.002 seconds)
[ 38.469231] dwc3-qcom-legacy a0f8800.usb: port-1 HS-PHY not in L2
[ 38.652848] Disabling non-boot CPUs ...
[ 38.668957] IRQ205: set affinity failed(-22).
[ 38.669018] IRQ206: set affinity failed(-22).
[ 38.669029] IRQ207: set affinity failed(-22).
[ 38.670351] IRQ274: set affinity failed(-22).
[ 38.671257] psci: CPU11 killed (polled 0 ms)
[ 38.712308] IRQ205: set affinity failed(-22).
[ 38.712323] IRQ206: set affinity failed(-22).
[ 38.712333] IRQ207: set affinity failed(-22).
[ 38.713634] IRQ274: set affinity failed(-22).
[ 38.713821] psci: CPU10 killed (polled 0 ms)
[ 38.754187] IRQ205: set affinity failed(-22).
[ 38.754202] IRQ206: set affinity failed(-22).
[ 38.756479] psci: CPU9 killed (polled 0 ms)
[ 38.789962] psci: CPU8 killed (polled 0 ms)
[ 38.803178] psci: CPU7 killed (polled 0 ms)
[ 38.816286] psci: CPU6 killed (polled 0 ms)
[ 38.828479] psci: CPU5 killed (polled 0 ms)
[ 38.847479] psci: CPU4 killed (polled 0 ms)
[ 38.873528] psci: CPU3 killed (polled 0 ms)
[ 38.894399] psci: CPU2 killed (polled 0 ms)
[ 38.905818] psci: CPU1 killed (polled 0 ms)
[ 38.912658] Enabling non-boot CPUs ...
(resumes just fine)
Konrad