From: jic23@kernel.org (Jonathan Cameron)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 2/7] iio: adc: meson-saradc: add support for the chip's temperature sensor
Date: Sun, 28 Oct 2018 19:02:23 +0000 [thread overview]
Message-ID: <20181028190223.35fb8f49@archlinux> (raw)
In-Reply-To: <CAFBinCAy_1R01RH=JcT6Fhf_ScDvZ2g3cYdaT-s=VsVQGN+LNg@mail.gmail.com>
On Sun, 28 Oct 2018 18:02:28 +0100
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:
Hi Martin,
..
> > > + if (buf[3] & MESON_SARADC_EFUSE_BYTE3_IS_CALIBRATED)
> > > + priv->temperature_sensor_calibrated = true;
> > > + else
> > > + priv->temperature_sensor_calibrated = false;
> >
> > Could just assign?
> > priv->temperature_sensor_calibrated =
> > buf[3] & MEESON_SARADC_EFUSE_BYTE3_IS_CALIBRATED;
> I could change this but (personal preference here) my eyes are not
> trained to read variable assignments where the value is broken into a
> new line
> looking back at it I could also remove the whole "else" block as
> "false" is obviously the default value
>
> let me know whether you'd like me to change this, then I'll do that for v2
I don't feel strongly on any of the options.. Take your pick!
>
> > > +
> > > + priv->temperature_sensor_coefficient = buf[2] & trimming_mask;
> > > +
> > > + upper_adc_val = FIELD_GET(MESON_SARADC_EFUSE_BYTE3_UPPER_ADC_VAL,
> > > + buf[3]);
> > > +
> > > + priv->temperature_sensor_adc_val = buf[2];
> > > + priv->temperature_sensor_adc_val |= upper_adc_val << BITS_PER_BYTE;
> > > + priv->temperature_sensor_adc_val >>= trimming_bits;
> > > +
> > > + kfree(buf);
> > > +
> > > + return 0;
> > > +}
> > > +
> > ...
>
>
> Regards
> Martin
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org,
linux-iio@vger.kernel.org, robh+dt@kernel.org, pmeerw@pmeerw.net,
lars@metafoo.de, knaack.h@gmx.de, khilman@baylibre.com,
carlo@caione.org
Subject: Re: [PATCH 2/7] iio: adc: meson-saradc: add support for the chip's temperature sensor
Date: Sun, 28 Oct 2018 19:02:23 +0000 [thread overview]
Message-ID: <20181028190223.35fb8f49@archlinux> (raw)
In-Reply-To: <CAFBinCAy_1R01RH=JcT6Fhf_ScDvZ2g3cYdaT-s=VsVQGN+LNg@mail.gmail.com>
On Sun, 28 Oct 2018 18:02:28 +0100
Martin Blumenstingl <martin.blumenstingl@googlemail.com> wrote:
Hi Martin,
..
> > > + if (buf[3] & MESON_SARADC_EFUSE_BYTE3_IS_CALIBRATED)
> > > + priv->temperature_sensor_calibrated = true;
> > > + else
> > > + priv->temperature_sensor_calibrated = false;
> >
> > Could just assign?
> > priv->temperature_sensor_calibrated =
> > buf[3] & MEESON_SARADC_EFUSE_BYTE3_IS_CALIBRATED;
> I could change this but (personal preference here) my eyes are not
> trained to read variable assignments where the value is broken into a
> new line
> looking back at it I could also remove the whole "else" block as
> "false" is obviously the default value
>
> let me know whether you'd like me to change this, then I'll do that for v2
I don't feel strongly on any of the options.. Take your pick!
>
> > > +
> > > + priv->temperature_sensor_coefficient = buf[2] & trimming_mask;
> > > +
> > > + upper_adc_val = FIELD_GET(MESON_SARADC_EFUSE_BYTE3_UPPER_ADC_VAL,
> > > + buf[3]);
> > > +
> > > + priv->temperature_sensor_adc_val = buf[2];
> > > + priv->temperature_sensor_adc_val |= upper_adc_val << BITS_PER_BYTE;
> > > + priv->temperature_sensor_adc_val >>= trimming_bits;
> > > +
> > > + kfree(buf);
> > > +
> > > + return 0;
> > > +}
> > > +
> > ...
>
>
> Regards
> Martin
next prev parent reply other threads:[~2018-10-28 19:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-28 12:26 [PATCH 0/7] meson-saradc: add chip temperature support Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 12:26 ` [PATCH 1/7] dt-bindings: iio: adc: meson-saradc: add temperature sensor support Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 12:26 ` [PATCH 2/7] iio: adc: meson-saradc: add support for the chip's temperature sensor Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 16:19 ` Peter Meerwald-Stadler
2018-10-28 16:19 ` Peter Meerwald-Stadler
2018-10-28 16:47 ` Martin Blumenstingl
2018-10-28 16:47 ` Martin Blumenstingl
2018-10-28 16:35 ` Jonathan Cameron
2018-10-28 16:35 ` Jonathan Cameron
2018-10-28 17:02 ` Martin Blumenstingl
2018-10-28 17:02 ` Martin Blumenstingl
2018-10-28 19:02 ` Jonathan Cameron [this message]
2018-10-28 19:02 ` Jonathan Cameron
2018-10-28 12:26 ` [PATCH 3/7] ARM: dts: meson8: add the temperature calibration data for the SAR ADC Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 12:26 ` [PATCH 4/7] ARM: dts: meson8b: " Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 12:26 ` [PATCH 5/7] ARM: dts: meson8b: ec100: add iio-hwmon for the chip temperature Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 12:26 ` [PATCH 6/7] ARM: dts: meson8b: odroidc1: " Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
2018-10-28 12:26 ` [PATCH 7/7] ARM: dts: meson8m2: mxiii-plus: " Martin Blumenstingl
2018-10-28 12:26 ` Martin Blumenstingl
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=20181028190223.35fb8f49@archlinux \
--to=jic23@kernel.org \
--cc=linus-amlogic@lists.infradead.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.