From 4a29e12c7674ab40809f41bf06cf071d3afd3ce7 Mon Sep 17 00:00:00 2001 From: Tomasz Pala Date: Fri, 29 Sep 2017 12:31:02 +0200 Subject: [PATCH] report I2C errors using dev_err() to indicate failing node number --- frontends/cxd2099.c | 8 ++++---- frontends/mxl5xx.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontends/cxd2099.c b/frontends/cxd2099.c index a1b3001..2149c46 100644 --- a/frontends/cxd2099.c +++ b/frontends/cxd2099.c @@ -73,7 +73,7 @@ static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr, struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2}; if (i2c_transfer(adapter, &msg, 1) != 1) { - pr_err("cxd2099: failed to write to I2C register %02x@%02x!\n", + dev_err(&adapter->dev, "cxd2099: failed to write to I2C register %02x@%02x!\n", reg, adr); return -1; } @@ -86,7 +86,7 @@ static int i2c_write(struct i2c_adapter *adapter, u8 adr, struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len}; if (i2c_transfer(adapter, &msg, 1) != 1) { - pr_err("cxd2099: i2c_write error\n"); + dev_err(&adapter->dev, "cxd2099 write error\n"); return -1; } return 0; @@ -101,7 +101,7 @@ static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr, .buf = val, .len = 1} }; if (i2c_transfer(adapter, msgs, 2) != 2) { - pr_err("cxd2099: i2c_read_reg error\n"); + dev_err(&adapter->dev, "cxd2099 i2c_read_reg error\n"); return -1; } return 0; @@ -116,7 +116,7 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr, .buf = data, .len = n} }; if (i2c_transfer(adapter, msgs, 2) != 2) { - pr_err("cxd2099: i2c_read error\n"); + dev_err(&adapter->dev, "cxd2099: i2c_read error\n"); return -1; } return 0; diff --git a/frontends/mxl5xx.c b/frontends/mxl5xx.c index 2279087..f1f83ff 100644 --- a/frontends/mxl5xx.c +++ b/frontends/mxl5xx.c @@ -191,13 +191,13 @@ static int read_register_unlocked(struct mxl *state, u32 reg, u32 *val) stat = i2cwrite(state, data, MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE); if (stat) - pr_err("mxl5xx: i2c read error 1\n"); + dev_err(&state->base->i2c->dev,"mxl5xx read error 1\n"); if (!stat) stat = i2cread(state, (u8 *) val, MXL_HYDRA_REG_SIZE_IN_BYTES); le32_to_cpus(val); if (stat) - pr_err("mxl5xx: i2c read error 2\n"); + dev_err(&state->base->i2c->dev,"mxl5xx read error 2\n"); return stat; } @@ -245,7 +245,7 @@ static int write_register(struct mxl *state, u32 reg, u32 val) stat = i2cwrite(state, data, sizeof(data)); mutex_unlock(&state->base->i2c_lock); if (stat) - pr_err("mxl5xx: i2c write error\n"); + dev_err(&state->base->i2c->dev, "mxl5xx write error\n"); return stat; } @@ -292,7 +292,7 @@ static int write_firmware_block(struct mxl *state, MXL_HYDRA_REG_SIZE_IN_BYTES + size); mutex_unlock(&state->base->i2c_lock); if (stat) - pr_err("mxl5xx: fw block write failed\n"); + dev_err(&state->base->i2c->dev, "mxl5xx fw block write failed\n"); return stat; } @@ -309,14 +309,14 @@ static int read_register(struct mxl *state, u32 reg, u32 *val) stat = i2cwrite(state, data, MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE); if (stat) - pr_err("mxl5xx: i2c read error 1\n"); + dev_err(&state->base->i2c->dev, "mxl5xx read error 1\n"); if (!stat) stat = i2cread(state, (u8 *) val, MXL_HYDRA_REG_SIZE_IN_BYTES); mutex_unlock(&state->base->i2c_lock); le32_to_cpus(val); if (stat) - pr_err("mxl5xx: i2c read error 2\n"); + dev_err(&state->base->i2c->dev, "mxl5xx read error 2\n"); return stat; }