From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v1.1 4/5] smiapp: Use runtime PM
Date: Tue, 20 Sep 2016 10:50:26 +0300 [thread overview]
Message-ID: <57E0EA42.8070108@linux.intel.com> (raw)
In-Reply-To: <20160919225127.ncjux2ybgqt66axu@earth>
[-- Attachment #1.1: Type: text/plain, Size: 1726 bytes --]
Hi Sebastian,
Thank you for the review.
On 09/20/16 01:51, Sebastian Reichel wrote:
> Hi,
>
> On Fri, Sep 16, 2016 at 01:53:29AM +0300, Sakari Ailus wrote:
>> [...]
>>
>> diff --git a/drivers/media/i2c/smiapp/smiapp-regs.c b/drivers/media/i2c/smiapp/smiapp-regs.c
>> index 1e501c0..a9c7baf 100644
>> --- a/drivers/media/i2c/smiapp/smiapp-regs.c
>> +++ b/drivers/media/i2c/smiapp/smiapp-regs.c
>> @@ -18,6 +18,7 @@
>>
>> #include <linux/delay.h>
>> #include <linux/i2c.h>
>> +#include <linux/pm_runtime.h>
>>
>> #include "smiapp.h"
>> #include "smiapp-regs.h"
>> @@ -288,8 +289,12 @@ int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 reg, u32 val)
>> */
>> int smiapp_write(struct smiapp_sensor *sensor, u32 reg, u32 val)
>> {
>> + struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
>> int rval;
>>
>> + if (pm_runtime_suspended(&client->dev))
>> + return 0;
>> +
>
> This looks racy. What if idle countdown runs out immediately after
> this check? If you can't call get_sync in this function you can
> call pm_runtime_get() before the suspend check and pm_runtime_put
> before returning from the function, so that the device keeps being
> enabled.
Good point. It was probably late when I wrote the patch. X-)
I guess I need to put pm_runtime_get_noresume() before that, and then
put_autosuspend() it later on.
>
> Also I would expect some error code instead of success for early
> return due to device being suspended?
That's by design.
If the sensor is off, there's no need to write anything there. The
configuration is re-applied to the sensor when it's powered on.
--
Sakari Ailus
sakari.ailus@linux.intel.com
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
next prev parent reply other threads:[~2016-09-20 7:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 11:29 [PATCH 0/5] smiapp: Runtime PM support Sakari Ailus
2016-09-15 11:29 ` [PATCH 1/5] smiapp: Drop BUG_ON() in suspend path Sakari Ailus
2016-09-15 11:29 ` [PATCH 2/5] smiapp: Set device for pixel array and binner Sakari Ailus
2016-09-19 22:55 ` Sebastian Reichel
2016-09-15 11:29 ` [PATCH 3/5] smiapp: Set use suspend and resume ops for other functions Sakari Ailus
2016-09-19 22:54 ` Sebastian Reichel
2016-09-15 11:29 ` [PATCH 4/5] smiapp: Use runtime PM Sakari Ailus
2016-09-15 22:53 ` [PATCH v1.1 " Sakari Ailus
2016-09-19 22:51 ` Sebastian Reichel
2016-09-20 7:50 ` Sakari Ailus [this message]
2016-09-27 13:11 ` Sebastian Reichel
2016-10-03 8:55 ` [PATCH v1.2 " Sakari Ailus
2016-09-15 11:29 ` [PATCH 5/5] smiapp: Implement support for autosuspend Sakari Ailus
2016-09-19 22:53 ` Sebastian Reichel
2016-09-20 12:29 ` [PATCH v1.1 " Sakari Ailus
2016-09-23 0:14 ` Sebastian Reichel
2016-09-23 11:13 ` Sakari Ailus
2016-10-03 8:57 ` [PATCH v1.2 " Sakari Ailus
2016-10-03 9:27 ` [PATCH v1.3 " Sakari Ailus
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=57E0EA42.8070108@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=linux-media@vger.kernel.org \
--cc=sre@kernel.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 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).