Skip to content

Commit

Permalink
i2c: core: Make debug message even more debuggish
Browse files Browse the repository at this point in the history
One may notice that dev_printk(KERN_DEBUG ...) is *not* an equivalent
to dev_dbg(). It will be printed whenever loglevel is high enough.
And currently it will be the only message in the I²C core in some
configurations that got printed under above conditions.

Moving to dev_dbg() will hide it in the configurations where Dynamic Debug
is enabled and hence align with all other debug messages in the I²C core..

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
  • Loading branch information
Andy Shevchenko authored and Wolfram Sang committed May 28, 2021
1 parent 92b7716 commit cb3c66a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/i2c/i2c-core-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,8 @@ static int i2c_gpio_init_recovery(struct i2c_adapter *adap)
static int i2c_init_recovery(struct i2c_adapter *adap)
{
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
char *err_str, *err_level = KERN_ERR;
bool is_error_level = true;
char *err_str;

if (!bri)
return 0;
Expand All @@ -409,7 +410,7 @@ static int i2c_init_recovery(struct i2c_adapter *adap)

if (!bri->recover_bus) {
err_str = "no suitable method provided";
err_level = KERN_DEBUG;
is_error_level = false;
goto err;
}

Expand All @@ -436,7 +437,10 @@ static int i2c_init_recovery(struct i2c_adapter *adap)

return 0;
err:
dev_printk(err_level, &adap->dev, "Not using recovery: %s\n", err_str);
if (is_error_level)
dev_err(&adap->dev, "Not using recovery: %s\n", err_str);
else
dev_dbg(&adap->dev, "Not using recovery: %s\n", err_str);
adap->bus_recovery_info = NULL;

return -EINVAL;
Expand Down

0 comments on commit cb3c66a

Please sign in to comment.