Skip to contentSkip to conversation

drivers/i2c/muxes/i2c-mux-reg: Change ioread endianness for readback

PATCH Applied York Sun 2 participants 2 messages Sep 2, 2015 – Sep 3, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH 1/1 drivers/i2c/muxes/i2c-mux-reg: Change ioread endianness for readback

Reading the register (if allowed) after writing is to ensure writing is completed on a posted bus. The endianness of reading doesn't matter.

---
 drivers/i2c/muxes/i2c-mux-reg.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/i2c/muxes/i2c-mux-reg.c +14 -14
index 86d41d36..7f2a1ae 100644
@@ -31,28 +31,28 @@ static int i2c_mux_reg_set(const struct regmux *mux, unsigned int chan_id)
 	if (!mux->data.reg)
 		return -EINVAL;
 
+	/*
+	 * Write to the register, followed by a read to ensure the write is
+	 * completed on a "posted" bus, for example PCI or write buffers.
+	 * The endianness of reading doesn't matter and the return data
+	 * is not used.
+	 */
 	switch (mux->data.reg_size) {
 	case 4:
-		if (mux->data.little_endian) {
+		if (mux->data.little_endian)
 			iowrite32(chan_id, mux->data.reg);
-			if (!mux->data.write_only)
-				ioread32(mux->data.reg);
-		} else {
+		else
 			iowrite32be(chan_id, mux->data.reg);
-			if (!mux->data.write_only)
-				ioread32(mux->data.reg);
-		}
+		if (!mux->data.write_only)
+			ioread32(mux->data.reg);
 		break;
 	case 2:
-		if (mux->data.little_endian) {
+		if (mux->data.little_endian)
 			iowrite16(chan_id, mux->data.reg);
-			if (!mux->data.write_only)
-				ioread16(mux->data.reg);
-		} else {
+		else
 			iowrite16be(chan_id, mux->data.reg);
-			if (!mux->data.write_only)
-				ioread16be(mux->data.reg);
-		}
+		if (!mux->data.write_only)
+			ioread16(mux->data.reg);
 		break;
 	case 1:
 		iowrite8(chan_id, mux->data.reg);
Signature · 1 line
1.7.9.5