[PATCH 1/2] i2c: viai2c: Fix some minor style issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1. fixed some minor issues that were checked out by checkpatch
2. deleted the unnecessary log that received nack during write cycle
3. adjusted the log when FW gives inappropriate parameters

Signed-off-by: Hans Hu <hanshu-oc@xxxxxxxxxxx>
---
 drivers/i2c/busses/i2c-viai2c-common.c  | 15 ++++++---------
 drivers/i2c/busses/i2c-viai2c-wmt.c     |  2 +-
 drivers/i2c/busses/i2c-viai2c-zhaoxin.c |  9 ++++-----
 3 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-viai2c-common.c b/drivers/i2c/busses/i2c-viai2c-common.c
index 05b615144442..4c208b3a509e 100644
--- a/drivers/i2c/busses/i2c-viai2c-common.c
+++ b/drivers/i2c/busses/i2c-viai2c-common.c
@@ -81,8 +81,8 @@ static int viai2c_read(struct viai2c *i2c, struct i2c_msg *pmsg, bool first)
 
 	writew(tcr_val, i2c->base + VIAI2C_REG_TCR);
 
-	if ((i2c->platform == VIAI2C_PLAT_WMT && (pmsg->flags & I2C_M_NOSTART))
-	   || (i2c->platform == VIAI2C_PLAT_ZHAOXIN && !first)) {
+	if ((i2c->platform == VIAI2C_PLAT_WMT && (pmsg->flags & I2C_M_NOSTART)) ||
+	    (i2c->platform == VIAI2C_PLAT_ZHAOXIN && !first)) {
 		val = readw(i2c->base + VIAI2C_REG_CR);
 		val |= VIAI2C_CR_CPU_RDY;
 		writew(val, i2c->base + VIAI2C_REG_CR);
@@ -104,8 +104,8 @@ int viai2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	i2c->mode = VIAI2C_BYTE_MODE;
 	for (i = 0; ret >= 0 && i < num; i++) {
 		pmsg = &msgs[i];
-		if ((i2c->platform == VIAI2C_PLAT_WMT)
-		   && !(pmsg->flags & I2C_M_NOSTART)) {
+		if (i2c->platform == VIAI2C_PLAT_WMT &&
+		    !(pmsg->flags & I2C_M_NOSTART)) {
 			ret = viai2c_wait_bus_not_busy(i2c);
 			if (ret < 0)
 				return ret;
@@ -138,12 +138,9 @@ static int viai2c_irq_xfer(struct viai2c *i2c)
 			val |= VIAI2C_CR_RX_END;
 		writew(val, base + VIAI2C_REG_CR);
 	} else {
-
 		val = readw(base + VIAI2C_REG_CSR);
-		if (val & VIAI2C_CSR_RCV_NOT_ACK) {
-			dev_dbg_ratelimited(i2c->dev, "write RCV NACK error\n");
+		if (val & VIAI2C_CSR_RCV_NOT_ACK)
 			return -EIO;
-		}
 
 		if (msg->len == 0) {
 			val = VIAI2C_CR_TX_END | VIAI2C_CR_CPU_RDY | VIAI2C_CR_ENABLE;
@@ -236,7 +233,7 @@ int viai2c_init(struct platform_device *pdev, struct viai2c **pi2c, int plat)
 	i2c->platform = plat;
 
 	err = devm_request_irq(&pdev->dev, i2c->irq, viai2c_isr,
-					irq_flags, pdev->name, i2c);
+			       irq_flags, pdev->name, i2c);
 	if (err)
 		return dev_err_probe(&pdev->dev, err,
 				"failed to request irq %i\n", i2c->irq);
diff --git a/drivers/i2c/busses/i2c-viai2c-wmt.c b/drivers/i2c/busses/i2c-viai2c-wmt.c
index aa6c34a78b1e..e1988f946026 100644
--- a/drivers/i2c/busses/i2c-viai2c-wmt.c
+++ b/drivers/i2c/busses/i2c-viai2c-wmt.c
@@ -91,7 +91,7 @@ static int wmt_i2c_probe(struct platform_device *pdev)
 	}
 
 	err = of_property_read_u32(np, "clock-frequency", &clk_rate);
-	if (!err && (clk_rate == I2C_MAX_FAST_MODE_FREQ))
+	if (!err && clk_rate == I2C_MAX_FAST_MODE_FREQ)
 		i2c->tcr = VIAI2C_TCR_FAST;
 
 	adap = &i2c->adapter;
diff --git a/drivers/i2c/busses/i2c-viai2c-zhaoxin.c b/drivers/i2c/busses/i2c-viai2c-zhaoxin.c
index 99db93caa4cb..7e3ac2a3e1fd 100644
--- a/drivers/i2c/busses/i2c-viai2c-zhaoxin.c
+++ b/drivers/i2c/busses/i2c-viai2c-zhaoxin.c
@@ -132,7 +132,8 @@ static int zxi2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int
 
 		i2c->msg = msgs;
 		i2c->mode = VIAI2C_FIFO_MODE;
-		priv->xfer_len = i2c->xfered_len = 0;
+		priv->xfer_len = 0;
+		i2c->xfered_len = 0;
 
 		viai2c_fifo_irq_xfer(i2c, 0);
 
@@ -196,7 +197,6 @@ static void zxi2c_get_bus_speed(struct viai2c *i2c)
 	u8 fstp;
 	const u32 *params;
 	struct viai2c_zhaoxin *priv = i2c->pltfm_priv;
-
 	u32 acpi_speed = i2c_acpi_find_bus_speed(i2c->dev);
 
 	count = ARRAY_SIZE(zxi2c_speed_params_table);
@@ -213,8 +213,7 @@ static void zxi2c_get_bus_speed(struct viai2c *i2c)
 		 * if BIOS setting value far from golden value,
 		 * use golden value and warn user
 		 */
-		dev_warn(i2c->dev, "speed:%d, fstp:0x%x, golden:0x%x\n",
-				params[0], fstp, params[2]);
+		dev_warn(i2c->dev, "FW FSTP[%x] might cause wrong timings, dropped\n", fstp);
 		priv->tr = params[2] | 0xff00;
 	} else {
 		priv->tr = fstp | 0xff00;
@@ -257,7 +256,7 @@ static int zxi2c_probe(struct platform_device *pdev)
 	adap->dev.parent = &pdev->dev;
 	ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev));
 	snprintf(adap->name, sizeof(adap->name), "zhaoxin-%s-%s",
-			dev_name(pdev->dev.parent), dev_name(i2c->dev));
+		 dev_name(pdev->dev.parent), dev_name(i2c->dev));
 	i2c_set_adapdata(adap, i2c);
 
 	return devm_i2c_add_adapter(&pdev->dev, adap);
-- 
2.34.1





[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux