All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Glauber <jan.glauber@caviumnetworks.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: <linux-kernel@vger.kernel.org>, <linux-i2c@vger.kernel.org>,
	David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH v4 03/14] i2c-octeon: Change adapter timeout and retry default values
Date: Thu, 31 Mar 2016 12:13:19 +0200	[thread overview]
Message-ID: <20160331101319.GA31112@hardcore> (raw)
In-Reply-To: <20160323195517.GE19849@katana>

On Wed, Mar 23, 2016 at 08:55:18PM +0100, Wolfram Sang wrote:
> On Fri, Mar 18, 2016 at 09:46:28AM +0100, Jan Glauber wrote:
> > Convert the adapter timeout to 2 ms instead of a fixed number of
> > jiffies and set retries to 10.
> 
> You describe what you change, but not why this is needed. Why 10
> retries? And shouldn't that be 20ms seeing the HZ/50 ?

The timeout value is not changed, i2c-octeon is bound to Octeon SOC
which has CONFIG_HZ=100. I would prefer to use an absolute value for
a timeout that should not change with the value of CONFIG_HZ.

For the retries, I'll change it to 5 which is what many i2c drivers
use. I thought the reason to use a non-zero value for retries might
be obvious, like "retry in case of a failed operation" ?!

With the updated driver I do not see retry attempts, but it might
not hurt the robustness of the driver to benefit from i2c core
retry logic, or am I missing something?

> Also, please use "i2c: octeon: " as prefix in the subject.

OK.

Thanks,
Jan

> Thanks,
> 
>    Wolfram
> 
> > 
> > Signed-off-by: Jan Glauber <jglauber@cavium.com>
> > ---
> >  drivers/i2c/busses/i2c-octeon.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
> > index 9240037..e616e4c 100644
> > --- a/drivers/i2c/busses/i2c-octeon.c
> > +++ b/drivers/i2c/busses/i2c-octeon.c
> > @@ -414,7 +414,6 @@ static struct i2c_adapter octeon_i2c_ops = {
> >  	.owner = THIS_MODULE,
> >  	.name = "OCTEON adapter",
> >  	.algo = &octeon_i2c_algo,
> > -	.timeout = HZ / 50,
> >  };
> >  
> >  /* calculate and set clock divisors */
> > @@ -541,6 +540,8 @@ static int octeon_i2c_probe(struct platform_device *pdev)
> >  	octeon_i2c_set_clock(i2c);
> >  
> >  	i2c->adap = octeon_i2c_ops;
> > +	i2c->adap.timeout = msecs_to_jiffies(2);
> > +	i2c->adap.retries = 10;
> >  	i2c->adap.dev.parent = &pdev->dev;
> >  	i2c->adap.dev.of_node = node;
> >  	i2c_set_adapdata(&i2c->adap, i2c);
> > -- 
> > 1.9.1
> > 

WARNING: multiple messages have this Message-ID (diff)
From: Jan Glauber <jan.glauber@caviumnetworks.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	David Daney <ddaney@caviumnetworks.com>
Subject: Re: [PATCH v4 03/14] i2c-octeon: Change adapter timeout and retry default values
Date: Thu, 31 Mar 2016 12:13:19 +0200	[thread overview]
Message-ID: <20160331101319.GA31112@hardcore> (raw)
In-Reply-To: <20160323195517.GE19849@katana>

On Wed, Mar 23, 2016 at 08:55:18PM +0100, Wolfram Sang wrote:
> On Fri, Mar 18, 2016 at 09:46:28AM +0100, Jan Glauber wrote:
> > Convert the adapter timeout to 2 ms instead of a fixed number of
> > jiffies and set retries to 10.
> 
> You describe what you change, but not why this is needed. Why 10
> retries? And shouldn't that be 20ms seeing the HZ/50 ?

The timeout value is not changed, i2c-octeon is bound to Octeon SOC
which has CONFIG_HZ=100. I would prefer to use an absolute value for
a timeout that should not change with the value of CONFIG_HZ.

For the retries, I'll change it to 5 which is what many i2c drivers
use. I thought the reason to use a non-zero value for retries might
be obvious, like "retry in case of a failed operation" ?!

With the updated driver I do not see retry attempts, but it might
not hurt the robustness of the driver to benefit from i2c core
retry logic, or am I missing something?

