提交 95b1ed2a 编写于 作者: H Hector Palacios 提交者: Grant Likely

spi: spidev_test gives error upon 1-byte transfer

The sample application spidev_test.c is using SPI_IOC_MESSAGE ioctl to do
an SPI transfer.  This ioctl returns the number of bytes successfully
transmitted or a negative error code upon erroneous completion.  The
application however is returning an error if the result of the ioclt if
the return value is 1.  This makes the application to fail upon 1-byte
length transfers.
Signed-off-by: NHector Palacios <hector.palacios@digi.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
上级 dda04c7b
......@@ -58,7 +58,7 @@ static void transfer(int fd)
};
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
if (ret == 1)
if (ret < 1)
pabort("can't send spi message");
for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册