1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

report I2C errors using dev_err() to indicate failing node number

This commit is contained in:
Tomasz Pala 2017-09-29 12:31:02 +02:00
parent d472e9ccb7
commit 4a29e12c76
2 changed files with 10 additions and 10 deletions

View File

@ -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}; struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2};
if (i2c_transfer(adapter, &msg, 1) != 1) { 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); reg, adr);
return -1; 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}; struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len};
if (i2c_transfer(adapter, &msg, 1) != 1) { 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 -1;
} }
return 0; return 0;
@ -101,7 +101,7 @@ static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr,
.buf = val, .len = 1} }; .buf = val, .len = 1} };
if (i2c_transfer(adapter, msgs, 2) != 2) { 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 -1;
} }
return 0; return 0;
@ -116,7 +116,7 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr,
.buf = data, .len = n} }; .buf = data, .len = n} };
if (i2c_transfer(adapter, msgs, 2) != 2) { 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 -1;
} }
return 0; return 0;

View File

@ -191,13 +191,13 @@ static int read_register_unlocked(struct mxl *state, u32 reg, u32 *val)
stat = i2cwrite(state, data, stat = i2cwrite(state, data,
MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE); MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE);
if (stat) if (stat)
pr_err("mxl5xx: i2c read error 1\n"); dev_err(&state->base->i2c->dev,"mxl5xx read error 1\n");
if (!stat) if (!stat)
stat = i2cread(state, (u8 *) val, stat = i2cread(state, (u8 *) val,
MXL_HYDRA_REG_SIZE_IN_BYTES); MXL_HYDRA_REG_SIZE_IN_BYTES);
le32_to_cpus(val); le32_to_cpus(val);
if (stat) if (stat)
pr_err("mxl5xx: i2c read error 2\n"); dev_err(&state->base->i2c->dev,"mxl5xx read error 2\n");
return stat; return stat;
} }
@ -245,7 +245,7 @@ static int write_register(struct mxl *state, u32 reg, u32 val)
stat = i2cwrite(state, data, sizeof(data)); stat = i2cwrite(state, data, sizeof(data));
mutex_unlock(&state->base->i2c_lock); mutex_unlock(&state->base->i2c_lock);
if (stat) if (stat)
pr_err("mxl5xx: i2c write error\n"); dev_err(&state->base->i2c->dev, "mxl5xx write error\n");
return stat; return stat;
} }
@ -292,7 +292,7 @@ static int write_firmware_block(struct mxl *state,
MXL_HYDRA_REG_SIZE_IN_BYTES + size); MXL_HYDRA_REG_SIZE_IN_BYTES + size);
mutex_unlock(&state->base->i2c_lock); mutex_unlock(&state->base->i2c_lock);
if (stat) if (stat)
pr_err("mxl5xx: fw block write failed\n"); dev_err(&state->base->i2c->dev, "mxl5xx fw block write failed\n");
return stat; return stat;
} }
@ -309,14 +309,14 @@ static int read_register(struct mxl *state, u32 reg, u32 *val)
stat = i2cwrite(state, data, stat = i2cwrite(state, data,
MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE); MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE);
if (stat) if (stat)
pr_err("mxl5xx: i2c read error 1\n"); dev_err(&state->base->i2c->dev, "mxl5xx read error 1\n");
if (!stat) if (!stat)
stat = i2cread(state, (u8 *) val, stat = i2cread(state, (u8 *) val,
MXL_HYDRA_REG_SIZE_IN_BYTES); MXL_HYDRA_REG_SIZE_IN_BYTES);
mutex_unlock(&state->base->i2c_lock); mutex_unlock(&state->base->i2c_lock);
le32_to_cpus(val); le32_to_cpus(val);
if (stat) if (stat)
pr_err("mxl5xx: i2c read error 2\n"); dev_err(&state->base->i2c->dev, "mxl5xx read error 2\n");
return stat; return stat;
} }