summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-03-06 20:33:19 +0000
committerMark Brown <broonie@kernel.org>2015-03-06 20:33:19 +0000
commit3e00803a97d1424e68a649a25b248f58d81d379d (patch)
treecccc36a3267cbfdb1e9ffc8f065b89455e6d1e20
parent0b2e8915ead06b21d8f2360bfc28e747c4c0df8c (diff)
parentb716c4ffc6a2b0bfbcf9619880f335be11b65708 (diff)
Merge branch 'topic/err' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-dw
-rw-r--r--drivers/spi/spi.c3
-rw-r--r--include/linux/spi/spi.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c64a3e59fce3..31d4d9d997e2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -851,6 +851,9 @@ out:
if (msg->status == -EINPROGRESS)
msg->status = ret;
+ if (msg->status)
+ master->handle_err(master, msg);
+
spi_finalize_current_message(master);
return ret;
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index ed9489d893a4..4eaac3a5227b 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -294,6 +294,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
* transfer_one_message are mutually exclusive; when both
* are set, the generic subsystem does not call your
* transfer_one callback.
+ * @handle_err: the subsystem calls the driver to handle and error that occurs
+ * in the generic implementation of transfer_one_message().
* @unprepare_message: undo any work done by prepare_message().
* @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
* number. Any individual value may be -ENOENT for CS lines that
@@ -448,6 +450,8 @@ struct spi_master {
void (*set_cs)(struct spi_device *spi, bool enable);
int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
struct spi_transfer *transfer);
+ void (*handle_err)(struct spi_master *master,
+ struct spi_message *message);
/* gpio chip select */
int *cs_gpios;