driver: spi: Modify core to compute the message length
authorSourav Poddar <sourav.poddar@ti.com>
Thu, 18 Jul 2013 10:01:25 +0000 (15:31 +0530)
committerMark Brown <broonie@linaro.org>
Thu, 18 Jul 2013 15:22:01 +0000 (16:22 +0100)
Make spi core calculate the message length while
populating the other transfer parameters.

Usecase, driver can use it to populate framelength filed in their
controller.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/spi/spi.c
include/linux/spi/spi.h

index 978dda2c523982f62c676573feb1955da0ca82da..7e3446cab72fab90bc1566866bccf2e35dd9685b 100644 (file)
@@ -1375,6 +1375,7 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
         * it is not set for this transfer.
         */
        list_for_each_entry(xfer, &message->transfers, transfer_list) {
+               message->frame_length += xfer->len;
                if (!xfer->bits_per_word)
                        xfer->bits_per_word = spi->bits_per_word;
                if (!xfer->speed_hz)
index 28e440be1c07aafaa4ac62470344b052f9107d8f..aadd0a885a0f80221e7d5ea5a5ca57a2983d05db 100644 (file)
@@ -578,6 +578,7 @@ struct spi_message {
        /* completion is reported through a callback */
        void                    (*complete)(void *context);
        void                    *context;
+       unsigned                frame_length;
        unsigned                actual_length;
        int                     status;