[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4f6313fb620d4823bacf548224a29477@hisilicon.com>
Date: Tue, 30 Mar 2021 22:01:08 +0000
From: "Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: yangyicong <yangyicong@...wei.com>,
"wsa@...nel.org" <wsa@...nel.org>,
"andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"Sergey.Semin@...kalelectronics.ru"
<Sergey.Semin@...kalelectronics.ru>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"digetx@...il.com" <digetx@...il.com>,
"treding@...dia.com" <treding@...dia.com>,
"jarkko.nikula@...ux.intel.com" <jarkko.nikula@...ux.intel.com>,
"rmk+kernel@...linux.org.uk" <rmk+kernel@...linux.org.uk>,
John Garry <john.garry@...wei.com>,
"mika.westerberg@...ux.intel.com" <mika.westerberg@...ux.intel.com>,
"Zengtao (B)" <prime.zeng@...ilicon.com>,
Linuxarm <linuxarm@...wei.com>
Subject: RE: [PATCH 5/5] i2c: designware: Switch over to
i2c_freq_mode_string()
From: Andy Shevchenko [mailto:andy.shevchenko@...il.com]
Sent: Wednesday, March 31, 2021 10:57 AM
To: Song Bao Hua (Barry Song) <song.bao.hua@...ilicon.com>
Cc: yangyicong <yangyicong@...wei.com>; wsa@...nel.org; andriy.shevchenko@...ux.intel.com; linux-i2c@...r.kernel.org; Sergey.Semin@...kalelectronics.ru; linux-kernel@...r.kernel.org; digetx@...il.com; treding@...dia.com; jarkko.nikula@...ux.intel.com; rmk+kernel@...linux.org.uk; John Garry <john.garry@...wei.com>; mika.westerberg@...ux.intel.com; Zengtao (B) <prime.zeng@...ilicon.com>; Linuxarm <linuxarm@...wei.com>
Subject: Re: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string()
On Wednesday, March 31, 2021, Song Bao Hua (Barry Song) <song.bao.hua@...ilicon.com> wrote:
> -----Original Message-----
> From: yangyicong
> Sent: Wednesday, March 31, 2021 3:19 AM
> To: wsa@...nel.org; andriy.shevchenko@...ux.intel.com;
> linux-i2c@...r.kernel.org; Sergey.Semin@...kalelectronics.ru;
> linux-kernel@...r.kernel.org
> Cc: digetx@...il.com; treding@...dia.com; jarkko.nikula@...ux.intel.com;
> rmk+kernel@...linux.org.uk; Song Bao Hua (Barry Song)
> <song.bao.hua@...ilicon.com>; John Garry <john.garry@...wei.com>;
> mika.westerberg@...ux.intel.com; yangyicong <yangyicong@...wei.com>; Zengtao
> (B) <prime.zeng@...ilicon.com>; Linuxarm <linuxarm@...wei.com>
> Subject: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string()
>
> From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>
> Use generic i2c_freq_mode_string() helper to print chosen bus speed.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Signed-off-by: Yicong Yang <yangyicong@...ilicon.com>
> ---
> drivers/i2c/busses/i2c-designware-master.c | 20 ++++----------------
> 1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-master.c
> b/drivers/i2c/busses/i2c-designware-master.c
> index dd27b9d..b64c4c8 100644
> --- a/drivers/i2c/busses/i2c-designware-master.c
> +++ b/drivers/i2c/busses/i2c-designware-master.c
> @@ -35,10 +35,10 @@ static void i2c_dw_configure_fifo_master(struct dw_i2c_dev
> *dev)
>
> static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev)
> {
> - const char *mode_str, *fp_str = "";
> u32 comp_param1;
> u32 sda_falling_time, scl_falling_time;
> struct i2c_timings *t = &dev->timings;
> + const char *fp_str = "";
> u32 ic_clk;
> int ret;
>
> @@ -153,22 +153,10 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev
> *dev)
>
> ret = i2c_dw_set_sda_hold(dev);
> if (ret)
> - goto out;
> -
> - switch (dev->master_cfg & DW_IC_CON_SPEED_MASK) {
> - case DW_IC_CON_SPEED_STD:
> - mode_str = "Standard Mode";
> - break;
> - case DW_IC_CON_SPEED_HIGH:
> - mode_str = "High Speed Mode";
> - break;
> - default:
> - mode_str = "Fast Mode";
> - }
> - dev_dbg(dev->dev, "Bus speed: %s%s\n", mode_str, fp_str);
> + return ret;
>
> -out:
> - return ret;
> + dev_dbg(dev->dev, "Bus speed: %s\n",
> i2c_freq_mode_string(t->bus_freq_hz));
> Weird the original code was printing both mode and fp.
> And you are printing mode only.
>> Sorry, but I didn’t get what you mean here. The code is equivalent, and actually it will print even more.
The original code will print the string fp_str:
%s%s\n", mode_str, fp_str
The new code is printing mode_str only:
%s
> + return 0;
> }
>
> /**
> --
> 2.8.1
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists