mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mani, Rajmohan" <rajmohan.mani@intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>
Subject: RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
Date: Fri, 28 Jul 2017 23:48:00 +0000	[thread overview]
Message-ID: <6F87890CF0F5204F892DEA1EF0D77A59725DFDAC@FMSMSX114.amr.corp.intel.com> (raw)
In-Reply-To: <CAHp75VffOr0Bs9jXoyF_FACfZCgD+D+tyE7tE_cdVUgZxqQn1g@mail.gmail.com>

Hi Andy,

> Subject: Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
> 
> On Fri, Jul 28, 2017 at 3:30 AM, Mani, Rajmohan
> <rajmohan.mani@intel.com> wrote:
> >> On Wed, Jul 26, 2017 at 11:23 AM, Lee Jones <lee.jones@linaro.org>
> wrote:
> >> > On Tue, 25 Jul 2017, Andy Shevchenko wrote:
> >> >> On Tue, Jul 25, 2017 at 12:10 PM, Lee Jones <lee.jones@linaro.org>
> wrote:
> >>
> >> >> I briefly checked few ->read() and ->write() implementations and
> >> >> didn't find any evidence of positive numbers that can be returned.
> >> >> Documentation (kernel doc) doesn't shed a light on that. So, to me
> >> >> it sounds unspecified.
> >> >>
> >> >> So, for now (until documentation will be fixed) I would rely on if
> >> >> (ret < 0)
> >> >
> >> > It's not unspecified.  The regmap methods call into
> >> > regcache_write(), where the kerneldoc is clear.
> >>
> >
> > Since, we are interested in the regmap for the I2C bus here, I looked
> > into the implementation of
> >  __devm_regmap_init()
> >         __regmap_init()
> >                 regcache_init()
> > for I2C bus.
> >
> > At the end of __devm_regmap_init() call from devm_regmap_init_i2c()
> inside tps68470_probe(), I see that both cache_bypass and defer_caching
> flags of i2c regmap struct are set. So, it looks regcache_write/read calls do
> not come into play here.
> >
> > So, regmap_write()
> >         _regmap_write()
> >                 map->reg_write (drivers/base/regmap/regmap.c:1665) translates
> to
> >                 regmap_i2c_write(drivers/base/regmap/regmap-i2c.c:128)
> >
> > These checks in regmap_i2c_write() ensure all return values from
> i2c_master_send() other than the requested number of bytes to write, are
> converted into negative values.
> >
> >         if (ret == count)
> >                 return 0;
> >         else if (ret < 0)
> >                 return ret;
> >         else
> >                 return -EIO;
> >
> > Similar argument goes for regmap_read() as well.
> > With that, for regmap over I2C bus, it sounds like 'if (ret < 0)' looks to be a
> better choice. Please see if I missed anything here.
> 
> It prooves exactly the Lee's point.
> 
> So, perhaps the best approach is to move to if (ret)  return ret;
> 
> ...if it will be a problem in the future, fix it accordingly.
> 

Ack.
We have spent enough time on this already.

  reply	other threads:[~2017-07-28 23:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-19 23:20 [PATCH v4 0/3] TPS68470 PMIC drivers Rajmohan Mani
2017-07-19 23:20 ` [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Rajmohan Mani
2017-07-20  9:03   ` Lee Jones
2017-07-21  0:57     ` Mani, Rajmohan
2017-07-25  9:10       ` Lee Jones
2017-07-25 10:29         ` Andy Shevchenko
2017-07-26  8:23           ` Lee Jones
2017-07-26 10:26             ` Andy Shevchenko
2017-07-28  0:30               ` Mani, Rajmohan
2017-07-28  9:16                 ` Andy Shevchenko
2017-07-28 23:48                   ` Mani, Rajmohan [this message]
2017-07-25 17:05         ` Mani, Rajmohan
2017-07-26  8:20           ` Lee Jones
2017-07-28 23:49             ` Mani, Rajmohan
2017-07-21 12:26     ` Mani, Rajmohan
2017-07-19 23:20 ` [PATCH v4 2/3] gpio: Add support for TPS68470 GPIOs Rajmohan Mani
2017-07-19 23:20 ` [PATCH v4 3/3] ACPI / PMIC: Add TI PMIC TPS68470 operation region driver Rajmohan Mani

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=6F87890CF0F5204F892DEA1EF0D77A59725DFDAC@FMSMSX114.amr.corp.intel.com \
    --to=rajmohan.mani@intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gnurou@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=lenb@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=sakari.ailus@linux.intel.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

all inboxes | Powered by JetHome®