> Also, please use "i2c: octeon: " as prefix in the subject.

OK.

Thanks,
Jan

> Thanks,
> 
>    Wolfram
> 
> > 
> > Signed-off-by: Jan Glauber <jglauber@cavium.com>
> > ---
> >  drivers/i2c/busses/i2c-octeon.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
> > index 9240037..e616e4c 100644
> > --- a/drivers/i2c/busses/i2c-octeon.c
> > +++ b/drivers/i2c/busses/i2c-octeon.c
> > @@ -414,7 +414,6 @@ static struct i2c_adapter octeon_i2c_ops = {
> >  	.owner = THIS_MODULE,
> >  	.name = "OCTEON adapter",
> >  	.algo = &octeon_i2c_algo,
> > -	.timeout = HZ / 50,
> >  };
> >  
> >  /* calculate and set clock divisors */
> > @@ -541,6 +540,8 @@ static int octeon_i2c_probe(struct platform_device *pdev)
> >  	octeon_i2c_set_clock(i2c);
> >  
> >  	i2c->adap = octeon_i2c_ops;
> > +	i2c->adap.timeout = msecs_to_jiffies(2);
> > +	i2c->adap.retries = 10;
> >  	i2c->adap.dev.parent = &pdev->dev;
> >  	i2c->adap.dev.of_node = node;
> >  	i2c_set_adapdata(&i2c->adap, i2c);
> > -- 
> > 1.9.1
> > 

  reply	other threads:[~2016-03-31 10:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  8:46 [PATCH v4 00/14] i2c-octeon and i2c-thunderx drivers Jan Glauber
2016-03-18  8:46 ` [PATCH v4 01/14] i2c-octeon: Cleanup i2c-octeon driver Jan Glauber
2016-03-23 19:51   ` Wolfram Sang
2016-03-18  8:46 ` [PATCH v4 02/14] i2c-octeon: Cleanup resource allocation code Jan Glauber
2016-03-23 19:52   ` Wolfram Sang
2016-03-18  8:46 ` [PATCH v4 03/14] i2c-octeon: Change adapter timeout and retry default values Jan Glauber
2016-03-23 19:55   ` Wolfram Sang
2016-03-31 10:13     ` Jan Glauber [this message]
2016-03-31 10:13       ` Jan Glauber
2016-03-18  8:46 ` [PATCH v4 04/14] i2c-octeon: Support I2C_M_RECV_LEN Jan Glauber
2016-03-23 19:52   ` Wolfram Sang
2016-03-18  8:46 ` [PATCH v4 05/14] i2c-octeon: Enable high-level controller and improve on bus contention Jan Glauber
2016-03-23 20:32   ` Wolfram Sang
2016-03-31 10:24     ` Jan Glauber
2016-03-31 10:24       ` Jan Glauber
2016-03-18  8:46 ` [PATCH v4 06/14] dt-bindings: i2c: Add Octeon cn78xx TWSI Jan Glauber
2016-03-18  8:46 ` [PATCH v4 07/14] i2c-octeon: Add support for cn78xx chips Jan Glauber
2016-03-18  8:46 ` [PATCH v4 08/14] i2c-octeon: Flush TWSI writes with readback Jan Glauber
2016-03-18  8:46 ` [PATCH v4 09/14] i2c-octeon: Faster operation when IFLG signals late Jan Glauber
2016-03-18  8:46 ` [PATCH v4 10/14] i2c-octeon: Add workaround for broken irqs on CN3860 Jan Glauber
2016-03-18  8:46 ` [PATCH v4 11/14] i2c-octeon: Rename driver to prepare for split Jan Glauber
2016-03-18 17:11   ` David Daney
2016-03-18 17:11     ` David Daney
2016-03-18  8:46 ` [PATCH v4 12/14] i2c-octeon: Split the driver into two parts Jan Glauber
2016-03-18  8:46 ` [PATCH v4 13/14] i2c-thunderx: Add i2c driver for ThunderX SOC Jan Glauber
2016-03-18  8:46 ` [PATCH v4 14/14] i2c-thunderx: Add smbus alert support Jan Glauber

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=20160331101319.GA31112@hardcore \
    --to=jan.glauber@caviumnetworks.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.