Skip to content

drivers: spi: spi_context: exclude gpio code if no gpio cs #92888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maass-hamburg
Copy link
Member

@maass-hamburg maass-hamburg commented Jul 9, 2025

exclude gpio code if no gpio cs are used
for that spi driver. Because all of it is in a header and all functions and definitions are inline, we can optimize code out during build

@github-actions github-actions bot added the area: SPI SPI bus label Jul 9, 2025
@github-actions github-actions bot requested review from decsny, tbursztyka and teburd July 9, 2025 09:59
@maass-hamburg maass-hamburg force-pushed the spi_context_no_gpio branch from 77d4673 to bd52723 Compare July 9, 2025 12:01
@github-actions github-actions bot added platform: Nuvoton Numicro Numaker Nuvoton Technology Corporation, Numicro Numaker platform: ESP32 Espressif ESP32 labels Jul 9, 2025
@maass-hamburg maass-hamburg force-pushed the spi_context_no_gpio branch from bd52723 to cc0f25b Compare July 9, 2025 13:22
Copy link
Contributor

@tbursztyka tbursztyka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please rebase it.

Seems ok to me, though perhaps it could reduce the amount of ifdefs by doing so:

#ifndef  DT_SPI_CTX_HAS_NO_CS_GPIOS
... declare all the gpio cs functions asdoing nothing ...
# else
... the current function doing gpio cs stuff ...
#endif

Copy link

sonarqubecloud bot commented Aug 8, 2025

exclude gpio code if no gpio cs are used
for that spi driver.

Signed-off-by: Fin Maaß <[email protected]>
remove spi_cs_is_gpio checks before
spi_context_cs_control, as it is also done
inside and we don't need to check two times.

Signed-off-by: Fin Maaß <[email protected]>
@zephyrbot zephyrbot requested a review from GTLin08 August 8, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: SPI SPI bus platform: ESP32 Espressif ESP32 platform: ITE ITE platform: Nuvoton Numicro Numaker Nuvoton Technology Corporation, Numicro Numaker platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants