diff options
author | Mark Brown <broonie@kernel.org> | 2020-03-27 15:53:00 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-03-27 15:53:00 +0000 |
commit | 1ba0b52ea73bd46ff053edea21f5630f5277fefe (patch) | |
tree | 1a4e561a0e0238a54aff02aa47e20cfcd61522be /tools | |
parent | 16fbf79b0f83bc752cee8589279f1ebfe57b3b6e (diff) | |
parent | ebb3b9a92ba98efa8d0525367e653d5ee6630c1b (diff) | |
download | linux-stable-1ba0b52ea73bd46ff053edea21f5630f5277fefe.tar.gz linux-stable-1ba0b52ea73bd46ff053edea21f5630f5277fefe.tar.bz2 linux-stable-1ba0b52ea73bd46ff053edea21f5630f5277fefe.zip |
Merge branch 'spi-5.7' into spi-next
Diffstat (limited to 'tools')
-rw-r--r-- | tools/spi/Makefile | 2 | ||||
-rw-r--r-- | tools/spi/spidev_test.c | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/tools/spi/Makefile b/tools/spi/Makefile index 5c342e655e55..2249a1546cc1 100644 --- a/tools/spi/Makefile +++ b/tools/spi/Makefile @@ -51,7 +51,7 @@ $(OUTPUT)spidev_fdx: $(SPIDEV_FDX_IN) clean: rm -f $(ALL_PROGRAMS) - rm -f $(OUTPUT)include/linux/spi/spidev.h + rm -rf $(OUTPUT)include/ find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete install: $(ALL_PROGRAMS) diff --git a/tools/spi/spidev_test.c b/tools/spi/spidev_test.c index 3559e7646256..27967dd90f8f 100644 --- a/tools/spi/spidev_test.c +++ b/tools/spi/spidev_test.c @@ -13,6 +13,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #include <getopt.h> #include <fcntl.h> #include <time.h> @@ -26,7 +27,11 @@ static void pabort(const char *s) { - perror(s); + if (errno != 0) + perror(s); + else + printf("%s\n", s); + abort(); } @@ -283,7 +288,6 @@ static void parse_opts(int argc, char *argv[]) break; default: print_usage(argv[0]); - break; } } if (mode & SPI_LOOP) { @@ -405,6 +409,9 @@ int main(int argc, char *argv[]) parse_opts(argc, argv); + if (input_tx && input_file) + pabort("only one of -p and --input may be selected"); + fd = open(device, O_RDWR); if (fd < 0) pabort("can't open device"); @@ -446,9 +453,6 @@ int main(int argc, char *argv[]) printf("bits per word: %d\n", bits); printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000); - if (input_tx && input_file) - pabort("only one of -p and --input may be selected"); - if (input_tx) transfer_escaped_string(fd, input_tx); else if (input_file) |