public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: magnetometer: fix if () scoped_guard() formatting
@ 2024-11-08 15:41 Przemek Kitszel
  2024-11-08 18:02 ` Jonathan Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Przemek Kitszel @ 2024-11-08 15:41 UTC (permalink / raw)
  To: megi, Jonathan Cameron
  Cc: Lars-Peter Clausen, linux-iio, Thomas Gleixner, Ingo Molnar, hpa,
	Peter Zijlstra, linux-kernel, Stephen Rothwell, kernel test robot,
	Przemek Kitszel

From: Stephen Rothwell <sfr@canb.auug.org.au>

Add mising braces after an if condition that contains scoped_guard().

This style is both preferred and necessary here, to fix warning after
scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
scoped_guard() macros to avoid potential warning") to have if-else inside
of the macro. Current (no braces) use in af8133j_set_scale() yields
the following warnings:
af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
---
I have forgot to add this patch prior to the cited Fixes: commit,
so Stephen Rothwell had to reinvent it, in order to fix linux-next.
original posting by Stephen Rothwell:
https://lore.kernel.org/lkml/20241028165336.7b46ce25@canb.auug.org.au/
---
 drivers/iio/magnetometer/af8133j.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/af8133j.c b/drivers/iio/magnetometer/af8133j.c
index d81d89af6283..acd291f3e792 100644
--- a/drivers/iio/magnetometer/af8133j.c
+++ b/drivers/iio/magnetometer/af8133j.c
@@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
 	 * When suspended, just store the new range to data->range to be
 	 * applied later during power up.
 	 */
-	if (!pm_runtime_status_suspended(dev))
+	if (!pm_runtime_status_suspended(dev)) {
 		scoped_guard(mutex, &data->mutex)
 			ret = regmap_write(data->regmap,
 					   AF8133J_REG_RANGE, range);
+	}
 
 	pm_runtime_enable(dev);
 
-- 
2.46.0


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

* Re: [PATCH] iio: magnetometer: fix if () scoped_guard() formatting
  2024-11-08 15:41 [PATCH] iio: magnetometer: fix if () scoped_guard() formatting Przemek Kitszel
@ 2024-11-08 18:02 ` Jonathan Cameron
  2024-11-09 11:27   ` Jonathan Cameron
  2024-11-09 17:15 ` Markus Elfring
  2024-11-11 10:58 ` [tip: locking/core] " tip-bot2 for Stephen Rothwell
  2 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2024-11-08 18:02 UTC (permalink / raw)
  To: Przemek Kitszel
  Cc: megi, Jonathan Cameron, Lars-Peter Clausen, linux-iio,
	Thomas Gleixner, Ingo Molnar, hpa, Peter Zijlstra, linux-kernel,
	Stephen Rothwell, kernel test robot

On Fri,  8 Nov 2024 16:41:27 +0100
Przemek Kitszel <przemyslaw.kitszel@intel.com> wrote:

> From: Stephen Rothwell <sfr@canb.auug.org.au>
> 
> Add mising braces after an if condition that contains scoped_guard().
> 
> This style is both preferred and necessary here, to fix warning after
> scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
> scoped_guard() macros to avoid potential warning") to have if-else inside
> of the macro. Current (no braces) use in af8133j_set_scale() yields
> the following warnings:
> af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
> af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
> 
> Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> ---
> I have forgot to add this patch prior to the cited Fixes: commit,
> so Stephen Rothwell had to reinvent it, in order to fix linux-next.
> original posting by Stephen Rothwell:
> https://lore.kernel.org/lkml/20241028165336.7b46ce25@canb.auug.org.au/
> ---
>  drivers/iio/magnetometer/af8133j.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/magnetometer/af8133j.c b/drivers/iio/magnetometer/af8133j.c
> index d81d89af6283..acd291f3e792 100644
> --- a/drivers/iio/magnetometer/af8133j.c
> +++ b/drivers/iio/magnetometer/af8133j.c
> @@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
>  	 * When suspended, just store the new range to data->range to be
>  	 * applied later during power up.
>  	 */
> -	if (!pm_runtime_status_suspended(dev))
> +	if (!pm_runtime_status_suspended(dev)) {

I thought I replied to say don't do it this way. Ah well probably went astray
as I was having some email issues yesterday.

		guard(mutex)(&data->mutex);
		ret = regmap_write...

>  		scoped_guard(mutex, &data->mutex)
>  			ret = regmap_write(data->regmap,
>  					   AF8133J_REG_RANGE, range);
> +	}
>  
>  	pm_runtime_enable(dev);
>  


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

* Re: [PATCH] iio: magnetometer: fix if () scoped_guard() formatting
  2024-11-08 18:02 ` Jonathan Cameron
