diff mbox

[U-Boot,09/55] exynos: i2c: Fix code style with ReadWriteByte()

Message ID 1435882592-487-10-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 3, 2015, 12:15 a.m. UTC
This function should not use mixed case, and it is simpler to use
clrbits_le32() when clearing bits. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/i2c/s3c24x0_i2c.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Heiko Schocher July 5, 2015, 6:45 a.m. UTC | #1
Hello Simon,

Am 03.07.2015 um 02:15 schrieb Simon Glass:
> This function should not use mixed case, and it is simpler to use
> clrbits_le32() when clearing bits. Fix it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>   drivers/i2c/s3c24x0_i2c.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>
> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index 9a04e48..4bbd012 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
> @@ -258,9 +258,9 @@ static int hsi2c_wait_for_trx(struct exynos5_hsi2c *i2c)
>   	return I2C_NOK_TOUT;
>   }
>
> -static void ReadWriteByte(struct s3c24x0_i2c *i2c)
> +static void read_write_byte(struct s3c24x0_i2c *i2c)
>   {
> -	writel(readl(&i2c->iiccon) & ~I2CCON_IRPND, &i2c->iiccon);
> +	clrbits_le32(&i2c->iiccon, I2CCON_IRPND);
>   }
>
>   #ifdef CONFIG_SYS_I2C
> @@ -794,7 +794,7 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c,
>   	if (addr && addr_len) {
>   		while ((i < addr_len) && (result == I2C_OK)) {
>   			writel(addr[i++], &i2c->iicds);
> -			ReadWriteByte(i2c);
> +			read_write_byte(i2c);
>   			result = WaitForXfer(i2c);
>   		}
>   		i = 0;
> @@ -806,7 +806,7 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c,
>   	case I2C_WRITE:
>   		while ((i < data_len) && (result == I2C_OK)) {
>   			writel(data[i++], &i2c->iicds);
> -			ReadWriteByte(i2c);
> +			read_write_byte(i2c);
>   			result = WaitForXfer(i2c);
>   		}
>   		break;
> @@ -822,7 +822,7 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c,
>   			/* Generate a re-START. */
>   			writel(I2C_MODE_MR | I2C_TXRX_ENA | I2C_START_STOP,
>   				&i2c->iicstat);
> -			ReadWriteByte(i2c);
> +			read_write_byte(i2c);
>   			result = WaitForXfer(i2c);
>
>   			if (result != I2C_OK)
> @@ -835,7 +835,7 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c,
>   				writel(readl(&i2c->iiccon)
>   				       & ~I2CCON_ACKGEN,
>   				       &i2c->iiccon);
> -			ReadWriteByte(i2c);
> +			read_write_byte(i2c);
>   			result = WaitForXfer(i2c);
>   			data[i++] = readl(&i2c->iicds);
>   		}
> @@ -852,7 +852,7 @@ static int i2c_transfer(struct s3c24x0_i2c *i2c,
>   bailout:
>   	/* Send STOP. */
>   	writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat);
> -	ReadWriteByte(i2c);
> +	read_write_byte(i2c);
>
>   	return result;
>   }
>
Simon Glass July 27, 2015, 11:29 p.m. UTC | #2
On 5 July 2015 at 00:45, Heiko Schocher <hs@denx.de> wrote:
> Hello Simon,
>
> Am 03.07.2015 um 02:15 schrieb Simon Glass:
>>
>> This function should not use mixed case, and it is simpler to use
>> clrbits_le32() when clearing bits. Fix it.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>> ---
>>
>>   drivers/i2c/s3c24x0_i2c.c | 14 +++++++-------
>>   1 file changed, 7 insertions(+), 7 deletions(-)
>
>
> Acked-by: Heiko Schocher <hs@denx.de>
>

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index 9a04e48..4bbd012 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -258,9 +258,9 @@  static int hsi2c_wait_for_trx(struct exynos5_hsi2c *i2c)
 	return I2C_NOK_TOUT;
 }
 
-static void ReadWriteByte(struct s3c24x0_i2c *i2c)
+static void read_write_byte(struct s3c24x0_i2c *i2c)
 {
-	writel(readl(&i2c->iiccon) & ~I2CCON_IRPND, &i2c->iiccon);
+	clrbits_le32(&i2c->iiccon, I2CCON_IRPND);
 }
 
 #ifdef CONFIG_SYS_I2C
@@ -794,7 +794,7 @@  static int i2c_transfer(struct s3c24x0_i2c *i2c,
 	if (addr && addr_len) {
 		while ((i < addr_len) && (result == I2C_OK)) {
 			writel(addr[i++], &i2c->iicds);
-			ReadWriteByte(i2c);
+			read_write_byte(i2c);
 			result = WaitForXfer(i2c);
 		}
 		i = 0;
@@ -806,7 +806,7 @@  static int i2c_transfer(struct s3c24x0_i2c *i2c,
 	case I2C_WRITE:
 		while ((i < data_len) && (result == I2C_OK)) {
 			writel(data[i++], &i2c->iicds);
-			ReadWriteByte(i2c);
+			read_write_byte(i2c);
 			result = WaitForXfer(i2c);
 		}
 		break;
@@ -822,7 +822,7 @@  static int i2c_transfer(struct s3c24x0_i2c *i2c,
 			/* Generate a re-START. */
 			writel(I2C_MODE_MR | I2C_TXRX_ENA | I2C_START_STOP,
 				&i2c->iicstat);
-			ReadWriteByte(i2c);
+			read_write_byte(i2c);
 			result = WaitForXfer(i2c);
 
 			if (result != I2C_OK)
@@ -835,7 +835,7 @@  static int i2c_transfer(struct s3c24x0_i2c *i2c,
 				writel(readl(&i2c->iiccon)
 				       & ~I2CCON_ACKGEN,
 				       &i2c->iiccon);
-			ReadWriteByte(i2c);
+			read_write_byte(i2c);
 			result = WaitForXfer(i2c);
 			data[i++] = readl(&i2c->iicds);
 		}
@@ -852,7 +852,7 @@  static int i2c_transfer(struct s3c24x0_i2c *i2c,
 bailout:
 	/* Send STOP. */
 	writel(I2C_MODE_MR | I2C_TXRX_ENA, &i2c->iicstat);
-	ReadWriteByte(i2c);
+	read_write_byte(i2c);
 
 	return result;
 }