linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Ranostay <matt.ranostay@konsulko.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH v2 3/3] iio: chemical: atlas-ezo-sensor: add support for O2 sensor
Date: Tue, 21 Jul 2020 21:38:11 -0700	[thread overview]
Message-ID: <CAJCx=g=+zunxptnoLva7VGXqkU0Kwn9xxkTjKeO0F1VeXwSTTw@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VcuwLoX5Xxb-BGPKE6BWnDJq=O5knV6u8wWXYsLHfGL9Q@mail.gmail.com>

On Tue, Jul 21, 2020 at 11:46 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Mon, Jul 20, 2020 at 10:05 AM Matt Ranostay
> <matt.ranostay@konsulko.com> wrote:
> >
> > Add support for the Atlas EZO O2 chemical sensor which required
> > some refactoring of the driver and parsing of i2c transfer.
> >
> > Sensor data is converted by the scaling value from percent to
> > IIO_CONCENTRATION.
>
> ...
>
> > +static void atlas_ezo_sanitize(char *buf)
> > +{
> > +       char *ptr = strchr(buf, '.');
> > +
> > +       if (!ptr)
> > +               return;
> > +
> > +       for (; *ptr; ptr++)
> > +               *ptr = *(ptr + 1);
> > +}
>
> NIH of memmove()? Why?

Mainly since I forgot that POSIX function. I'll fix it up when possible

- Matt

>
> And actually to avoid strlen() you may do it other way around, i.e
> shift integer part one character right and return new buffer pointer.
>
>
> if (!ptr)
>   return buf;
>
> memmove(buf + 1, buf, ptr - buf);
> return buf + 1;
>
> --
> With Best Regards,
> Andy Shevchenko

  parent reply	other threads:[~2020-07-22  4:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20  7:03 [PATCH v2 0/3] iio: chemical: atlas-ezo-sensor: add support for O2 sensor Matt Ranostay
2020-07-20  7:03 ` [PATCH v2 1/3] iio: add IIO_MOD_O2 modifier Matt Ranostay
2020-07-20  7:03 ` [PATCH v2 2/3] dt-bindings: iio: chemical: add O2 EZO module documentation Matt Ranostay
2020-07-23 17:47   ` Rob Herring
2020-07-26 12:34     ` Jonathan Cameron
2020-07-20  7:03 ` [PATCH v2 3/3] iio: chemical: atlas-ezo-sensor: add support for O2 sensor Matt Ranostay
2020-07-21 18:46   ` Andy Shevchenko
2020-07-21 18:47     ` Andy Shevchenko
2020-07-22  4:38     ` Matt Ranostay [this message]
2020-07-22 13:39       ` Jonathan Cameron
2020-07-20  8:47 ` [PATCH v2 0/3] " 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='CAJCx=g=+zunxptnoLva7VGXqkU0Kwn9xxkTjKeO0F1VeXwSTTw@mail.gmail.com' \
    --to=matt.ranostay@konsulko.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@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 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).