All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] iio: addac: stx104: Improve indentation in stx104_write_raw()
Date: Wed, 5 Apr 2023 12:11:51 -0400	[thread overview]
Message-ID: <ZC2dx2LCLdkEUh02@fedora> (raw)
In-Reply-To: <ZC02QAYZodp/cgi5@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

On Wed, Apr 05, 2023 at 11:50:08AM +0300, Andy Shevchenko wrote:
> On Tue, Apr 04, 2023 at 10:12:00AM -0400, William Breathitt Gray wrote:
> > By bailing out early if chan->output is false for the IIO_CHAN_INFO_RAW,
> > indentation can be decreased by a tab and code readability improved.
> 
> ...
> 
> > +		/* DAC can only accept up to a 16-bit value */
> > +		if ((unsigned int)val > 65535)
> > +			return -EINVAL;
> 
> While the patch is good per se, I don't like two things (which are also in the
> original code):
> - explicit casting (can it be avoided?)

We could explicitly check for negative instead:

    if (val < 0 || val > 65535)

Would that be better?

> - would be good to have U16_MAX or ?.. instead of hard coded number

Fair point, I'll use U16_MAX then.

> Can it be addressed with (additional) patches?

Sure, I'll submit a separate patch to address this.

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-04-05 16:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 14:11 [PATCH v4 0/5] Migrate STX104 to the regmap API William Breathitt Gray
2023-04-04 14:11 ` [PATCH v4 1/5] iio: addac: stx104: Fix race condition for stx104_write_raw() William Breathitt Gray
2023-04-04 14:11 ` [PATCH v4 2/5] iio: addac: stx104: Fix race condition when converting analog-to-digital William Breathitt Gray
2023-04-04 14:12 ` [PATCH v4 3/5] iio: addac: stx104: Improve indentation in stx104_write_raw() William Breathitt Gray
2023-04-05  8:50   ` Andy Shevchenko
2023-04-05 16:11     ` William Breathitt Gray [this message]
2023-04-04 14:12 ` [PATCH v4 4/5] iio: addac: stx104: Migrate to the regmap API William Breathitt Gray
2023-04-04 14:12 ` [PATCH v4 5/5] iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll William Breathitt Gray
2023-04-05  8:54   ` Andy Shevchenko

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=ZC2dx2LCLdkEUh02@fedora \
    --to=william.gray@linaro.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.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.