summaryrefslogtreecommitdiff
path: root/drivers/staging/sm750fb/ddk750_hwi2c.c
diff options
context:
space:
mode:
authorMatthieu Simon <gmatthsim@gmail.com>2017-02-07 22:48:43 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-02-09 13:23:13 +0100
commitc075b6f2d357ea91e8ef01e860571e7d151f3aa3 (patch)
tree709da17d18f67294f1dd821d46d199cc1aac17c5 /drivers/staging/sm750fb/ddk750_hwi2c.c
parent0840ff76902da3c92ecda4660ee3b1a795bbc09d (diff)
staging: sm750fb: Replace POKE32 and PEEK32 by inline functions
POKE32 and PEEK32 have been replaced by inlined functions poke32 and peek32. Having inline functions instead of macros help to get the correct type-checking and avoid the possible precedence issues reported by checkpatch. Signed-off-by: Matthieu Simon <gmatthsim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/sm750fb/ddk750_hwi2c.c')
-rw-r--r--drivers/staging/sm750fb/ddk750_hwi2c.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/staging/sm750fb/ddk750_hwi2c.c b/drivers/staging/sm750fb/ddk750_hwi2c.c
index 05d4a73aa1d4..68716ef7cb06 100644
--- a/drivers/staging/sm750fb/ddk750_hwi2c.c
+++ b/drivers/staging/sm750fb/ddk750_hwi2c.c
@@ -15,10 +15,10 @@ unsigned char bus_speed_mode
unsigned int value;
/* Enable GPIO 30 & 31 as IIC clock & data */
- value = PEEK32(GPIO_MUX);
+ value = peek32(GPIO_MUX);
value |= (GPIO_MUX_30 | GPIO_MUX_31);
- POKE32(GPIO_MUX, value);
+ poke32(GPIO_MUX, value);
/*
* Enable Hardware I2C power.
@@ -27,11 +27,11 @@ unsigned char bus_speed_mode
sm750_enable_i2c(1);
/* Enable the I2C Controller and set the bus speed mode */
- value = PEEK32(I2C_CTRL) & ~(I2C_CTRL_MODE | I2C_CTRL_EN);
+ value = peek32(I2C_CTRL) & ~(I2C_CTRL_MODE | I2C_CTRL_EN);
if (bus_speed_mode)
value |= I2C_CTRL_MODE;
value |= I2C_CTRL_EN;
- POKE32(I2C_CTRL, value);
+ poke32(I2C_CTRL, value);
return 0;
}
@@ -41,17 +41,17 @@ void sm750_hw_i2c_close(void)
unsigned int value;
/* Disable I2C controller */
- value = PEEK32(I2C_CTRL) & ~I2C_CTRL_EN;
- POKE32(I2C_CTRL, value);
+ value = peek32(I2C_CTRL) & ~I2C_CTRL_EN;
+ poke32(I2C_CTRL, value);
/* Disable I2C Power */
sm750_enable_i2c(0);
/* Set GPIO 30 & 31 back as GPIO pins */
- value = PEEK32(GPIO_MUX);
+ value = peek32(GPIO_MUX);
value &= ~GPIO_MUX_30;
value &= ~GPIO_MUX_31;
- POKE32(GPIO_MUX, value);
+ poke32(GPIO_MUX, value);
}
static long hw_i2c_wait_tx_done(void)
@@ -60,7 +60,7 @@ static long hw_i2c_wait_tx_done(void)
/* Wait until the transfer is completed. */
timeout = HWI2C_WAIT_TIMEOUT;
- while (!(PEEK32(I2C_STATUS) & I2C_STATUS_TX) && (timeout != 0))
+ while (!(peek32(I2C_STATUS) & I2C_STATUS_TX) && (timeout != 0))
timeout--;
if (timeout == 0)
@@ -91,7 +91,7 @@ static unsigned int hw_i2c_write_data(
unsigned int total_bytes = 0;
/* Set the Device Address */
- POKE32(I2C_SLAVE_ADDRESS, addr & ~0x01);
+ poke32(I2C_SLAVE_ADDRESS, addr & ~0x01);
/*
* Write data.
@@ -103,21 +103,21 @@ static unsigned int hw_i2c_write_data(
* Reset I2C by writing 0 to I2C_RESET register to
* clear the previous status.
*/
- POKE32(I2C_RESET, 0);
+ poke32(I2C_RESET, 0);
/* Set the number of bytes to be written */
if (length < MAX_HWI2C_FIFO)
count = length - 1;
else
count = MAX_HWI2C_FIFO - 1;
- POKE32(I2C_BYTE_COUNT, count);
+ poke32(I2C_BYTE_COUNT, count);
/* Move the data to the I2C data register */
for (i = 0; i <= count; i++)
- POKE32(I2C_DATA0 + i, *buf++);
+ poke32(I2C_DATA0 + i, *buf++);
/* Start the I2C */
- POKE32(I2C_CTRL, PEEK32(I2C_CTRL) | I2C_CTRL_CTRL);
+ poke32(I2C_CTRL, peek32(I2C_CTRL) | I2C_CTRL_CTRL);
/* Wait until the transfer is completed. */
if (hw_i2c_wait_tx_done() != 0)
@@ -158,7 +158,7 @@ static unsigned int hw_i2c_read_data(
unsigned int total_bytes = 0;
/* Set the Device Address */
- POKE32(I2C_SLAVE_ADDRESS, addr | 0x01);
+ poke32(I2C_SLAVE_ADDRESS, addr | 0x01);
/*
* Read data and save them to the buffer.
@@ -170,17 +170,17 @@ static unsigned int hw_i2c_read_data(
* Reset I2C by writing 0 to I2C_RESET register to
* clear all the status.
*/
- POKE32(I2C_RESET, 0);
+ poke32(I2C_RESET, 0);
/* Set the number of bytes to be read */
if (length <= MAX_HWI2C_FIFO)
count = length - 1;
else
count = MAX_HWI2C_FIFO - 1;
- POKE32(I2C_BYTE_COUNT, count);
+ poke32(I2C_BYTE_COUNT, count);
/* Start the I2C */
- POKE32(I2C_CTRL, PEEK32(I2C_CTRL) | I2C_CTRL_CTRL);
+ poke32(I2C_CTRL, peek32(I2C_CTRL) | I2C_CTRL_CTRL);
/* Wait until transaction done. */
if (hw_i2c_wait_tx_done() != 0)
@@ -188,7 +188,7 @@ static unsigned int hw_i2c_read_data(
/* Save the data to the given buffer */
for (i = 0; i <= count; i++)
- *buf++ = PEEK32(I2C_DATA0 + i);
+ *buf++ = peek32(I2C_DATA0 + i);
/* Subtract length by 16 */
length -= (count + 1);