lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Dec 2017 12:11:23 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Kyle Roeschley <kyle.roeschley@...com>,
        Mark Brown <broonie@...nel.org>
Cc:     linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
        Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: Re: [PATCH] spi: Add a sysfs interface to instantiate devices

On 12/21/2017 12:03 PM, Kyle Roeschley wrote:
> Add a sysfs interface to instantiate and delete SPI devices using the
> spidev driver. This can be used when developing a driver on a
> self-soldered board which doesn't yet have proper SPI device declaration
> at the platform level, and presumably for various debugging situations.
> 
> Inspired by 99cd8e25875a ("i2c: Add a sysfs interface to instantiate
> devices").
> 
> Signed-off-by: Kyle Roeschley <kyle.roeschley@...com>
> ---
>  Documentation/spi/spi-summary | 14 ++++++++
>  drivers/spi/spi.c             | 78 +++++++++++++++++++++++++++++++++++++++++++
>  include/linux/spi/spi.h       |  3 ++
>  3 files changed, 95 insertions(+)
> 
> diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
> index 1721c1b570c3..51d9747c4426 100644
> --- a/Documentation/spi/spi-summary
> +++ b/Documentation/spi/spi-summary
> @@ -339,6 +339,20 @@ up the spi bus master, and will likely need spi_new_device() to provide the
>  board info based on the board that was hotplugged.  Of course, you'd later
>  call at least spi_unregister_device() when that board is removed.
>  
> +Alternatively, a sysfs interface was added to let the user create devices which

                                                                             when

> +using the spidev driver. This interface is made of 2 attribute files which are
> +created in every SPI master directory: new_device and delete_device. Both files
> +are write only and you must write the decimal SPI chip select number to them in

       write-only

> +order to properly instantiate or delete a SPI device. As no two devices can be
> +attached to the same master with the same chip select line, the chip select
> +number is sufficient to uniquely identify the device to be deleted.
> +
> +Example:
> +# echo 1 > /sys/class/spi_master/spi0/new_device
> +
> +In general, this interface should only be used when in-kernel device
> +declaration can't be done.
> +
>  When Linux includes support for MMC/SD/SDIO/DataFlash cards through SPI, those
>  configurations will also be dynamic.  Fortunately, such devices all support
>  basic device identification probes, so they should hotplug normally.

thanks.
-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