Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: magnetometer: ak8975: remove unnecessary braces
@ 2026-04-17 13:02 Joshua Crofts
  2026-04-17 18:30 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Joshua Crofts @ 2026-04-17 13:02 UTC (permalink / raw)
  To: jic23; +Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, Joshua Crofts

Remove unnecessary braces at single if statement block.

No functional change.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 drivers/iio/magnetometer/ak8975.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
index d30315ad85..443011748b 100644
--- a/drivers/iio/magnetometer/ak8975.c
+++ b/drivers/iio/magnetometer/ak8975.c
@@ -541,9 +541,9 @@ static int ak8975_set_mode(struct ak8975_data *data, enum ak_ctrl_mode mode)
 		 data->def->ctrl_modes[mode];
 	ret = i2c_smbus_write_byte_data(data->client,
 					data->def->ctrl_regs[CNTL], regval);
-	if (ret < 0) {
+	if (ret < 0)
 		return ret;
-	}
+
 	data->cntl_cache = regval;
 	/* After mode change wait atleast 100us */
 	usleep_range(100, 500);
-- 
2.47.3


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

* Re: [PATCH] iio: magnetometer: ak8975: remove unnecessary braces
  2026-04-17 13:02 [PATCH] iio: magnetometer: ak8975: remove unnecessary braces Joshua Crofts
@ 2026-04-17 18:30 ` Andy Shevchenko
  2026-04-19 16:19   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2026-04-17 18:30 UTC (permalink / raw)
  To: Joshua Crofts; +Cc: jic23, dlechner, nuno.sa, andy, linux-iio, linux-kernel

On Fri, Apr 17, 2026 at 01:02:24PM +0000, Joshua Crofts wrote:
> Remove unnecessary braces at single if statement block.
> 
> No functional change.

Code wise is good, but I think it's an unneeded churn as a standalone change.
Up to Jonathan.

...

>  	ret = i2c_smbus_write_byte_data(data->client,
>  					data->def->ctrl_regs[CNTL], regval);
> -	if (ret < 0) {
> +	if (ret < 0)
>  		return ret;
> -	}
> +
>  	data->cntl_cache = regval;
>  	/* After mode change wait atleast 100us */

Side note: you can also fix a typo (missing space) and

>  	usleep_range(100, 500);

move the driver to use fsleep().

(In a separate change.)

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] iio: magnetometer: ak8975: remove unnecessary braces
  2026-04-17 18:30 ` Andy Shevchenko
@ 2026-04-19 16:19   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2026-04-19 16:19 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Joshua Crofts, dlechner, nuno.sa, andy, linux-iio, linux-kernel

On Fri, 17 Apr 2026 21:30:14 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Apr 17, 2026 at 01:02:24PM +0000, Joshua Crofts wrote:
> > Remove unnecessary braces at single if statement block.
> > 
> > No functional change.  
> 
> Code wise is good, but I think it's an unneeded churn as a standalone change.
> Up to Jonathan.
Whilst it's churn it's very localized and unlikely to cause us much trouble
so I've taken it.

Other comments below make sense for follow up patches.

thanks,

Jonathan

> 
> ...
> 
> >  	ret = i2c_smbus_write_byte_data(data->client,
> >  					data->def->ctrl_regs[CNTL], regval);
> > -	if (ret < 0) {
> > +	if (ret < 0)
> >  		return ret;
> > -	}
> > +
> >  	data->cntl_cache = regval;
> >  	/* After mode change wait atleast 100us */  
> 
> Side note: you can also fix a typo (missing space) and
> 
> >  	usleep_range(100, 500);  
> 
> move the driver to use fsleep().
> 
> (In a separate change.)
> 


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

end of thread, other threads:[~2026-04-19 16:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17 13:02 [PATCH] iio: magnetometer: ak8975: remove unnecessary braces Joshua Crofts
2026-04-17 18:30 ` Andy Shevchenko
2026-04-19 16:19   ` Jonathan Cameron

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