11 Jun, 2020

1 commit

  • Fix the following sparse warning:

    ./spidev_test.c:50:9: warning: symbol 'default_tx' was not declared. Should it be static?
    ./spidev_test.c:59:9: warning: symbol 'default_rx' was not declared. Should it be static?
    ./spidev_test.c:60:6: warning: symbol 'input_tx' was not declared. Should it be static?

    Signed-off-by: Qing Zhang
    Link: https://lore.kernel.org/r/1591880212-13479-1-git-send-email-zhangqing@loongson.cn
    Signed-off-by: Mark Brown

    Qing Zhang
     

08 Jun, 2020

1 commit

  • Consistently use %u to format unsigned numbers.
    For "bits" this doesn't matter that much, as it is "uint8_t".
    However, "speed" is "uint32_t", so in case people use "-s -1" to force
    the maximum, they would see:

    max speed: -1 Hz (4294967 KHz)

    While at it, use "k" (kilo) instead of "K" (kelvin) in "kHz".

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200608100049.30648-1-geert+renesas@glider.be
    Signed-off-by: Mark Brown

    Geert Uytterhoeven
     

16 Apr, 2020

1 commit


13 Feb, 2020

3 commits

  • It is better to use perror() only if errno is not 0, it should use printf()
    when errno is 0, otherwise there exists redudant ": Success".

    E.g. without this patch:

    $ ./spidev_test -p 1234 --input test.bin
    only one of -p and --input may be selected: Success
    Aborted (core dumped)

    With this patch:

    $ ./spidev_test -p 1234 --input test.bin
    only one of -p and --input may be selected
    Aborted (core dumped)

    Signed-off-by: Tiezhu Yang
    Reviewed-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/1581567368-8055-3-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Mark Brown

    Tiezhu Yang
     
  • It is better to check input_tx and input_file first after parse options.
    Otherwise, it will do some useless operations when both -p and --input
    are selected.

    Signed-off-by: Tiezhu Yang
    Reviewed-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/1581567368-8055-2-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Mark Brown

    Tiezhu Yang
     
  • When call print_usage() in parse_opts(), it will exit directly.
    Since break is not useful after exit statement, remove it.

    Signed-off-by: Tiezhu Yang
    Reviewed-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/1581567368-8055-1-git-send-email-yangtiezhu@loongson.cn
    Signed-off-by: Mark Brown

    Tiezhu Yang
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 24 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Steve Winslow
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528170026.162703968@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

05 Sep, 2018

1 commit

  • - Print spaces as spaces,
    - Do not print characters > 126, as they will be shown as garbage
    in the modern UTF-8 era,
    - Use a normal period instead of its hexadecimal ASCII value,
    - Delimit the text part with pipe symbols on both sides (was left side
    only), without any spaces, to make it clear where the decoded text
    starts and ends,
    - Drop a useless comment.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Mark Brown

    Geert Uytterhoeven
     

22 Mar, 2017

1 commit


04 Nov, 2016

1 commit


01 Oct, 2016

1 commit


14 Sep, 2016

1 commit

  • Sometimes spidev_test crashes with:

    *** Error in `spidev_test': munmap_chunk(): invalid pointer: 0x00022020 ***
    Aborted

    or just

    Segmentation fault

    This is due to transfer_escaped_string() miscalculating the required
    size of the buffer by one byte, causing a buffer overflow in unescape().

    Drop the bogus "+ 1" in the strlen() parameter to fix this.

    Note that unescape() never copies the zero-terminator of the source
    string, so it writes at most as many bytes as the length of the source
    string.

    Fixes: 30061915be6e3a2c (spi: spidev_test: Added input buffer from the terminal)
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Mark Brown
    Cc: # v4.5+

    Geert Uytterhoeven
     

15 Aug, 2016

1 commit

  • spidev.h uses _IOC_SIZEBITS directly. musl libc does not provide this macro
    unless linux/ioctl.h is included explicitly. Fixes build failures like:

    In file included from .../host/usr/arm-buildroot-linux-musleabihf/sysroot/usr/include/sys/ioctl.h:7:0,
    from .../build/spidev_test-v3.15/spidev_test.c:20:
    .../build/spidev_test-v3.15/spidev_test.c: In function ‘transfer’:
    .../build/spidev_test-v3.15/spidev_test.c:75:18: error: ‘_IOC_SIZEBITS’ undeclared (first use in this function)
    ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
    ^

    Signed-off-by: Baruch Siach
    Signed-off-by: Mark Brown

    Baruch Siach
     

09 Dec, 2015

1 commit


23 Nov, 2015

6 commits