* [PATCH] can: dev: can_set_termination(): Allow gpio sleep
@ 2024-11-21 15:02 Nicolai Buchwitz
2024-11-21 15:12 ` Marc Kleine-Budde
0 siblings, 1 reply; 5+ messages in thread
From: Nicolai Buchwitz @ 2024-11-21 15:02 UTC (permalink / raw)
To: Marc Kleine-Budde, Vincent Mailhol, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: n.buchwitz, l.sanfilippo, p.rosenberger, stable, Nicolai Buchwitz,
linux-can, netdev, linux-kernel
The current implementation of can_set_termination() sets the GPIO in a
context which cannot sleep. This is an issue if the GPIO controller can
sleep (e.g. since the concerning GPIO expander is connected via SPI or
I2C). Thus, if the termination resistor is set (eg. with ip link),
a warning splat will be issued in the kernel log.
Fix this by setting the termination resistor with
gpiod_set_value_cansleep() which instead of gpiod_set_value() allows it to
sleep.
Cc: stable@vger.kernel.org
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
drivers/net/can/dev/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/can/dev/dev.c b/drivers/net/can/dev/dev.c
index 6792c14fd7eb..681643ab3780 100644
--- a/drivers/net/can/dev/dev.c
+++ b/drivers/net/can/dev/dev.c
@@ -468,7 +468,7 @@ static int can_set_termination(struct net_device *ndev, u16 term)
else
set = 0;
- gpiod_set_value(priv->termination_gpio, set);
+ gpiod_set_value_cansleep(priv->termination_gpio, set);
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] can: dev: can_set_termination(): Allow gpio sleep
2024-11-21 15:02 [PATCH] can: dev: can_set_termination(): Allow gpio sleep Nicolai Buchwitz
@ 2024-11-21 15:12 ` Marc Kleine-Budde
2024-11-21 15:17 ` Lino Sanfilippo
0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-11-21 15:12 UTC (permalink / raw)
To: Nicolai Buchwitz
Cc: Vincent Mailhol, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, n.buchwitz, l.sanfilippo,
p.rosenberger, stable, linux-can, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]
Hello Nicolai,
thanks for your contribution!
On 21.11.2024 16:02:09, Nicolai Buchwitz wrote:
> The current implementation of can_set_termination() sets the GPIO in a
> context which cannot sleep. This is an issue if the GPIO controller can
> sleep (e.g. since the concerning GPIO expander is connected via SPI or
> I2C). Thus, if the termination resistor is set (eg. with ip link),
> a warning splat will be issued in the kernel log.
>
> Fix this by setting the termination resistor with
> gpiod_set_value_cansleep() which instead of gpiod_set_value() allows it to
> sleep.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
I've send the same patch a few hours ago:
https://lore.kernel.org/all/20241121-dev-fix-can_set_termination-v1-1-41fa6e29216d@pengutronix.de/
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: dev: can_set_termination(): Allow gpio sleep
2024-11-21 15:12 ` Marc Kleine-Budde
@ 2024-11-21 15:17 ` Lino Sanfilippo
2024-11-21 15:25 ` Marc Kleine-Budde
0 siblings, 1 reply; 5+ messages in thread
From: Lino Sanfilippo @ 2024-11-21 15:17 UTC (permalink / raw)
To: Marc Kleine-Budde, Nicolai Buchwitz
Cc: Vincent Mailhol, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, n.buchwitz, p.rosenberger, stable,
linux-can, netdev, linux-kernel
Hi,
On 21.11.24 16:12, Marc Kleine-Budde wrote:
> Hello Nicolai,
>
> thanks for your contribution!
>
> On 21.11.2024 16:02:09, Nicolai Buchwitz wrote:
>> The current implementation of can_set_termination() sets the GPIO in a
>> context which cannot sleep. This is an issue if the GPIO controller can
>> sleep (e.g. since the concerning GPIO expander is connected via SPI or
>> I2C). Thus, if the termination resistor is set (eg. with ip link),
>> a warning splat will be issued in the kernel log.
>>
>> Fix this by setting the termination resistor with
>> gpiod_set_value_cansleep() which instead of gpiod_set_value() allows it to
>> sleep.
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
>
> I've send the same patch a few hours ago:
>
> https://lore.kernel.org/all/20241121-dev-fix-can_set_termination-v1-1-41fa6e29216d@pengutronix.de/
>
> Marc
>
Shouldnt this also go to stable?
Regards,
Lino
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: dev: can_set_termination(): Allow gpio sleep
2024-11-21 15:17 ` Lino Sanfilippo
@ 2024-11-21 15:25 ` Marc Kleine-Budde
2024-11-21 15:30 ` Lino Sanfilippo
0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2024-11-21 15:25 UTC (permalink / raw)
To: Lino Sanfilippo
Cc: Nicolai Buchwitz, Vincent Mailhol, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, n.buchwitz,
p.rosenberger, stable, linux-can, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1308 bytes --]
On 21.11.2024 16:17:53, Lino Sanfilippo wrote:
> > On 21.11.2024 16:02:09, Nicolai Buchwitz wrote:
> >> The current implementation of can_set_termination() sets the GPIO in a
> >> context which cannot sleep. This is an issue if the GPIO controller can
> >> sleep (e.g. since the concerning GPIO expander is connected via SPI or
> >> I2C). Thus, if the termination resistor is set (eg. with ip link),
> >> a warning splat will be issued in the kernel log.
> >>
> >> Fix this by setting the termination resistor with
> >> gpiod_set_value_cansleep() which instead of gpiod_set_value() allows it to
> >> sleep.
> >>
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
> >
> > I've send the same patch a few hours ago:
> >
> > https://lore.kernel.org/all/20241121-dev-fix-can_set_termination-v1-1-41fa6e29216d@pengutronix.de/
> >
> Shouldnt this also go to stable?
Until today no-one complained about the problem, but I'll add stable on
Cc while applying the patch.
regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] can: dev: can_set_termination(): Allow gpio sleep
2024-11-21 15:25 ` Marc Kleine-Budde
@ 2024-11-21 15:30 ` Lino Sanfilippo
0 siblings, 0 replies; 5+ messages in thread
From: Lino Sanfilippo @ 2024-11-21 15:30 UTC (permalink / raw)
To: Marc Kleine-Budde
Cc: Nicolai Buchwitz, Vincent Mailhol, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, n.buchwitz,
p.rosenberger, stable, linux-can, netdev, linux-kernel
On 21.11.24 16:25, Marc Kleine-Budde wrote:
> On 21.11.2024 16:17:53, Lino Sanfilippo wrote:
>>> On 21.11.2024 16:02:09, Nicolai Buchwitz wrote:
>>>> The current implementation of can_set_termination() sets the GPIO in a
>>>> context which cannot sleep. This is an issue if the GPIO controller can
>>>> sleep (e.g. since the concerning GPIO expander is connected via SPI or
>>>> I2C). Thus, if the termination resistor is set (eg. with ip link),
>>>> a warning splat will be issued in the kernel log.
>>>>
>>>> Fix this by setting the termination resistor with
>>>> gpiod_set_value_cansleep() which instead of gpiod_set_value() allows it to
>>>> sleep.
>>>>
>>>> Cc: stable@vger.kernel.org
>>>> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
>>>
>>> I've send the same patch a few hours ago:
>>>
>>> https://lore.kernel.org/all/20241121-dev-fix-can_set_termination-v1-1-41fa6e29216d@pengutronix.de/
>>>
>> Shouldnt this also go to stable?
>
> Until today no-one complained about the problem, but I'll add stable on
> Cc while applying the patch.
>
> regards,
> Marc
>
Great, thanks!
BR,
Lino
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-21 15:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-21 15:02 [PATCH] can: dev: can_set_termination(): Allow gpio sleep Nicolai Buchwitz
2024-11-21 15:12 ` Marc Kleine-Budde
2024-11-21 15:17 ` Lino Sanfilippo
2024-11-21 15:25 ` Marc Kleine-Budde
2024-11-21 15:30 ` Lino Sanfilippo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).