All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Frey <dpfrey@gmail.com>
To: Himanshu Jha <himanshujha199640@gmail.com>
Cc: linux-iio@vger.kernel.org, jic23@kernel.org
Subject: Re: [PATCH v3 2/7] iio: chemical: bme680: cleanup bme680_read_calib formatting
Date: Mon, 20 Aug 2018 12:24:43 -0700	[thread overview]
Message-ID: <78bee2e8-c686-b2d1-b2c7-1681764095e4@gmail.com> (raw)
In-Reply-To: <20180818110655.GC24920@himanshu-Vostro-3559>

On 8/18/2018 4:06 AM, Himanshu Jha wrote:
> On Fri, Aug 17, 2018 at 12:03:14PM -0700, David Frey wrote:
>> Signed-off-by: David Frey <dpfrey@gmail.com>
> 
> One minor comment below.

<snip>

>> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
>> index 35cbcb16c9f9..cde08d57e7d5 100644
>> --- a/drivers/iio/chemical/bme680_core.c
>> +++ b/drivers/iio/chemical/bme680_core.c
<snip>
>> @@ -208,30 +200,26 @@ static int bme680_read_calib(struct bme680_data *data,
>>  		dev_err(dev, "failed to read BME680_H1_MSB_REG\n");
>>  		return ret;
>>  	}
>> -
>>  	ret = regmap_read(data->regmap, BME680_H1_LSB_REG, &tmp_lsb);
>>  	if (ret < 0) {
>>  		dev_err(dev, "failed to read BME680_H1_LSB_REG\n");
>>  		return ret;
>>  	}
>> -
>>  	calib->par_h1 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
>> -				(tmp_lsb & BME680_BIT_H1_DATA_MSK);
>> +	                (tmp_lsb & BME680_BIT_H1_DATA_MSK);
> 
> Prefer tabs instead of spaces!
> Please run checkpatch on the patch to get those warnings.

Thanks for telling me about the existence of checkpatch.pl.  The
official docs
(https://www.kernel.org/doc/html/v4.18/process/coding-style.html) are
pretty light on information about indentation/alignment, but there is
this relevant quote: "Outside of comments, documentation and except in
Kconfig, spaces are never used for indentation, and the above example is
deliberately broken."

I thought that the way I indented it was optimal because I used spaces a
tab for indentation and then spaces for alignment, but checkpatch.pl
seems to disagree.  Based on a quick read of the code, it seems that it
will complain about more than 7 spaces in a row.

I guess you could achieve visually identical alignment (where "------->"
is tab and "_" is space) and this would still pass checkpatch.pl.  Note
that I changed the identifier name slightly to demonstrate a mix of tabs
and spaces.

------->calib->par_h123 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
------->------->------->__(tmp_lsb & BME680_BIT_H1_DATA_MSK);

What I don't understand is the logic used to justify the original
indentation:
------->calib->par_h1 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
------->------->------->------->(tmp_lsb & BME680_BIT_H1_DATA_MSK);

Why not?
------->calib->par_h1 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
------->------->------->(tmp_lsb & BME680_BIT_H1_DATA_MSK);

Or?
------->calib->par_h1 = (tmp_msb << BME680_HUM_REG_SHIFT_VAL) |
------->------->(tmp_lsb & BME680_BIT_H1_DATA_MSK);

I'm not trying to turn this into a crazy bike shedding thread.  I just
want to understand the rules a bit better.

Thanks,
David

  parent reply	other threads:[~2018-08-20 19:24 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-17 19:03 [PATCH v3 0/7] bme680 cleanup David Frey
2018-08-17 19:03 ` [PATCH v3 1/7] iio: chemical: bme680: use clamp macro David Frey
2018-08-18 11:03   ` Himanshu Jha
2018-08-19 15:47     ` Jonathan Cameron
2018-08-20 17:18       ` David Frey
2018-08-20 17:55         ` Himanshu Jha
2018-08-20 17:58         ` Jonathan Cameron
2018-08-17 19:03 ` [PATCH v3 2/7] iio: chemical: bme680: cleanup bme680_read_calib formatting David Frey
2018-08-18 11:06   ` Himanshu Jha
2018-08-19 15:54     ` Jonathan Cameron
2018-08-19 17:18       ` Himanshu Jha
2018-08-20 19:24     ` David Frey [this message]
2018-08-21 18:46       ` Himanshu Jha
2018-08-17 19:03 ` [PATCH v3 3/7] iio: chemical: bme680: indent #defines consistently David Frey
2018-08-18 11:07   ` Himanshu Jha
2018-08-19 16:02     ` Jonathan Cameron
2018-08-19 17:28       ` Himanshu Jha
2018-08-19 19:14         ` Jonathan Cameron
2018-08-20 15:37           ` Himanshu Jha
2018-08-20 17:39           ` [PATCH] iio: chemical: bme680: Remove field value defines David Frey
2018-08-22 10:44             ` Himanshu Jha
2018-08-25  8:14               ` Jonathan Cameron
2018-08-17 19:03 ` [PATCH v3 4/7] iio: chemical: bme680: change MSK->MASK in #defines David Frey
2018-08-18 11:09   ` Himanshu Jha
2018-08-19 16:05     ` Jonathan Cameron
2018-08-17 19:03 ` [PATCH v3 5/7] iio: chemical: bme680: use GENMASK macro David Frey
2018-08-18 11:09   ` Himanshu Jha
2018-08-19 16:07     ` Jonathan Cameron
2018-08-17 19:03 ` [PATCH v3 6/7] iio: chemical: bme680: use FIELD_GET macro David Frey
2018-08-18 11:10   ` Himanshu Jha
2018-08-19 16:08     ` Jonathan Cameron
2018-08-17 19:03 ` [PATCH v3 7/7] iio: chemical: bme680: simplify oversampling handling David Frey
2018-08-18 11:17   ` Himanshu Jha
2018-08-19 16:14     ` Jonathan Cameron

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=78bee2e8-c686-b2d1-b2c7-1681764095e4@gmail.com \
    --to=dpfrey@gmail.com \
    --cc=himanshujha199640@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.