lantiq: fix broadcast packets leaking on the wrong vlan on xrx200
[librecmc/librecmc.git] / target / linux / lantiq / patches-4.9 / 0090-spi-add-transfer_status-callback.patch
1 --- a/drivers/spi/spi.c
2 +++ b/drivers/spi/spi.c
3 @@ -1013,6 +1013,20 @@ static int spi_transfer_one_message(stru
4                                                                  msecs_to_jiffies(ms));
5                         }
6  
7 +                       if (master->transfer_status) {
8 +                               ret = master->transfer_status(master, ms);
9 +                               if (ret) {
10 +                                       SPI_STATISTICS_INCREMENT_FIELD(statm,
11 +                                                                      errors);
12 +                                       SPI_STATISTICS_INCREMENT_FIELD(stats,
13 +                                                                      errors);
14 +                                       dev_err(&msg->spi->dev,
15 +                                               "SPI transfer status: %d\n",
16 +                                               ret);
17 +                                       goto out;
18 +                               }
19 +                       }
20 +
21                         if (ms == 0) {
22                                 SPI_STATISTICS_INCREMENT_FIELD(statm,
23                                                                timedout);
24 --- a/include/linux/spi/spi.h
25 +++ b/include/linux/spi/spi.h
26 @@ -370,6 +370,8 @@ static inline void spi_unregister_driver
27   *                    transfer_one_message are mutually exclusive; when both
28   *                    are set, the generic subsystem does not call your
29   *                    transfer_one callback.
30 + * @transfer_status: This callback allows the driver to return an error code
31 + *                  in case the scheduled single spi transfer failed.
32   * @handle_err: the subsystem calls the driver to handle an error that occurs
33   *             in the generic implementation of transfer_one_message().
34   * @unprepare_message: undo any work done by prepare_message().
35 @@ -546,6 +548,7 @@ struct spi_master {
36         void (*set_cs)(struct spi_device *spi, bool enable);
37         int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
38                             struct spi_transfer *transfer);
39 +       int (*transfer_status)(struct spi_master *master, unsigned long timeout);
40         void (*handle_err)(struct spi_master *master,
41                            struct spi_message *message);
42