Re: [PATCH] iio: light: bh1750: Move static keyword to the front of declaration

From: Krzysztof Wilczynski
Date: Sun Sep 08 2019 - 09:52:16 EST

Hello Jonathan,

Thank you for feedback.

> > drivers/iio/light/bh1750.c:64:1: warning:
> > âstaticâ is not at beginning of declaration [-Wold-style-declaration]
> 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.

I only moved the "static const" at the front, I haven't changed the
code as it's already has been a declaration and definition. There is
no semicolon there and the original author put a newline to separate
things which makes it look as if these were separate.

Simple example based on the existing code:

I hope this helps to illustrate the change in the patch. I apologise
if my approach was incorrect.

As part of the patch I removed the newline in an aim to make it less
confusing to anyone who will read the code in the future. Especially,
since it makes it a bit awkward to read and when using things like