linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Cai Huoqing <cai.huoqing@linux.dev>
Cc: Antoniu Miclaus <antoniu.miclaus@analog.com>,
	robh+dt@kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/2] iio:dac:ad7293: add support for AD7293
Date: Sat, 4 Dec 2021 16:23:20 +0000	[thread overview]
Message-ID: <20211204162252.66e62306@jic23-huawei> (raw)
Message-ID: <20211204162320.9_lz15xiRwUuWN3gmiKaSitE0oJjNoFhOMRHQzieirg@z> (raw)
In-Reply-To: <20211203022204.GA12289@chq-T47>

On Fri, 3 Dec 2021 10:22:04 +0800
Cai Huoqing <cai.huoqing@linux.dev> wrote:

> On 02 12月 21 17:08:18, Antoniu Miclaus wrote:
> > The AD7293 is a Power Amplifier drain current controller
> > containing functionality for general-purpose monitoring
> > and control of current, voltage, and temperature, integrated
> > into a single chip solution with an SPI-compatible interface.
> > 
> > Datasheet:
> > https://www.analog.com/media/en/technical-documentation/data-sheets/AD7293.pdf
> > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>

Hi Antoniu

I've made a bunch of white space tweaks whilst applying this.
A few things to keep in mind for future submissions.

1) Whilst the rule is 100 chars per line, 80 chars is preferred where it
   doesn't hurt readability.
2) Don't do this pattern.
	betty(x, y, z, fred +
	      wilma, barny)

If you have to break fred + wilma, then

	betty(x, y, z,
	      fred +
	      wilma,
	      barny);

is more readable in my view.


Otherwise endian issue in your debugfs functions.  Don't cast pointers like
that...

Please sanity check the changes I made and shout if I messed anything up.

Applied to the togreg branch of iio.git but pushed out as testing first to see
if 0-day finds anything we missed.




> > ---


> > +
> > +static int ad7293_reg_access(struct iio_dev *indio_dev,
> > +			     unsigned int reg,
> > +			     unsigned int write_val,
> > +			     unsigned int *read_val)
> > +{
> > +	struct ad7293_state *st = iio_priv(indio_dev);
> > +	int ret;
> > +
> > +	if (read_val)
> > +		ret = ad7293_spi_read(st, reg, (u16 *)read_val);

This only works on little endian platforms...
Think about where the data ends up on a big endian platform.

I've added a local variable to fix this.

> > +	else
> > +		ret = ad7293_spi_write(st, reg, (u16)write_val);


Jonathan

  reply	other threads:[~2021-12-04 16:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02 15:08 [PATCH v6 1/2] iio:dac:ad7293: add support for AD7293 Antoniu Miclaus
2021-12-02 15:08 ` [PATCH v6 2/2] dt-bindings:iio:dac: add ad7293 doc Antoniu Miclaus
2021-12-10 20:11   ` Rob Herring
2021-12-03  2:22 ` [PATCH v6 1/2] iio:dac:ad7293: add support for AD7293 Cai Huoqing
2021-12-04 16:22   ` Jonathan Cameron [this message]
2021-12-04 16:23     ` 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=20211204162252.66e62306@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=cai.huoqing@linux.dev \
    --cc=devicetree@vger.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 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).