spi: imx: drop useless member speed_hz from driver data struct
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Fri, 30 Nov 2018 06:47:09 +0000 (07:47 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 11 Dec 2018 12:00:18 +0000 (12:00 +0000)
The driver data's member variable just caches the transfer's speed_hz
member. All users of the former now have access directly to the latter.
So fix them to use the uncached value and remove the cache.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-imx.c

index 72c879226abdfcf4f544d6086dcf40550d8089c2..6ec647bbba77206b5e70774b16dc777705e03eb9 100644 (file)
@@ -87,7 +87,6 @@ struct spi_imx_data {
        unsigned long spi_clk;
        unsigned int spi_bus_clk;
 
-       unsigned int speed_hz;
        unsigned int bits_per_word;
        unsigned int spi_drctl;
 
@@ -562,7 +561,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
                                       struct spi_transfer *t)
 {
        u32 ctrl = readl(spi_imx->base + MX51_ECSPI_CTRL);
-       u32 clk = spi_imx->speed_hz, delay;
+       u32 clk = t->speed_hz, delay;
 
        /* Clear BL field and set the right value */
        ctrl &= ~MX51_ECSPI_CTRL_BL_MASK;
@@ -576,7 +575,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
        /* set clock speed */
        ctrl &= ~(0xf << MX51_ECSPI_CTRL_POSTDIV_OFFSET |
                  0xf << MX51_ECSPI_CTRL_PREDIV_OFFSET);
-       ctrl |= mx51_ecspi_clkdiv(spi_imx, spi_imx->speed_hz, &clk);
+       ctrl |= mx51_ecspi_clkdiv(spi_imx, t->speed_hz, &clk);
        spi_imx->spi_bus_clk = clk;
 
        if (spi_imx->usedma)
@@ -694,7 +693,7 @@ static int mx31_prepare_transfer(struct spi_imx_data *spi_imx,
        unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER;
        unsigned int clk;
 
-       reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->speed_hz, &clk) <<
+       reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) <<
                MX31_CSPICTRL_DR_SHIFT;
        spi_imx->spi_bus_clk = clk;
 
@@ -800,7 +799,7 @@ static int mx21_prepare_transfer(struct spi_imx_data *spi_imx,
        unsigned int max = is_imx27_cspi(spi_imx) ? 16 : 18;
        unsigned int clk;
 
-       reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, spi_imx->speed_hz, max, &clk)
+       reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, t->speed_hz, max, &clk)
                << MX21_CSPICTRL_DR_SHIFT;
        spi_imx->spi_bus_clk = clk;
 
@@ -875,7 +874,7 @@ static int mx1_prepare_transfer(struct spi_imx_data *spi_imx,
        unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER;
        unsigned int clk;
 
-       reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, spi_imx->speed_hz, &clk) <<
+       reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, t->speed_hz, &clk) <<
                MX1_CSPICTRL_DR_SHIFT;
        spi_imx->spi_bus_clk = clk;
 
@@ -1194,7 +1193,6 @@ static int spi_imx_setupxfer(struct spi_device *spi,
                return 0;
 
        spi_imx->bits_per_word = t->bits_per_word;
-       spi_imx->speed_hz = t->speed_hz;
 
        /*
         * Initialize the functions for transfer. To transfer non byte-aligned