mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: light: vcnl4035: Propagate regcache_sync() errors
@ 2026-07-04  7:14 Pengpeng Hou
  2026-07-04 12:11 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Pengpeng Hou @ 2026-07-04  7:14 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Matti Vaittinen, Sakari Ailus, linux-iio, linux-kernel
  Cc: Pengpeng Hou

vcnl4035_runtime_suspend() marks the regmap cache dirty before runtime
suspend. vcnl4035_runtime_resume() then syncs the cache before re-
enabling ALS, but currently ignores a regcache_sync() failure and can
still report resume success.

Return the regcache_sync() error so the PM core sees the failed register
restore.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/iio/light/vcnl4035.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c
index bf3a49b4351d..3ca7ccdb7f15 100644
--- a/drivers/iio/light/vcnl4035.c
+++ b/drivers/iio/light/vcnl4035.c
@@ -647,7 +647,9 @@ static int vcnl4035_runtime_resume(struct device *dev)
 	struct vcnl4035_data *data = iio_priv(indio_dev);
 	int ret;
 
-	regcache_sync(data->regmap);
+	ret = regcache_sync(data->regmap);
+	if (ret < 0)
+		return ret;
 	ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_ENABLE);
 	if (ret < 0)
 		return ret;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: light: vcnl4035: Propagate regcache_sync() errors
  2026-07-04  7:14 [PATCH] iio: light: vcnl4035: Propagate regcache_sync() errors Pengpeng Hou
@ 2026-07-04 12:11 ` Andy Shevchenko
  2026-07-11 22:37   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-07-04 12:11 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Matti Vaittinen, Sakari Ailus, linux-iio, linux-kernel

On Sat, Jul 04, 2026 at 03:14:10PM +0800, Pengpeng Hou wrote:
> vcnl4035_runtime_suspend() marks the regmap cache dirty before runtime
> suspend. vcnl4035_runtime_resume() then syncs the cache before re-
> enabling ALS, but currently ignores a regcache_sync() failure and can
> still report resume success.
> 
> Return the regcache_sync() error so the PM core sees the failed register
> restore.

...

> -	regcache_sync(data->regmap);
> +	ret = regcache_sync(data->regmap);
> +	if (ret < 0)
> +		return ret;

When do like this, add a blank line.
Same comment to all similar patches you sent (or about to send).

>  	ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_ENABLE);
>  	if (ret < 0)
>  		return ret;

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: light: vcnl4035: Propagate regcache_sync() errors
  2026-07-04 12:11 ` Andy Shevchenko
@ 2026-07-11 22:37   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-07-11 22:37 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Pengpeng Hou, David Lechner, Nuno Sá,
	Andy Shevchenko, Uwe Kleine-König (The Capable Hub),
	Matti Vaittinen, Sakari Ailus, linux-iio, linux-kernel

On Sat, 4 Jul 2026 15:11:14 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Sat, Jul 04, 2026 at 03:14:10PM +0800, Pengpeng Hou wrote:
> > vcnl4035_runtime_suspend() marks the regmap cache dirty before runtime
> > suspend. vcnl4035_runtime_resume() then syncs the cache before re-
> > enabling ALS, but currently ignores a regcache_sync() failure and can
> > still report resume success.
> > 
> > Return the regcache_sync() error so the PM core sees the failed register
> > restore.  
> 
> ...
> 
> > -	regcache_sync(data->regmap);
> > +	ret = regcache_sync(data->regmap);
> > +	if (ret < 0)
> > +		return ret;  
> 
> When do like this, add a blank line.
> Same comment to all similar patches you sent (or about to send).
On this occasion I fixed up and applied rather than waiting for a v2.
Applied to the testing branch of iio.git.

Thanks,

Jonathan

> 
> >  	ret = vcnl4035_set_als_power_state(data, VCNL4035_MODE_ALS_ENABLE);
> >  	if (ret < 0)
> >  		return ret;  
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-11 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-04  7:14 [PATCH] iio: light: vcnl4035: Propagate regcache_sync() errors Pengpeng Hou
2026-07-04 12:11 ` Andy Shevchenko
2026-07-11 22:37   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox