All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Daniel Baluta <daniel.baluta@intel.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH 3/4] staging:iio:ad5933: Report temperature as raw value
Date: Wed, 24 Sep 2014 12:46:38 +0200	[thread overview]
Message-ID: <5422A10E.1070409@metafoo.de> (raw)
In-Reply-To: <CAEnQRZA8t9VbDCe7yUwVTJQNo7fLT9_b6XpxFFjHAfUJojfzMA@mail.gmail.com>

On 09/24/2014 10:02 AM, Daniel Baluta wrote:
>> @@ -543,14 +543,13 @@ static int ad5933_read_raw(struct iio_dev *indio_dev,
>>                  if (ret < 0)
>>                          goto out;
>>                  mutex_unlock(&indio_dev->mlock);
>> -               ret = be16_to_cpu(dat);
>> -               /* Temp in Milli degrees Celsius */
>> -               if (ret < 8192)
>> -                       *val = ret * 1000 / 32;
>> -               else
>> -                       *val = (ret - 16384) * 1000 / 32;
>> +               *val = sign_extend32(be16_to_cpu(dat), 13);
>>
>>                  return IIO_VAL_INT;
>> +       case IIO_CHAN_INFO_SCALE:
>> +               *val = 1000;
>> +               *val2 = 5;
>> +               return IIO_VAL_FRACTIONAL_LOG2;
>>          }
>>
>>   out:
>
> Is it possible to reach this line with mutex not acquired?
>
> out:
>        mutex_unlock(&indio_dev->mlock);
>        return ret;
>

It is not possible, but you are right the code should be restructured to 
make this more clear.

Thanks.
- Lars

  reply	other threads:[~2014-09-24 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 18:04 [PATCH 1/4] staging:iio:ad5933: Fix NULL pointer deref when enabling buffer Lars-Peter Clausen
2014-09-23 18:04 ` [PATCH 2/4] staging:iio:ad5933: Drop "raw" from channel names Lars-Peter Clausen
2014-09-23 18:04 ` [PATCH 3/4] staging:iio:ad5933: Report temperature as raw value Lars-Peter Clausen
2014-09-24  8:02   ` Daniel Baluta
2014-09-24 10:46     ` Lars-Peter Clausen [this message]
2014-09-23 18:04 ` [PATCH 4/4] staging:iio:ad5933: Remove platform data from state struct Lars-Peter Clausen

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=5422A10E.1070409@metafoo.de \
    --to=lars@metafoo.de \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --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 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.