diff mbox series

[v2,07/10] iio: pressure: mprls0025pa.c whitespace cleanup

Message ID 20231224143500.10940-8-petre.rodan@subdimension.ro (mailing list archive)
State Changes Requested
Headers show
Series changes to mprls0025pa | expand

Commit Message

Petre Rodan Dec. 24, 2023, 2:34 p.m. UTC
Fix indentation and whitespace in code that will not get refactored.

Make URL inside comment copy-paste friendly.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
---
 drivers/iio/pressure/mprls0025pa.c | 38 ++++++++++++++----------------
 1 file changed, 18 insertions(+), 20 deletions(-)

--
2.41.0

Comments

Andy Shevchenko Dec. 27, 2023, 4:34 p.m. UTC | #1
On Sun, Dec 24, 2023 at 04:34:52PM +0200, Petre Rodan wrote:
> Fix indentation and whitespace in code that will not get refactored.
> 
> Make URL inside comment copy-paste friendly.

>  			return dev_err_probe(dev, ret,
> -				"honeywell,pmin-pascal could not be read\n");
> +				   "honeywell,pmin-pascal could not be read\n");

As done elsewhere, here and in other similar places fix the indentation
by making first character on the latter line to be in the same column as
the first character after the opening parenthesis.

			return dev_err_probe(dev, ret,
					     "honeywell,pmin-pascal could not be read\n");
Petre Rodan Dec. 27, 2023, 5:39 p.m. UTC | #2
On Wed, Dec 27, 2023 at 06:34:25PM +0200, Andy Shevchenko wrote:
> On Sun, Dec 24, 2023 at 04:34:52PM +0200, Petre Rodan wrote:
> > Fix indentation and whitespace in code that will not get refactored.
> > 
> > Make URL inside comment copy-paste friendly.
> 
> >  			return dev_err_probe(dev, ret,
> > -				"honeywell,pmin-pascal could not be read\n");
> > +				   "honeywell,pmin-pascal could not be read\n");
> 
> As done elsewhere, here and in other similar places fix the indentation
> by making first character on the latter line to be in the same column as
> the first character after the opening parenthesis.

I triple-checked that I am following the max 80 column rule, the parenthesis
rule and the 'do not split printk messages' rules in all my code in these 10 patches.
precisely so I don't get feedback like this one.
if the parenthesis rule makes the line longer then 80 chars I right-align to
column 80 as seen above.
that is what I understand from the latest coding style document and that is what
I will follow.

in this particular case if I were to ignore the 80 column rule we would end up on
column 90 if I were to follow your feedback (open parenthesis is at column 45
and the error takes 45 chars more).

peter
Jonathan Cameron Dec. 30, 2023, 11:33 a.m. UTC | #3
On Wed, 27 Dec 2023 19:39:28 +0200
Petre Rodan <petre.rodan@subdimension.ro> wrote:

> On Wed, Dec 27, 2023 at 06:34:25PM +0200, Andy Shevchenko wrote:
> > On Sun, Dec 24, 2023 at 04:34:52PM +0200, Petre Rodan wrote:  
> > > Fix indentation and whitespace in code that will not get refactored.
> > > 
> > > Make URL inside comment copy-paste friendly.  
> >   
> > >  			return dev_err_probe(dev, ret,
> > > -				"honeywell,pmin-pascal could not be read\n");
> > > +				   "honeywell,pmin-pascal could not be read\n");  
> > 
> > As done elsewhere, here and in other similar places fix the indentation
> > by making first character on the latter line to be in the same column as
> > the first character after the opening parenthesis.  
> 
> I triple-checked that I am following the max 80 column rule, the parenthesis
> rule and the 'do not split printk messages' rules in all my code in these 10 patches.
> precisely so I don't get feedback like this one.
> if the parenthesis rule makes the line longer then 80 chars I right-align to
> column 80 as seen above.

I'm not aware of (and can't immediately see) anything about right aligning to 80
columns.  It's fine to align it less if line length is long but normally people
go with aligning to one tab more than the start of the block.

> that is what I understand from the latest coding style document and that is what
> I will follow.
> 
> in this particular case if I were to ignore the 80 column rule we would end up on
> column 90 if I were to follow your feedback (open parenthesis is at column 45
> and the error takes 45 chars more).

It's fine to do this in the interests of readability.

People differ in opinion on what constitutes 'significant readability' and I'd
be happy with either a shorter alignment (single tab more than line above)
or going over 80 chars in this case.

Jonathan

> 
> peter
>
Andy Shevchenko Jan. 6, 2024, 2:03 p.m. UTC | #4
On Wed, Dec 27, 2023 at 07:39:28PM +0200, Petre Rodan wrote:
> On Wed, Dec 27, 2023 at 06:34:25PM +0200, Andy Shevchenko wrote:
> > On Sun, Dec 24, 2023 at 04:34:52PM +0200, Petre Rodan wrote:
> > > Fix indentation and whitespace in code that will not get refactored.
> > > 
> > > Make URL inside comment copy-paste friendly.
> > 
> > >  			return dev_err_probe(dev, ret,
> > > -				"honeywell,pmin-pascal could not be read\n");
> > > +				   "honeywell,pmin-pascal could not be read\n");
> > 
> > As done elsewhere, here and in other similar places fix the indentation
> > by making first character on the latter line to be in the same column as
> > the first character after the opening parenthesis.
> 
> I triple-checked that I am following the max 80 column rule, the parenthesis
> rule and the 'do not split printk messages' rules in all my code in these 10 patches.
> precisely so I don't get feedback like this one.
> if the parenthesis rule makes the line longer then 80 chars I right-align to
> column 80 as seen above.
> that is what I understand from the latest coding style document and that is what
> I will follow.
> 
> in this particular case if I were to ignore the 80 column rule we would end up on
> column 90 if I were to follow your feedback (open parenthesis is at column 45
> and the error takes 45 chars more).

