Hi, On 25/07/2018 17:39:27+0300, Andy Shevchenko wrote: > There is better for debug purposes, easy to grep, and for reader to see > what speed we configure, if we use full name of the mode in case of Fast > Plus one. As a side effect we may get rid of temporary variable. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/i2c/busses/i2c-designware-master.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c > index eec038624b37..690eb607eda8 100644 > --- a/drivers/i2c/busses/i2c-designware-master.c > +++ b/drivers/i2c/busses/i2c-designware-master.c > @@ -48,7 +48,7 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev *dev) > static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) > { > u32 ic_clk = i2c_dw_clk_rate(dev); > - const char *mode_str, *fp_str = ""; > + const char *mode_str; > u32 comp_param1; > u32 sda_falling_time, scl_falling_time; > struct i2c_timings *t = &dev->timings; > @@ -94,7 +94,6 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) > if (dev->fp_hcnt && dev->fp_lcnt) { > dev->fs_hcnt = dev->fp_hcnt; > dev->fs_lcnt = dev->fp_lcnt; > - fp_str = " Plus"; > } > } > /* > @@ -114,8 +113,13 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) > scl_falling_time, > 0); /* No offset */ > } > - dev_dbg(dev->dev, "Fast Mode%s HCNT:LCNT = %d:%d\n", > - fp_str, dev->fs_hcnt, dev->fs_lcnt); > + if (dev->fp_hcnt && dev->fp_lcnt) { > + dev_dbg(dev->dev, "Fast Mode Plus HCNT:LCNT = %d:%d\n", > + dev->fs_hcnt, dev->fs_lcnt); > + } else { > + dev_dbg(dev->dev, "Fast Mode HCNT:LCNT = %d:%d\n", > + dev->fs_hcnt, dev->fs_lcnt); > + } As this duplicates strings, I'm pretty sure Wolfram doesn't like that: https://events.static.linuxfound.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf ;) > > /* Check is high speed possible and fall back to fast mode if not */ > if ((dev->master_cfg & DW_IC_CON_SPEED_MASK) == > @@ -145,9 +149,13 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) > mode_str = "High Speed Mode"; > break; > default: > - mode_str = "Fast Mode"; > + if (dev->fp_hcnt && dev->fp_lcnt) > + mode_str = "Fast Mode Plus"; > + else > + mode_str = "Fast Mode"; > + break; > } > - dev_dbg(dev->dev, "Bus speed: %s%s\n", mode_str, fp_str); > + dev_dbg(dev->dev, "Bus speed: %s\n", mode_str); > > out: > return ret; > -- > 2.18.0 > -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com