]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
spi: davinci: remove unnecessary 'count' variable in driver private data
authorBrian Niebuhr <bniebuhr@efjohnson.com>
Fri, 20 Aug 2010 09:58:23 +0000 (15:28 +0530)
committerSekhar Nori <nsekhar@ti.com>
Thu, 18 Nov 2010 13:08:29 +0000 (18:38 +0530)
The variable count in DaVinci SPI driver's private data is
largely unused and its minor use can easily be eliminated.

Remove the variable.

Signed-off-by: Brian Niebuhr <bniebuhr@efjohnson.com>
Tested-By: Michael Williamson <michael.williamson@criticallink.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
drivers/spi/davinci_spi.c

index 1169e8e7462e3d10a0e5da8df9c13c55f37c0185..ad814f2512f04bcbff7afcb9405943b25a64f62c 100644 (file)
@@ -142,7 +142,6 @@ struct davinci_spi {
        const void              *tx;
        void                    *rx;
        u8                      *tmp_buf;
-       int                     count;
        struct davinci_spi_dma  *dma_channels;
        struct davinci_spi_platform_data *pdata;
 
@@ -630,8 +629,6 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
 
        /* convert len to words based on bits_per_word */
        conv = davinci_spi->bytes_per_word[spi->chip_select];
-       davinci_spi->count = t->len / conv;
-
        data1_reg_val = ioread32(davinci_spi->base + SPIDAT1);
 
        INIT_COMPLETION(davinci_spi->done);
@@ -643,7 +640,7 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
        /* Enable SPI */
        set_io_bits(davinci_spi->base + SPIGCR1, SPIGCR1_SPIENA_MASK);
 
-       count = davinci_spi->count;
+       count = t->len / conv;
 
        /* Determine the command to execute READ or WRITE */
        if (t->tx_buf) {
@@ -699,7 +696,7 @@ static int davinci_spi_bufs_pio(struct spi_device *spi, struct spi_transfer *t)
                } else {        /* Receive in Interrupt mode */
                        int i;
 
-                       for (i = 0; i < davinci_spi->count; i++) {
+                       for (i = 0; i < count; i++) {
                                set_io_bits(davinci_spi->base + SPIINT,
                                                SPIINT_BITERR_INTR
                                                | SPIINT_OVRRUN_INTR
@@ -754,7 +751,6 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
 
        /* convert len to words based on bits_per_word */
        data_type = davinci_spi->bytes_per_word[spi->chip_select];
-       davinci_spi->count = t->len / data_type;
 
        data1_reg_val = ioread32(davinci_spi->base + SPIDAT1);
 
@@ -767,7 +763,7 @@ static int davinci_spi_bufs_dma(struct spi_device *spi, struct spi_transfer *t)
        if (ret)
                return ret;
 
-       count = davinci_spi->count;     /* the number of elements */
+       count = t->len / data_type;     /* the number of elements */
 
        /* disable all interrupts for dma transfers */
        clear_io_bits(davinci_spi->base + SPIINT, SPIINT_MASKALL);