public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 15/16] iio: temperature: max31856: Use get_unaligned_beXX()
Date: Tue, 21 Apr 2020 03:31:34 +0300	[thread overview]
Message-ID: <20200421003135.23060-15-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20200421003135.23060-1-andriy.shevchenko@linux.intel.com>

This makes the driver code slightly easier to read.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/temperature/max31856.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/temperature/max31856.c b/drivers/iio/temperature/max31856.c
index b4cb21ab2e85..e1966889a962 100644
--- a/drivers/iio/temperature/max31856.c
+++ b/drivers/iio/temperature/max31856.c
@@ -168,7 +168,7 @@ static int max31856_thermocouple_read(struct max31856_data *data,
 		if (ret)
 			return ret;
 		/* Skip last 5 dead bits of LTCBL */
-		*val = (reg_val[0] << 16 | reg_val[1] << 8 | reg_val[2]) >> 5;
+		*val = get_unaligned_be24(&reg_val[0]) >> 5;
 		/* Check 7th bit of LTCBH reg. value for sign*/
 		if (reg_val[0] & 0x80)
 			*val -= 0x80000;
@@ -185,7 +185,7 @@ static int max31856_thermocouple_read(struct max31856_data *data,
 		/* Get Cold Junction Temp. offset register value */
 		offset_cjto = reg_val[0];
 		/* Get CJTH and CJTL value and skip last 2 dead bits of CJTL */
-		*val = (reg_val[1] << 8 | reg_val[2]) >> 2;
+		*val = get_unaligned_be16(&reg_val[1]) >> 2;
 		/* As per datasheet add offset into CJTH and CJTL */
 		*val += offset_cjto;
 		/* Check 7th bit of CJTH reg. value for sign */
-- 
2.26.1


  parent reply	other threads:[~2020-04-21  0:31 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  0:31 [PATCH v1 01/16] iio: adc: ad_sigma_delta: Use {get,put}_unaligned_be24() Andy Shevchenko
2020-04-21  0:31 ` [PATCH v1 02/16] iio: adc: mpc3422: Use get_unaligned_beXX() Andy Shevchenko
2020-04-25 16:14   ` Jonathan Cameron
2020-04-25 16:23     ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 03/16] iio: adc: ti-ads124s08: Use get_unaligned_be24() Andy Shevchenko
2020-04-25 16:24   ` Jonathan Cameron
2020-04-25 17:01     ` Andy Shevchenko
2020-04-21  0:31 ` [PATCH v1 04/16] iio: dac: ltc2632: Use put_unaligned_be24() Andy Shevchenko
2020-04-25 16:26   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 05/16] iio: dac: ad5624r_spi: " Andy Shevchenko
2020-04-21  6:43   ` Sa, Nuno
2020-04-25 16:29     ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 06/16] iio: dac: ad5446: " Andy Shevchenko
2020-04-25 16:31   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 07/16] iio: gyro: adis16130: Use get_unaligned_be24() Andy Shevchenko
2020-04-21  6:39   ` Sa, Nuno
2020-04-25 16:34     ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 08/16] iio: health: afe4403: " Andy Shevchenko
2020-04-25 16:41   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 09/16] iio: light: si1133: " Andy Shevchenko
2020-04-25 16:41   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 10/16] iio: light: zopt2201: Use get_unaligned_le24() Andy Shevchenko
2020-04-25 16:42   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 11/16] iio: magnetometer: rm3100: Use get_unaligned_be24() Andy Shevchenko
2020-04-25 16:44   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 12/16] iio: pressure: hp206c: " Andy Shevchenko
2020-04-25 16:45   ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 13/16] iio: pressure: ms5611: " Andy Shevchenko
2020-04-21  8:36   ` Tomasz Duszynski
2020-04-25 16:48     ` Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 14/16] iio: pressure: zpa2326: Use get_unaligned_le24() Andy Shevchenko
2020-04-25 16:50   ` Jonathan Cameron
2020-04-21  0:31 ` Andy Shevchenko [this message]
2020-04-25 16:51   ` [PATCH v1 15/16] iio: temperature: max31856: Use get_unaligned_beXX() Jonathan Cameron
2020-04-21  0:31 ` [PATCH v1 16/16] iio: st_sensors: Use get_unaligned_be24() and sign_extend32() Andy Shevchenko
2020-04-25 16:53   ` Jonathan Cameron
2020-04-25 17:04     ` Andy Shevchenko
2020-04-21  6:41 ` [PATCH v1 01/16] iio: adc: ad_sigma_delta: Use {get,put}_unaligned_be24() Sa, Nuno
2020-04-25 16:12   ` 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=20200421003135.23060-15-andriy.shevchenko@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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