diff mbox

[2/7] spi: pxa2xx: derive struct chip_data from struct drv_data

Message ID 1445521485-2029-2-git-send-email-jarkko.nikula@linux.intel.com (mailing list archive)
State Accepted
Commit d2c2f6a47633a36bc8db8c802f7c284da36a7a53
Headers show

Commit Message

Jarkko Nikula Oct. 22, 2015, 1:44 p.m. UTC
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Since we call pxa2xx_ssp_get_clk_div() from pump_transfers() we may derive
pointer to struct chip_data from struct drv_data like it's done in the rest
of the functions. This will make it less errorprone.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Robert Jarzmik Oct. 25, 2015, 11:42 a.m. UTC | #1
Jarkko Nikula <jarkko.nikula@linux.intel.com> writes:

> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Since we call pxa2xx_ssp_get_clk_div() from pump_transfers() we may derive
> pointer to struct chip_data from struct drv_data like it's done in the rest
> of the functions. This will make it less errorprone.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

Cheers.

--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 573a28b13a09..e02ea46168eb 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -818,8 +818,9 @@  static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate)
 }
 
 static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data,
-					   struct chip_data *chip, int rate)
+					   int rate)
 {
+	struct chip_data *chip = drv_data->cur_chip;
 	unsigned int clk_div;
 
 	switch (drv_data->ssp_type) {
@@ -925,7 +926,7 @@  static void pump_transfers(unsigned long data)
 	bits = transfer->bits_per_word;
 	speed = transfer->speed_hz;
 
-	clk_div = pxa2xx_ssp_get_clk_div(drv_data, chip, speed);
+	clk_div = pxa2xx_ssp_get_clk_div(drv_data, speed);
 
 	if (bits <= 8) {
 		drv_data->n_bytes = 1;