Re: [PATCH] spi: rockchip: return 0 if tx_buf and rx_buf are NULL

From: Mark Brown
Date: Thu Aug 14 2014 - 17:03:32 EST


On Thu, Aug 14, 2014 at 08:52:24AM +0800, Addy Ke wrote:
> To do so, spi communication can use an empty buf to pull up CS.

> This patch merged from ChromiumOS tree.
> Cros_ec use this function to turn off CS and add a delay to ensure
> the rising edge doesn't come too soon after the end of the data.

> if (!xfer->tx_buf && !xfer->rx_buf) {
> - dev_err(rs->dev, "No buffer for transfer\n");
> - return -EINVAL;
> + dev_dbg(rs->dev, "No buffer for transfer\n");
> + return 0;
> }

We should be implementing this in the core rather than the driver - just
not even call into the controller driver if there's nothing to do. That
way we make sure that every driver works properly. After all, the delay
itself is implemented in the core.

Attachment: signature.asc
Description: Digital signature