[PATCH 05/12] i2c: xiic: Use 'nmsgs' variable instead of repeated_start
From: Manikanta Guntupalli
Date: Fri Jun 24 2022 - 08:06:49 EST
From: Raviteja Narayanam <raviteja.narayanam@xxxxxxxxxx>
Remove the redundant repeated_start variable as it is setup at
different places, and read at only one place which can be decided
by 'nmsgs' variable alone.
Signed-off-by: Raviteja Narayanam <raviteja.narayanam@xxxxxxxxxx>
Signed-off-by: Manikanta Guntupalli <manikanta.guntupalli@xxxxxxxxxx>
---
drivers/i2c/busses/i2c-xiic.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 9c3266ac209e..3debb44608cf 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -61,7 +61,6 @@ enum xiic_endian {
* @state: See STATE_
* @singlemaster: Indicates bus is single master
* @dynamic: Mode of controller
- * @repeated_start: Repeated start operation
* @prev_msg_tx: Previous message is Tx
*/
struct xiic_i2c {
@@ -80,7 +79,6 @@ struct xiic_i2c {
enum xilinx_i2c_state state;
bool singlemaster;
bool dynamic;
- bool repeated_start;
bool prev_msg_tx;
};
@@ -445,7 +443,7 @@ static void xiic_std_fill_tx_fifo(struct xiic_i2c *i2c)
if (len > fifo_space)
len = fifo_space;
- else if (len && !(i2c->repeated_start))
+ else if (len && !(i2c->nmsgs > 1))
len--;
while (len--) {
@@ -786,7 +784,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
}
/* Check if RSTA should be set */
if (cr & XIIC_CR_MSMS_MASK) {
- i2c->repeated_start = true;
/* Already a master, RSTA should be set */
xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, (cr |
XIIC_CR_REPEATED_START_MASK) &
@@ -805,7 +802,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
/* Write to Control Register,to start transaction in Rx mode */
if ((cr & XIIC_CR_MSMS_MASK) == 0) {
- i2c->repeated_start = false;
xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, (cr |
XIIC_CR_MSMS_MASK)
& ~(XIIC_CR_DIR_IS_TX_MASK));
@@ -879,7 +875,6 @@ static void xiic_start_send(struct xiic_i2c *i2c)
/* Check if RSTA should be set */
cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET);
if (cr & XIIC_CR_MSMS_MASK) {
- i2c->repeated_start = true;
/* Already a master, RSTA should be set */
xiic_setreg8(i2c, XIIC_CR_REG_OFFSET, (cr |
XIIC_CR_REPEATED_START_MASK |
@@ -895,7 +890,6 @@ static void xiic_start_send(struct xiic_i2c *i2c)
xiic_std_fill_tx_fifo(i2c);
if ((cr & XIIC_CR_MSMS_MASK) == 0) {
- i2c->repeated_start = false;
/* Start Tx by writing to CR */
cr = xiic_getreg8(i2c, XIIC_CR_REG_OFFSET);
--
2.25.1