This is an automated email from the ASF dual-hosted git repository. jiuzhudong pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 96db23e7dfcedee802bbb0548b0c454ccbee9cfc Author: yezhonghui <[email protected]> AuthorDate: Mon Mar 3 15:19:40 2025 +0800 sim/spi: ioctl stytemcall use host_uninterruptible syscall use macro host_uninterruptible Signed-off-by: yezhonghui <[email protected]> --- arch/sim/src/sim/posix/sim_linuxspi.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/sim/src/sim/posix/sim_linuxspi.c b/arch/sim/src/sim/posix/sim_linuxspi.c index 78a3212389e..53d7e06cb08 100644 --- a/arch/sim/src/sim/posix/sim_linuxspi.c +++ b/arch/sim/src/sim/posix/sim_linuxspi.c @@ -38,6 +38,7 @@ #include <linux/spi/spidev.h> +#include "sim_internal.h" #include "sim_spi.h" /**************************************************************************** @@ -211,7 +212,8 @@ static void linux_spi_select(struct spi_dev_s *dev, uint32_t devid, .cs_change = false, }; - ioctl(priv->file, SPI_IOC_MESSAGE(1), &transfer_data); + host_uninterruptible(ioctl, priv->file, SPI_IOC_MESSAGE(1), + &transfer_data); } } @@ -242,8 +244,8 @@ static uint32_t linux_spi_setfrequency(struct spi_dev_s *dev, int file = priv->file; uint32_t actualfreq; - ioctl(file, SPI_IOC_WR_MAX_SPEED_HZ, &frequency); - ioctl(file, SPI_IOC_RD_MAX_SPEED_HZ, &actualfreq); + host_uninterruptible(ioctl, file, SPI_IOC_WR_MAX_SPEED_HZ, &frequency); + host_uninterruptible(ioctl, file, SPI_IOC_RD_MAX_SPEED_HZ, &actualfreq); return actualfreq; } @@ -342,7 +344,7 @@ static void linux_spi_setmode(struct spi_dev_s *dev, enum spi_mode_e mode) break; } - ioctl(file, SPI_IOC_WR_MODE, &spilinuxmode); + host_uninterruptible(ioctl, file, SPI_IOC_WR_MODE, &spilinuxmode); } /**************************************************************************** @@ -366,7 +368,8 @@ static void linux_spi_setbits(struct spi_dev_s *dev, int nbits) int file = priv->file; uint8_t bits_per_word = (uint8_t)nbits; - ioctl(file, SPI_IOC_WR_BITS_PER_WORD, &bits_per_word); + host_uninterruptible(ioctl, file, SPI_IOC_WR_BITS_PER_WORD, + &bits_per_word); } /**************************************************************************** @@ -428,7 +431,7 @@ static int linux_spi_hwfeatures(struct spi_dev_s *dev, lsb = 1; } - return ioctl(file, SPI_IOC_WR_LSB_FIRST, &lsb); + return host_uninterruptible(ioctl, file, SPI_IOC_WR_LSB_FIRST, &lsb); } #endif @@ -679,7 +682,8 @@ static int linux_spi_transfer(struct spi_dev_s *dev, const void *txbuffer, } #endif - return ioctl(file, SPI_IOC_MESSAGE(1), &transfer_data); + return host_uninterruptible(ioctl, file, SPI_IOC_MESSAGE(1), + &transfer_data); } /**************************************************************************** @@ -711,7 +715,7 @@ struct spi_dev_s *sim_spi_initialize(const char *filename) return NULL; } - priv->file = open(filename, O_RDWR); + priv->file = host_uninterruptible(open, filename, O_RDWR); if (priv->file < 0) { ERROR("Failed to open %s: %d", filename, priv->file); @@ -746,7 +750,7 @@ int sim_spi_uninitialize(struct spi_dev_s *dev) struct linux_spi_dev_s *priv = (struct linux_spi_dev_s *)dev; if (priv->file >= 0) { - close(priv->file); + host_uninterruptible(close, priv->file); } free(priv);
