[PATCH v2 2/6] spi: Export spi_set_cs() function

Heiko Stuebner heiko at sntech.de
Fri Nov 13 10:30:33 PST 2026


Am Freitag, 13. November 2026, 14:56:33 Mitteleuropäische Normalzeit schrieb Heiko Stübner:
> Am Freitag, 13. November 2026, 14:50:13 Mitteleuropäische Normalzeit schrieb Heiko Stuebner:
> > From: Heiko Stuebner <heiko.stuebner at cherry.de>
> > 
> > While spi_set_cs is currently only used when the SPI framework manages
> > the core transfer function, it contains a lot of functionality that
> > can be used for the upcoming atomic transfers, where a driver implementing
> > that atomic transfer could profit from not having to duplicate the
> > chip-select functionality.
> > 
> > The only sleeping part was the spi_delay_exec function doing the
> > chip-select delays, which can now also run in atomic contexts.
> > 
> > So export the function.
> > 
> > Signed-off-by: Heiko Stuebner <heiko.stuebner at cherry.de>
> > ---
> 
> Dang, overlooked spi_toggle_csgpiod() called in spi_set_cs(), which does
> gpiod_set_value_cansleep().

spi_toggle_csgpiod() can of course also differentiate between using
_can_sleep normally and switching to the no-sleep variant in the atomic
mode.

So before this whole series a splat is already created if a gpio-cs at
the late stage, so after this, the splat would only occur, if someone
uses a sleeping gpio(-expander) for something wanting to poweroff a
system.


Anyway, I've created a patch for spi_toggle_csgpiod() but will wait
till monday to maybe get some more comments beforehand.


Heiko





More information about the Linux-rockchip mailing list