mirror of
https://github.com/apache/nuttx.git
synced 2026-08-02 12:49:00 +00:00
sim/spi: ioctl stytemcall use host_uninterruptible
syscall use macro host_uninterruptible Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
This commit is contained in:
parent
beb0a47568
commit
96db23e7df
1 changed files with 13 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue