linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Puranjay Mohan <puranjay12@gmail.com>,
	alexandru.ardelean@analog.com, jic23@kernel.org,
	devicetree@vger.kernel.org, knaack.h@gmx.de,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	andy.shevchenko@gmail.com
Subject: Re: [PATCH v3 2/2] iio: temperature: add driver support for ti tmp117
Date: Wed, 7 Apr 2021 06:56:42 +0200	[thread overview]
Message-ID: <3d840334-2c26-5748-8370-54cef6262e02@metafoo.de> (raw)
In-Reply-To: <20210406182852.263605-3-puranjay12@gmail.com>

On 4/6/21 8:28 PM, Puranjay Mohan wrote:
> +
> +static int tmp117_write_raw(struct iio_dev *indio_dev,
> +		struct iio_chan_spec const *channel, int val,
> +		int val2, long mask)
> +{
> +	struct tmp117_data *data = iio_priv(indio_dev);
> +	s16 off;
> +
> +	switch (mask) {
> +	case IIO_CHAN_INFO_CALIBBIAS:
> +		off = clamp(val, -32768, 32767);
> +		if (off == data->calibbias)

data->calibbias is only set in probe() and always 0. I'm not sure we 
need to cache the value. Reading it back from the device seems fine.

> +			return 0;
> +		return i2c_smbus_write_word_swapped(data->client,
> +						TMP117_REG_TEMP_OFFSET, off);
> +
> +	default:
> +		return -EINVAL;
> +	}
> +}
> +


  reply	other threads:[~2021-04-07  4:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 18:28 [PATCH v3 0/2] iio: temperature: add support for tmp117 Puranjay Mohan
2021-04-06 18:28 ` [PATCH v3 1/2] dt-bindings: iio: temperature: Add DT bindings for TMP117 Puranjay Mohan
2021-04-06 18:28 ` [PATCH v3 2/2] iio: temperature: add driver support for ti tmp117 Puranjay Mohan
2021-04-07  4:56   ` Lars-Peter Clausen [this message]
2021-04-07  5:13     ` Puranjay Mohan

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=3d840334-2c26-5748-8370-54cef6262e02@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alexandru.ardelean@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=puranjay12@gmail.com \
    /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).