diff mbox

[3/3] spi: sun6i: Use the driver data to get the buffer size

Message ID 20161019140234.13518-4-woogyom.kim@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Milo Kim Oct. 19, 2016, 2:02 p.m. UTC
The argument can be removed because the driver private data has it.

Cc: Mark Brown <broonie@kernel.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
---
 drivers/spi/spi-sun6i.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Maxime Ripard Oct. 20, 2016, 3:56 p.m. UTC | #1
On Wed, Oct 19, 2016 at 11:02:34PM +0900, Milo Kim wrote:
> The argument can be removed because the driver private data has it.
> 
> Cc: Mark Brown <broonie@kernel.org>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
> ---
>  drivers/spi/spi-sun6i.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c
> index 91235b2..c638f5d 100644
> --- a/drivers/spi/spi-sun6i.c
> +++ b/drivers/spi/spi-sun6i.c
> @@ -105,8 +105,9 @@ static inline void sun6i_spi_write(struct sun6i_spi *sspi, u32 reg, u32 value)
>  	writel(value, sspi->base_addr + reg);
>  }
>  
> -static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi, int len)
> +static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi)
>  {
> +	int len = sspi->fifo_depth;
>  	u32 reg, cnt;
>  	u8 byte;

I'm not so sure about this one. This function was initially to drain
any given number of bytes, which might be of interest at some point.

Removing that argument also remove that ability... Any particular
reason you want to change it?

Thanks!
Maxime
Milo Kim Oct. 21, 2016, 1:39 p.m. UTC | #2
On 10/21/2016 12:56 AM, Maxime Ripard wrote:
>> -static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi, int len)
>> > +static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi)
>> >  {
>> > +	int len = sspi->fifo_depth;
>> >  	u32 reg, cnt;
>> >  	u8 byte;
> I'm not so sure about this one. This function was initially to drain
> any given number of bytes, which might be of interest at some point.
>
> Removing that argument also remove that ability... Any particular
> reason you want to change it?

I just wanted to remove duplicate variable but I agree with you. Let me 
drop this in the next patch-set. Thanks for your comments.

Best regards,
Milo
--
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-sun6i.c b/drivers/spi/spi-sun6i.c
index 91235b2..c638f5d 100644
--- a/drivers/spi/spi-sun6i.c
+++ b/drivers/spi/spi-sun6i.c
@@ -105,8 +105,9 @@  static inline void sun6i_spi_write(struct sun6i_spi *sspi, u32 reg, u32 value)
 	writel(value, sspi->base_addr + reg);
 }
 
-static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi, int len)
+static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi)
 {
+	int len = sspi->fifo_depth;
 	u32 reg, cnt;
 	u8 byte;
 
@@ -125,8 +126,9 @@  static inline void sun6i_spi_drain_fifo(struct sun6i_spi *sspi, int len)
 	}
 }
 
-static inline void sun6i_spi_fill_fifo(struct sun6i_spi *sspi, int len)
+static inline void sun6i_spi_fill_fifo(struct sun6i_spi *sspi)
 {
+	int len = sspi->fifo_depth;
 	u8 byte;
 
 	if (len > sspi->len)
@@ -270,7 +272,7 @@  static int sun6i_spi_transfer_one(struct spi_master *master,
 			SUN6I_BURST_CTL_CNT_STC(tx_len));
 
 	/* Fill the TX FIFO */
-	sun6i_spi_fill_fifo(sspi, sspi->fifo_depth);
+	sun6i_spi_fill_fifo(sspi);
 
 	/* Enable the interrupts */
 	sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, SUN6I_INT_CTL_TC);
@@ -293,7 +295,7 @@  static int sun6i_spi_transfer_one(struct spi_master *master,
 		goto out;
 	}
 
-	sun6i_spi_drain_fifo(sspi, sspi->fifo_depth);
+	sun6i_spi_drain_fifo(sspi);
 
 out:
 	sun6i_spi_write(sspi, SUN6I_INT_CTL_REG, 0);