diff options
Diffstat (limited to 'tools/spi')
| -rw-r--r-- | tools/spi/.gitignore | 1 | ||||
| -rw-r--r-- | tools/spi/Makefile | 2 | ||||
| -rw-r--r-- | tools/spi/spidev_test.c | 14 | 
3 files changed, 11 insertions, 6 deletions
| diff --git a/tools/spi/.gitignore b/tools/spi/.gitignore index 4280576397e8..14ddba3d2195 100644 --- a/tools/spi/.gitignore +++ b/tools/spi/.gitignore @@ -1,2 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only  spidev_fdx  spidev_test 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) |