[PATCH v3 2/2]spi: DUAL and QUAD support

Mark Brown broonie at kernel.org
Thu Aug 22 08:50:13 EDT 2013


On Sun, Aug 11, 2013 at 06:23:50PM +0800, wangyuhang wrote:
> fix two things in previous patch
> 1. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL
>    SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires in
>    spidev.h.
> 2. To keep tx_nbits and rx_nbits in @spi_ioc_transfer compatible to existed
>    binary in userspace, add SPI_SPIDEV_TRPBIT in Kconfig to make user select
>    appropriate spi_ioc_transfer.

This isn't really a good solution for the ABI - it's OK to remove
support for features but it's not good to have the ABI vary depending on
the kernel config.

> @@ -86,6 +95,10 @@ struct spi_ioc_transfer {
>  	__u64		tx_buf;
>  	__u64		rx_buf;
>  
> +#ifdef CONFIG_SPI_SPIDEV_TRPBIT
> +	__u8		tx_nbits;
> +	__u8		rx_nbits;
> +#endif

Instead of doing this I'd define a new structure like this:

	struct spi_ioc_ext_transfer {
		struct spi_ioc_transfer core;
		__u8		tx_nbits;
		__u8		rx_nbits;
	};

(though this is going to get messy if we get more additions...).  I'm
not sure there's a nice way of doing this though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20130822/57baf1ab/attachment.sig>


More information about the linux-mtd mailing list