diff options
author | Alexander Sverdlin <[email protected]> | 2022-11-30 17:29:27 +0100 |
---|---|---|
committer | Mark Brown <[email protected]> | 2022-12-01 11:16:56 +0000 |
commit | 7dbfa445ff7393d1c4c066c1727c9e0af1251958 (patch) | |
tree | 97215dbe0c61c7f701c217002f2f7be9ba454209 /tools/testing/selftests/bpf/prog_tests | |
parent | f8fc65e50ad71c139a12a96e64eeba5005e491d5 (diff) |
spi: spidev: mask SPI_CS_HIGH in SPI_IOC_RD_MODE
Commit f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
has changed the user-space interface so that bogus SPI_CS_HIGH started
to appear in the mask returned by SPI_IOC_RD_MODE even for active-low CS
pins. Commit 138c9c32f090
("spi: spidev: Fix CS polarity if GPIO descriptors are used") fixed only
SPI_IOC_WR_MODE part of the problem. Let's fix SPI_IOC_RD_MODE
symmetrically.
Test case:
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/spi/spidev.h>
int main(int argc, char **argv)
{
char modew = SPI_CPHA;
char moder;
int f = open("/dev/spidev0.0", O_RDWR);
if (f < 0)
return 1;
ioctl(f, SPI_IOC_WR_MODE, &modew);
ioctl(f, SPI_IOC_RD_MODE, &moder);
return moder == modew ? 0 : 2;
}
Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
Signed-off-by: Alexander Sverdlin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests')
0 files changed, 0 insertions, 0 deletions