@ 2024-11-09 11:27   ` Jonathan Cameron
  2024-11-11  9:16     ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2024-11-09 11:27 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Przemek Kitszel, megi, Lars-Peter Clausen, linux-iio,
	Thomas Gleixner, Ingo Molnar, hpa, Peter Zijlstra, linux-kernel,
	Stephen Rothwell, kernel test robot

On Fri, 8 Nov 2024 18:02:43 +0000
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:

> On Fri,  8 Nov 2024 16:41:27 +0100
> Przemek Kitszel <przemyslaw.kitszel@intel.com> wrote:
> 
> > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > 
> > Add mising braces after an if condition that contains scoped_guard().
> > 
> > This style is both preferred and necessary here, to fix warning after
> > scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
> > scoped_guard() macros to avoid potential warning") to have if-else inside
> > of the macro. Current (no braces) use in af8133j_set_scale() yields
> > the following warnings:
> > af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
> > af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
> > 
> > Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
> > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > ---
> > I have forgot to add this patch prior to the cited Fixes: commit,
> > so Stephen Rothwell had to reinvent it, in order to fix linux-next.
> > original posting by Stephen Rothwell:
> > https://lore.kernel.org/lkml/20241028165336.7b46ce25@canb.auug.org.au/
> > ---
> >  drivers/iio/magnetometer/af8133j.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/magnetometer/af8133j.c b/drivers/iio/magnetometer/af8133j.c
> > index d81d89af6283..acd291f3e792 100644
> > --- a/drivers/iio/magnetometer/af8133j.c
> > +++ b/drivers/iio/magnetometer/af8133j.c
> > @@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
> >  	 * When suspended, just store the new range to data->range to be
> >  	 * applied later during power up.
> >  	 */
> > -	if (!pm_runtime_status_suspended(dev))
> > +	if (!pm_runtime_status_suspended(dev)) {  
> 
> I thought I replied to say don't do it this way. Ah well probably went astray
> as I was having some email issues yesterday.
> 
Also, for the fixes tag to make sense this will need got through the same tree as
that rather than IIO which doesn't have that commit yet.

Given timing I'm fine with this version getting picked up and if I care enough
I can chase it with a tidy up to the guard() form next cycle.  

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>


Jonathan

> 		guard(mutex)(&data->mutex);
> 		ret = regmap_write...
> 
> >  		scoped_guard(mutex, &data->mutex)
> >  			ret = regmap_write(data->regmap,
> >  					   AF8133J_REG_RANGE, range);
> > +	}
> >  
> >  	pm_runtime_enable(dev);
> >    
> 


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

* Re: [PATCH] iio: magnetometer: fix if () scoped_guard() formatting
  2024-11-08 15:41 [PATCH] iio: magnetometer: fix if () scoped_guard() formatting Przemek Kitszel
  2024-11-08 18:02 ` Jonathan Cameron
@ 2024-11-09 17:15 ` Markus Elfring
  2024-11-11 10:58 ` [tip: locking/core] " tip-bot2 for Stephen Rothwell
  2 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2024-11-09 17:15 UTC (permalink / raw)
  To: Przemek Kitszel, Stephen Rothwell, linux-iio, Jonathan Cameron,
	Ondřej Jirman
  Cc: LKML, lkp, H. Peter Anvin, Ingo Molnar, Lars-Peter Clausen,
	Peter Zijlstra, Thomas Gleixner

> Add mising braces after an if condition that contains scoped_guard().
…

      missing?


Regards,
Markus

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

* Re: [PATCH] iio: magnetometer: fix if () scoped_guard() formatting
  2024-11-09 11:27   ` Jonathan Cameron
@ 2024-11-11  9:16     ` Peter Zijlstra
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Zijlstra @ 2024-11-11  9:16 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, Przemek Kitszel, megi, Lars-Peter Clausen,
	linux-iio, Thomas Gleixner, Ingo Molnar, hpa, linux-kernel,
	Stephen Rothwell, kernel test robot

