linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Krzysztof Wilczynski <kw@linux.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Tomasz Duszynski <tduszyns@gmail.com>,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH v2] iio: light: bh1750: Resolve compiler warning and make code more readable
Date: Tue, 10 Sep 2019 23:04:46 +0200	[thread overview]
Message-ID: <20190910210446.6k7nftbfastgpmg5@pengutronix.de> (raw)
In-Reply-To: <20190910203814.31075-1-kw@linux.com>

On Tue, Sep 10, 2019 at 10:38:14PM +0200, Krzysztof Wilczynski wrote:
> Separate the declaration from definition of bh1750_chip_info_tbl
> to make the code more readable.  Separating the code will resolve
> the following compiler warning that can be seen when building
> with warnings enabled (W=1):

This commit log isn't completely accurate. Before we had a definition of
a struct that was instantly (i.e. without repeating the type name) used
as type for an array. (And not a declaration and definition of
bh1750_chip_info_tbl.)

So I'd write:

	Don't mix declaring struct bh1750_chip_info and defining
	bh1750_chip_info_tbl[] in a single statement. This is hard to
	read, with warnings enabled gcc warns about the unusual position
	of the keyword static:
	
		drivers/iio/light/bh1750.c:64:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
	
	and with the empty line this looks as if bh1750_chip_info_tbl
	had no explicit type.

If you want add

	Fixes: 3a11fbb037a1 ("iio: light: add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors")

and add Tomasz Duszynski <tduszyns@gmail.com> to Cc who authored
3a11fbb037a1.

> ---
> Changes in v2:
>   Made definition of bh1750_chip_info_tbl separate from declaration
>   as per the review feedback.  This also makes the code more readable.
>   Updated wording of the subject and the commit message.
> 
>  drivers/iio/light/bh1750.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
> index 28347df78cff..adb5ab9e3439 100644
> --- a/drivers/iio/light/bh1750.c
> +++ b/drivers/iio/light/bh1750.c
> @@ -59,9 +59,9 @@ struct bh1750_chip_info {
>  
>  	u16 int_time_low_mask;
>  	u16 int_time_high_mask;
> -}
> +};
>  
> -static const bh1750_chip_info_tbl[] = {
> +static const struct bh1750_chip_info bh1750_chip_info_tbl[] = {
>  	[BH1710] = { 140, 1022, 300, 400,  250000000, 2, 0x001F, 0x03E0 },
>  	[BH1721] = { 140, 1020, 300, 400,  250000000, 2, 0x0010, 0x03E0 },
>  	[BH1750] = { 31,  254,  69,  1740, 57500000,  1, 0x001F, 0x00E0 },

The patch looks fine. If you adapt the commit log as suggested above
take my

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2019-09-10 21:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02 11:31 [PATCH] iio: light: bh1750: Move static keyword to the front of declaration Krzysztof Wilczynski
2019-09-03 17:35 ` Tomasz Duszynski
2019-09-08 10:49 ` Jonathan Cameron
2019-09-08 13:52   ` Krzysztof Wilczynski
2019-09-10 13:35     ` Jonathan Cameron
2019-09-10 20:25       ` Krzysztof Wilczynski
2019-09-10 20:38 ` [PATCH v2] iio: light: bh1750: Resolve compiler warning and make code more readable Krzysztof Wilczynski
2019-09-10 21:04   ` Uwe Kleine-König [this message]
2019-09-13 20:24   ` [PATCH v3] " Krzysztof Wilczynski
2019-09-15  9:48     ` Jonathan Cameron
2019-09-15 18:41       ` Krzysztof Wilczynski

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=20190910210446.6k7nftbfastgpmg5@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=kw@linux.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=tduszyns@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).