spi: introduce master->handle_err() callback
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 27 Feb 2015 15:34:15 +0000 (17:34 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 6 Mar 2015 19:41:56 +0000 (19:41 +0000)
This callback would be useful to handle an error that occurs in the generic
implementation of transfer_one_message(). The good candidate for this is to
drain FIFO and / or to terminate DMA transfers when timeout happened.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi.c
include/linux/spi/spi.h

index c64a3e59fce30a7f9658afcca246a6d6872627da..31d4d9d997e2b8cd55c73d97ae537a8b82d23b36 100644 (file)
@@ -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;
index ed9489d893a487f250868f8de603c84e707feaf8..4eaac3a5227bdc2d112f221c49f0e5147cdd0af2 100644 (file)
@@ -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;
This page took 0.028173 seconds and 5 git commands to generate.