All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishant Malpani <nish.malpani25@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	"Bogdan, Dragos" <dragos.bogdan@analog.com>,
	Darius <darius.berghe@analog.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] iio: gyro: adxrs290: Add debugfs register access support
Date: Thu, 3 Sep 2020 19:26:53 +0530	[thread overview]
Message-ID: <CAEtfd9ZPkyk9_GV3h-CXFT_j=PYU66SHoYaaE7tytQxb+Q5rVA@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VfReT-EjCV=cW8mV1MmoMPPdY9q1scoPwbD_DEHpQHd3g@mail.gmail.com>

Hello,

On Thu, Sep 3, 2020 at 6:55 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Thu, Sep 3, 2020 at 4:10 PM Nishant Malpani <nish.malpani25@gmail.com> wrote:
> >
> > Extend support to read/write byte data from/to the device using
> > debugfs iio interface.
>
> ...
>
> > +static int adxrs290_reg_access(struct iio_dev *indio_dev, unsigned int reg,
> > +                              unsigned int writeval, unsigned int *readval)
> > +{
> > +       struct adxrs290_state *st = iio_priv(indio_dev);
> > +       int ret;
> > +
> > +       if (!readval)
> > +               return adxrs290_spi_write_reg(st->spi, reg, writeval);
> > +
> > +       ret = spi_w8r8(st->spi, ADXRS290_READ_REG(reg));
> > +       if (ret < 0)
> > +               return ret;
> > +
> > +       *readval = ret;
> > +
> > +       return 0;
> > +}
>
> Hmm... I would suggest to have it like
>
> adxrs290_reg_access_rw()
> {
>  ...
>  return 0;
> }
>
> adxrs290_reg_access()
> {
>  if (readval)
>   return adxrs290_reg_access_rw();
>  else // it's redundant, but someone can use for better formatting
>   return adxrs290_spi_write_reg();
> }

Umm, I'm sorry, I don't see why'd it be favourable for us to do it
this way. Also, I *think* Jonathan is fine with how it's being done
now.

With regards,
Nishant Malpani

>
> --
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2020-09-03 14:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 13:09 [PATCH v2 0/3] iio: gyro: adxrs290: Add triggered buffer & debugfs support Nishant Malpani
2020-09-03 13:09 ` [PATCH v2 1/3] iio: gyro: adxrs290: Add triggered buffer support Nishant Malpani
2020-09-03 13:20   ` Andy Shevchenko
2020-09-03 13:46     ` Nishant Malpani
2020-09-06 14:59   ` Jonathan Cameron
2020-09-03 13:09 ` [PATCH v2 2/3] dt-bindings: iio: gyro: adxrs290: Add interrupts support Nishant Malpani
2020-09-06 15:01   ` Jonathan Cameron
2020-09-03 13:09 ` [PATCH v2 3/3] iio: gyro: adxrs290: Add debugfs register access support Nishant Malpani
2020-09-03 13:25   ` Andy Shevchenko
2020-09-03 13:56     ` Nishant Malpani [this message]
2020-09-03 13:59       ` Andy Shevchenko
2020-09-06 15:03         ` Jonathan Cameron

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='CAEtfd9ZPkyk9_GV3h-CXFT_j=PYU66SHoYaaE7tytQxb+Q5rVA@mail.gmail.com' \
    --to=nish.malpani25@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=darius.berghe@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dragos.bogdan@analog.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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.