linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Russ Dill <Russ.Dill@ti.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>,
	Jonathan Cameron <jic23@cam.ac.uk>,
	"Patil, Rachna" <rachna@ti.com>,
	linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Koen Kooi <koen@dominion.thruhere.net>,
	Matt Porter <mporter@ti.com>,
	linux-omap@vger.kernel.org
Subject: Re: [PATCH] ti_tscadc: Match mfd sub devices to regmap interface
Date: Tue, 30 Oct 2012 22:51:31 -0700	[thread overview]
Message-ID: <20121031055131.GB31983@core.coreip.homeip.net> (raw)
In-Reply-To: <CA+Bv8XbCweGxKg-VsM2=g5KJEbLZhUA8F=iAG2st7c0JRLH58g@mail.gmail.com>

On Tue, Oct 30, 2012 at 09:41:00PM -0700, Russ Dill wrote:
> On Wed, Oct 31, 2012 at 8:55 AM, Pantelis Antoniou
> <panto@antoniou-consulting.com> wrote:
> > The MFD parent device now uses a regmap, instead of direct
> > memory access. Use the same method in the sub devices to avoid
> > nasty surprises.
> >
> > Also rework the channel initialization of tiadc a bit.
> >
> > Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> > ---
> >  drivers/iio/adc/ti_am335x_adc.c           | 27 +++++++++++++++++++--------
> >  drivers/input/touchscreen/ti_am335x_tsc.c | 16 +++++++++++++---
> >  drivers/mfd/ti_am335x_tscadc.c            |  7 +++++--
> >  3 files changed, 37 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> > index d48fd79..5f325c1 100644
> > --- a/drivers/iio/adc/ti_am335x_adc.c
> > +++ b/drivers/iio/adc/ti_am335x_adc.c
> > @@ -23,7 +23,9 @@
> >  #include <linux/iio/iio.h>
> >  #include <linux/iio/machine.h>
> >  #include <linux/iio/driver.h>
> > +#include <linux/regmap.h>
> >
> > +#include <linux/io.h>
> >  #include <linux/mfd/ti_am335x_tscadc.h>
> >  #include <linux/platform_data/ti_am335x_adc.h>
> >
> > @@ -36,13 +38,17 @@ struct tiadc_device {
> >
> >  static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg)
> >  {
> > -       return readl(adc->mfd_tscadc->tscadc_base + reg);
> > +       unsigned int val;
> > +
> > +       val = (unsigned int)-1;
> > +       regmap_read(adc->mfd_tscadc->regmap_tscadc, reg, &val);
> > +       return val;
> >  }
> 
> Would it be cleaner to instead do:
> 
> static unsigned int tiadc_readl(struct tiadc_device *adc, unsigned int reg)
> {
>        unsigned int val;
> 
>        return regmap_read(adc->mfd_tscadc->regmap_tscadc, reg, &val) ? : val;
> }
> 
> or
>        int ret;
> 
>        ret = regmap_read(adc->mfd_tscadc->regmap_tscadc, reg, &val);
>        return ret < 0 ret ? : val;

Also the function should not be returning unsigned int if it returns
errors.

Thanks.

-- 
Dmitry

  reply	other threads:[~2012-10-31  5:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 15:55 [PATCH] ti_tscadc: Match mfd sub devices to regmap interface Pantelis Antoniou
     [not found] ` <1351698945-3881-1-git-send-email-panto-wVdstyuyKrO8r51toPun2/C9HSW9iNxf@public.gmane.org>
2012-10-30 18:21   ` Lars-Peter Clausen
2012-10-30 18:30     ` Pantelis Antoniou
2012-10-31  4:41 ` Russ Dill
2012-10-31  5:51   ` Dmitry Torokhov [this message]
2012-10-31  8:12   ` Lars-Peter Clausen

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=20121031055131.GB31983@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=Russ.Dill@ti.com \
    --cc=jic23@cam.ac.uk \
    --cc=koen@dominion.thruhere.net \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mporter@ti.com \
    --cc=panto@antoniou-consulting.com \
    --cc=rachna@ti.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).