checkpatch has got an exceptional rule _not_ to warn on the long string
literals for 10+ years. It had happened much earlier than 100 relaxation one.
diff mbox series

Patch

diff --git a/drivers/iio/pressure/mprls0025pa.c b/drivers/iio/pressure/mprls0025pa.c
index 63c46592956f..e14cdee7989f 100644
--- a/drivers/iio/pressure/mprls0025pa.c
+++ b/drivers/iio/pressure/mprls0025pa.c
@@ -5,10 +5,7 @@ 
  * Copyright (c) Andreas Klinger <ak@it-klinger.de>
  *
  * Data sheet:
- *  https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/
- *    products/sensors/pressure-sensors/board-mount-pressure-sensors/
- *    micropressure-mpr-series/documents/
- *    sps-siot-mpr-series-datasheet-32332628-ciid-172626.pdf
+ *  https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/micropressure-mpr-series/documents/sps-siot-mpr-series-datasheet-32332628-ciid-172626.pdf
  *
  * 7-bit I2C default slave address: 0x18
  */
@@ -84,9 +81,9 @@  struct mpr_func_spec {
 };

 static const struct mpr_func_spec mpr_func_spec[] = {
-	[MPR_FUNCTION_A] = {.output_min = 1677722, .output_max = 15099494},
-	[MPR_FUNCTION_B] = {.output_min =  419430, .output_max =  3774874},
-	[MPR_FUNCTION_C] = {.output_min = 3355443, .output_max = 13421773},
+	[MPR_FUNCTION_A] = { .output_min = 1677722, .output_max = 15099494 },
+	[MPR_FUNCTION_B] = { .output_min =  419430, .output_max =  3774874 },
+	[MPR_FUNCTION_C] = { .output_min = 3355443, .output_max = 13421773 },
 };

 struct mpr_chan {
@@ -273,7 +270,7 @@  static irqreturn_t mpr_trigger_handler(int irq, void *p)
 		goto err;

 	iio_push_to_buffers_with_timestamp(indio_dev, &data->chan,
-						iio_get_time_ns(indio_dev));
+					   iio_get_time_ns(indio_dev));

 err:
 	mutex_unlock(&data->lock);
@@ -355,15 +352,16 @@  static int mpr_probe(struct i2c_client *client)

 	if (dev_fwnode(dev)) {
 		ret = device_property_read_u32(dev, "honeywell,pmin-pascal",
-								&data->pmin);
+					       &data->pmin);
 		if (ret)
 			return dev_err_probe(dev, ret,
-				"honeywell,pmin-pascal could not be read\n");
+				   "honeywell,pmin-pascal could not be read\n");
+
 		ret = device_property_read_u32(dev, "honeywell,pmax-pascal",
-								&data->pmax);
+					       &data->pmax);
 		if (ret)
 			return dev_err_probe(dev, ret,
-				"honeywell,pmax-pascal could not be read\n");
+				   "honeywell,pmax-pascal could not be read\n");
 		ret = device_property_read_u32(dev,
 				"honeywell,transfer-function", &func);
 		if (ret)
@@ -384,14 +382,14 @@  static int mpr_probe(struct i2c_client *client)

 	/* use 64 bit calculation for preserving a reasonable precision */
 	scale = div_s64(((s64)(data->pmax - data->pmin)) * NANO,
-						data->outmax - data->outmin);
+			data->outmax - data->outmin);
 	data->scale = div_s64_rem(scale, NANO, &data->scale2);
 	/*
 	 * multiply with NANO before dividing by scale and later divide by NANO
 	 * again.
 	 */
 	offset = ((-1LL) * (s64)data->outmin) * NANO -
-			div_s64(div_s64((s64)data->pmin * NANO, scale), NANO);
+		  div_s64(div_s64((s64)data->pmin * NANO, scale), NANO);
 	data->offset = div_s64_rem(offset, NANO, &data->offset2);

 	if (data->irq > 0) {
@@ -399,27 +397,27 @@  static int mpr_probe(struct i2c_client *client)
 				IRQF_TRIGGER_RISING, client->name, data);
 		if (ret)
 			return dev_err_probe(dev, ret,
-				"request irq %d failed\n", data->irq);
+					  "request irq %d failed\n", data->irq);
 	}

 	data->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
-							GPIOD_OUT_HIGH);
+						    GPIOD_OUT_HIGH);
 	if (IS_ERR(data->gpiod_reset))
 		return dev_err_probe(dev, PTR_ERR(data->gpiod_reset),
-						"request reset-gpio failed\n");
+				     "request reset-gpio failed\n");

 	mpr_reset(data);

 	ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL,
-						mpr_trigger_handler, NULL);
+					      mpr_trigger_handler, NULL);
 	if (ret)
 		return dev_err_probe(dev, ret,
-					"iio triggered buffer setup failed\n");
+				     "iio triggered buffer setup failed\n");

 	ret = devm_iio_device_register(dev, indio_dev);
 	if (ret)
 		return dev_err_probe(dev, ret,
-					"unable to register iio device\n");
+				     "unable to register iio device\n");

 	return 0;
 }