mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Chen, Hu" <hu1.chen@intel.com>
Cc: bo.he@intel.com, Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Stephan Gerhold <stephan@gerhold.net>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] io: accel: kxcjk1013: restore the range after resume.
Date: Mon, 4 Mar 2019 10:16:56 +0100	[thread overview]
Message-ID: <23ced5ac-b0a0-7d87-76d7-bdec0c3e0e15@redhat.com> (raw)
In-Reply-To: <20190304070556.24681-1-hu1.chen@intel.com>

Hi,

On 04-03-19 08:05, Chen, Hu wrote:
> From: "he, bo" <bo.he@intel.com>
> 
> On some laptops, kxcjk1013 is powered off when system enters S3. We need
> restore the range regiter during resume. Otherwise, the sensor doesn't
> work properly after S3.
> 
> Signed-off-by: he, bo <bo.he@intel.com>
> Signed-off-by: Chen, Hu <hu1.chen@intel.com>

Thank you for the patch.

> ---
> Changes in v2:
> - Handle return value independently in resume callback.
> 
>   drivers/iio/accel/kxcjk-1013.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index 7096e577b23f..17837e26bcf2 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -1437,6 +1437,11 @@ static int kxcjk1013_resume(struct device *dev)
>   
>   	mutex_lock(&data->mutex);
>   	ret = kxcjk1013_set_mode(data, OPERATION);
> +	if (ret < 0) {
> +		mutex_unlock(&data->mutex);
> +		return ret;
> +	}
> +	ret = kxcjk1013_set_range(data, data->range);
>   	mutex_unlock(&data->mutex);
>   
>   	return ret;


I'm not a fan of the extra unlock, IMHO it would be better to instead do:

  	mutex_lock(&data->mutex);
  	ret = kxcjk1013_set_mode(data, OPERATION);
	if (ret == 0)
		ret = kxcjk1013_set_range(data, data->range);
  	mutex_unlock(&data->mutex);

Regards,

Hans


  reply	other threads:[~2019-03-04  9:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21  3:13 [PATCH] " He, Bo
2019-03-03 16:17 ` Jonathan Cameron
2019-03-04  7:05   ` [PATCH v2] " Chen, Hu
2019-03-04  9:16     ` Hans de Goede [this message]
2019-03-06  2:32       ` [PATCH v3] " Chen, Hu
2019-03-06  8:43         ` Hans de Goede
2019-03-09 17:32           ` 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=23ced5ac-b0a0-7d87-76d7-bdec0c3e0e15@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=bo.he@intel.com \
    --cc=hu1.chen@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=stephan@gerhold.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

all inboxes | Powered by JetHome®