[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190908114944.18bb78e3@archlinux>
Date: Sun, 8 Sep 2019 11:49:44 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Krzysztof Wilczynski <kw@...ux.com>
Cc: Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iio: light: bh1750: Move static keyword to the front of
declaration
On Mon, 2 Sep 2019 13:31:32 +0200
Krzysztof Wilczynski <kw@...ux.com> wrote:
> Move the static keyword to the front of declaration of
> bh1750_chip_info_tbl, and resolve the following compiler
> warning that can be seen when building with warnings
> enabled (W=1):
>
> drivers/iio/light/bh1750.c:64:1: warning:
> ‘static’ is not at beginning of declaration [-Wold-style-declaration]
>
> Signed-off-by: Krzysztof Wilczynski <kw@...ux.com>
This one has me confused. The warning seems to be false as static
is at the beginning of the declaration....
Sure we "could" combine the declaration with the definition as you have
done here, but that has nothing much to do with the warning.
What am I missing?
Jonathan
> ---
> Related: https://lore.kernel.org/r/20190827233017.GK9987@google.com
>
> drivers/iio/light/bh1750.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c
> index 28347df78cff..460c0013f1a9 100644
> --- a/drivers/iio/light/bh1750.c
> +++ b/drivers/iio/light/bh1750.c
> @@ -42,7 +42,7 @@ struct bh1750_data {
> u16 mtreg;
> };
>
> -struct bh1750_chip_info {
> +static const struct bh1750_chip_info {
> u16 mtreg_min;
> u16 mtreg_max;
> u16 mtreg_default;
> @@ -59,9 +59,7 @@ struct bh1750_chip_info {
>
> u16 int_time_low_mask;
> u16 int_time_high_mask;
> -}
> -
> -static const bh1750_chip_info_tbl[] = {
Looks like the beginning fo the declaration to me!
Jonathan
> +} 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 },
Powered by blists - more mailing lists