On Sat, Nov 09, 2024 at 11:27:41AM +0000, Jonathan Cameron wrote:
> On Fri, 8 Nov 2024 18:02:43 +0000
> Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
> 
> > On Fri,  8 Nov 2024 16:41:27 +0100
> > Przemek Kitszel <przemyslaw.kitszel@intel.com> wrote:
> > 
> > > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > > 
> > > Add mising braces after an if condition that contains scoped_guard().
> > > 
> > > This style is both preferred and necessary here, to fix warning after
> > > scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
> > > scoped_guard() macros to avoid potential warning") to have if-else inside
> > > of the macro. Current (no braces) use in af8133j_set_scale() yields
> > > the following warnings:
> > > af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
> > > af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
> > > 
> > > Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
> > > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> > > ---
> > > I have forgot to add this patch prior to the cited Fixes: commit,
> > > so Stephen Rothwell had to reinvent it, in order to fix linux-next.
> > > original posting by Stephen Rothwell:
> > > https://lore.kernel.org/lkml/20241028165336.7b46ce25@canb.auug.org.au/
> > > ---
> > >  drivers/iio/magnetometer/af8133j.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/iio/magnetometer/af8133j.c b/drivers/iio/magnetometer/af8133j.c
> > > index d81d89af6283..acd291f3e792 100644
> > > --- a/drivers/iio/magnetometer/af8133j.c
> > > +++ b/drivers/iio/magnetometer/af8133j.c
> > > @@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
> > >  	 * When suspended, just store the new range to data->range to be
> > >  	 * applied later during power up.
> > >  	 */
> > > -	if (!pm_runtime_status_suspended(dev))
> > > +	if (!pm_runtime_status_suspended(dev)) {  
> > 
> > I thought I replied to say don't do it this way. Ah well probably went astray
> > as I was having some email issues yesterday.
> > 
> Also, for the fixes tag to make sense this will need got through the same tree as
> that rather than IIO which doesn't have that commit yet.
> 
> Given timing I'm fine with this version getting picked up and if I care enough
> I can chase it with a tidy up to the guard() form next cycle.  
> 
> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 

Thanks, I'll stick it in the locking tree then.

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

* [tip: locking/core] iio: magnetometer: fix if () scoped_guard() formatting
  2024-11-08 15:41 [PATCH] iio: magnetometer: fix if () scoped_guard() formatting Przemek Kitszel
  2024-11-08 18:02 ` Jonathan Cameron
  2024-11-09 17:15 ` Markus Elfring
@ 2024-11-11 10:58 ` tip-bot2 for Stephen Rothwell
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Stephen Rothwell @ 2024-11-11 10:58 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kernel test robot, Stephen Rothwell, Przemek Kitszel,
	Peter Zijlstra (Intel), Jonathan Cameron, x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     9a884bdb6e9560c6da44052d5248e89d78c983a6
Gitweb:        https://git.kernel.org/tip/9a884bdb6e9560c6da44052d5248e89d78c983a6
Author:        Stephen Rothwell <sfr@canb.auug.org.au>
AuthorDate:    Fri, 08 Nov 2024 16:41:27 +01:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 11 Nov 2024 11:49:47 +01:00

iio: magnetometer: fix if () scoped_guard() formatting

Add mising braces after an if condition that contains scoped_guard().

This style is both preferred and necessary here, to fix warning after
scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
scoped_guard() macros to avoid potential warning") to have if-else inside
of the macro. Current (no braces) use in af8133j_set_scale() yields
the following warnings:
af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]

Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20241108154258.21411-1-przemyslaw.kitszel@intel.com
---
 drivers/iio/magnetometer/af8133j.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/magnetometer/af8133j.c b/drivers/iio/magnetometer/af8133j.c
index d81d89a..acd291f 100644
--- a/drivers/iio/magnetometer/af8133j.c
+++ b/drivers/iio/magnetometer/af8133j.c
@@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
 	 * When suspended, just store the new range to data->range to be
 	 * applied later during power up.
 	 */
-	if (!pm_runtime_status_suspended(dev))
+	if (!pm_runtime_status_suspended(dev)) {
 		scoped_guard(mutex, &data->mutex)
 			ret = regmap_write(data->regmap,
 					   AF8133J_REG_RANGE, range);
+	}
 
 	pm_runtime_enable(dev);
 

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

end of thread, other threads:[~2024-11-11 10:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08 15:41 [PATCH] iio: magnetometer: fix if () scoped_guard() formatting Przemek Kitszel
2024-11-08 18:02 ` Jonathan Cameron
2024-11-09 11:27   ` Jonathan Cameron
2024-11-11  9:16     ` Peter Zijlstra
2024-11-09 17:15 ` Markus Elfring
2024-11-11 10:58 ` [tip: locking/core] " tip-bot2 for Stephen Rothwell

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