linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: yangyicong <yangyicong@huawei.com>,
	"wsa@kernel.org" <wsa@kernel.org>,
	"andriy.shevchenko@linux.intel.com" 
	<andriy.shevchenko@linux.intel.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"Sergey.Semin@baikalelectronics.ru" 
	<Sergey.Semin@baikalelectronics.ru>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"digetx@gmail.com" <digetx@gmail.com>,
	"treding@nvidia.com" <treding@nvidia.com>,
	"jarkko.nikula@linux.intel.com" <jarkko.nikula@linux.intel.com>,
	"rmk+kernel@armlinux.org.uk" <rmk+kernel@armlinux.org.uk>,
	John Garry <john.garry@huawei.com>,
	"mika.westerberg@linux.intel.com"
	<mika.westerberg@linux.intel.com>,
	"Zengtao (B)" <prime.zeng@hisilicon.com>,
	Linuxarm <linuxarm@huawei.com>
Subject: RE: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string()
Date: Tue, 30 Mar 2021 22:06:56 +0000	[thread overview]
Message-ID: <7e82e13b245a4b11917a2e0191acdb1a@hisilicon.com> (raw)
In-Reply-To: CAHp75VdY58Tm0FDcoVDWuw0LBKUFWC_hBCb5t=4WX_MPzsLvZw@mail.gmail.com



> -----Original Message-----
> From: Song Bao Hua (Barry Song)
> Sent: Wednesday, March 31, 2021 10:54 AM
> To: 'Andy Shevchenko' <andy.shevchenko@gmail.com>
> Cc: yangyicong <yangyicong@huawei.com>; wsa@kernel.org;
> andriy.shevchenko@linux.intel.com; linux-i2c@vger.kernel.org;
> Sergey.Semin@baikalelectronics.ru; linux-kernel@vger.kernel.org;
> digetx@gmail.com; treding@nvidia.com; jarkko.nikula@linux.intel.com;
> rmk+kernel@armlinux.org.uk; John Garry <john.garry@huawei.com>;
> mika.westerberg@linux.intel.com; Zengtao (B) <prime.zeng@hisilicon.com>;
> Linuxarm <linuxarm@huawei.com>
> Subject: RE: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string()
> 
> 
> 
> From: Andy Shevchenko [mailto:andy.shevchenko@gmail.com]
> Sent: Wednesday, March 31, 2021 10:57 AM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Cc: yangyicong <yangyicong@huawei.com>; wsa@kernel.org;
> andriy.shevchenko@linux.intel.com; linux-i2c@vger.kernel.org;
> Sergey.Semin@baikalelectronics.ru; linux-kernel@vger.kernel.org;
> digetx@gmail.com; treding@nvidia.com; jarkko.nikula@linux.intel.com;
> rmk+kernel@armlinux.org.uk; John Garry <john.garry@huawei.com>;
> mika.westerberg@linux.intel.com; Zengtao (B) <prime.zeng@hisilicon.com>;
> Linuxarm <linuxarm@huawei.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@hisilicon.com> wrote:
> 
> 
> > -----Original Message-----
> > From: yangyicong
> > Sent: Wednesday, March 31, 2021 3:19 AM
> > To: wsa@kernel.org; andriy.shevchenko@linux.intel.com;
> > linux-i2c@vger.kernel.org; Sergey.Semin@baikalelectronics.ru;
> > linux-kernel@vger.kernel.org
> > Cc: digetx@gmail.com; treding@nvidia.com; jarkko.nikula@linux.intel.com;
> > rmk+kernel@armlinux.org.uk; Song Bao Hua (Barry Song)
> > <song.bao.hua@hisilicon.com>; John Garry <john.garry@huawei.com>;
> > mika.westerberg@linux.intel.com; yangyicong <yangyicong@huawei.com>;
> Zengtao
> > (B) <prime.zeng@hisilicon.com>; Linuxarm <linuxarm@huawei.com>
> > Subject: [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string()
> >
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > Use generic i2c_freq_mode_string() helper to print chosen bus speed.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Signed-off-by: Yicong Yang <yangyicong@hisilicon.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
> 

Isn't fp_str redundant? Do we need to change

dev_dbg(dev->dev, "Fast Mode:%s HCNT:LCNT = %d:%d\n", fp_str...)

> > +     return 0;
> >  }
> >
> >  /**
> > --
> > 2.8.1
> 
> 
> --
> With Best Regards,
> Andy Shevchenko


  parent reply	other threads:[~2021-03-30 22:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 14:19 [PATCH v5 0/5] Add support for HiSilicon I2C controller Yicong Yang
2021-03-30 14:19 ` [PATCH v5 1/5] i2c: core: add managed function for adding i2c adapters Yicong Yang
2021-03-30 16:28   ` Dmitry Osipenko
2021-03-30 14:19 ` [PATCH v5 2/5] i2c: core: add api to provide frequency mode strings Yicong Yang
2021-03-31  8:35   ` Jarkko Nikula
2021-03-31 13:03     ` Yicong Yang
2021-03-30 14:19 ` [PATCH v5 3/5] i2c: add support for HiSilicon I2C controller Yicong Yang
2021-03-30 16:24   ` Dmitry Osipenko
2021-03-30 16:32     ` Dmitry Osipenko
2021-03-30 16:33   ` Dmitry Osipenko
2021-03-30 14:19 ` [PATCH v5 4/5] MAINTAINERS: Add maintainer for HiSilicon I2C driver Yicong Yang
2021-03-30 14:19 ` [PATCH 5/5] i2c: designware: Switch over to i2c_freq_mode_string() Yicong Yang
2021-03-30 21:36   ` Song Bao Hua (Barry Song)
     [not found]     ` <CAHp75VdY58Tm0FDcoVDWuw0LBKUFWC_hBCb5t=4WX_MPzsLvZw@mail.gmail.com>
2021-03-30 22:01       ` Song Bao Hua (Barry Song)
2021-03-30 22:06       ` Song Bao Hua (Barry Song) [this message]
     [not found]         ` <CAHp75VeTj-wk3WP2-Unoti0+Cajx33b8NOUbBiSBQLmJHn=YAg@mail.gmail.com>
2021-03-31  8:53           ` Song Bao Hua (Barry Song)
2021-03-31 10:19             ` Andy Shevchenko
2021-03-31 10:37   ` Andy Shevchenko
2021-03-31 13:02     ` Yicong Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e82e13b245a4b11917a2e0191acdb1a@hisilicon.com \
    --to=song.bao.hua@hisilicon.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=digetx@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=john.garry@huawei.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=treding@nvidia.com \
    --cc=wsa@kernel.org \
    --cc=yangyicong@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).