netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: cx89x0: move attribute declaration before struct keyword
@ 2017-04-17  6:20 Stefan Agner
  2017-04-17 20:09 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2017-04-17  6:20 UTC (permalink / raw)
  To: davem; +Cc: shc_work, jarod, netdev, linux-kernel, Stefan Agner

The attribute declaration is typically before the definition. Move
the __maybe_unused attribute declaration before the struct keyword.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/net/ethernet/cirrus/cs89x0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cirrus/cs89x0.c b/drivers/net/ethernet/cirrus/cs89x0.c
index 3647b28e8de0..9be1d3babb7a 100644
--- a/drivers/net/ethernet/cirrus/cs89x0.c
+++ b/drivers/net/ethernet/cirrus/cs89x0.c
@@ -1896,7 +1896,7 @@ static int cs89x0_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct __maybe_unused of_device_id cs89x0_match[] = {
+static const __maybe_unused struct of_device_id cs89x0_match[] = {
 	{ .compatible = "cirrus,cs8900", },
 	{ .compatible = "cirrus,cs8920", },
 	{ },
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: cx89x0: move attribute declaration before struct keyword
  2017-04-17  6:20 [PATCH] net: cx89x0: move attribute declaration before struct keyword Stefan Agner
@ 2017-04-17 20:09 ` David Miller
  2017-04-17 20:31   ` Stefan Agner
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2017-04-17 20:09 UTC (permalink / raw)
  To: stefan; +Cc: shc_work, jarod, netdev, linux-kernel

From: Stefan Agner <stefan@agner.ch>
Date: Sun, 16 Apr 2017 23:20:32 -0700

> The attribute declaration is typically before the definition. Move
> the __maybe_unused attribute declaration before the struct keyword.
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>

Well, I see if just as often after the variable name too:

net/irda/iriap.c:static const char *const ias_charset_types[] __maybe_unused = {
net/irda/irlap.c:static const char *const lap_reasons[] __maybe_unused = {
net/irda/irlap_event.c:static const char *const irlap_event[] __maybe_unused = {
net/irda/irlmp_event.c:static const char *const irlmp_event[] __maybe_unused = {

Or after the struct:

drivers/net/phy/ste10Xp.c:static struct mdio_device_id __maybe_unused ste10Xp_tbl[] = {
drivers/net/phy/teranetics.c:static struct mdio_device_id __maybe_unused teranetics_tbl[] = {
drivers/net/phy/vitesse.c:static struct mdio_device_id __maybe_unused vitesse_tbl[] = {

So unless we decide tree wide to do it in one order or another, such changes
are largely a waste of time.

Sorry I'm not applying this patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: cx89x0: move attribute declaration before struct keyword
  2017-04-17 20:09 ` David Miller
@ 2017-04-17 20:31   ` Stefan Agner
  2017-04-17 20:44     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Agner @ 2017-04-17 20:31 UTC (permalink / raw)
  To: David Miller; +Cc: shc_work, jarod, netdev, linux-kernel

On 2017-04-17 13:09, David Miller wrote:
> From: Stefan Agner <stefan@agner.ch>
> Date: Sun, 16 Apr 2017 23:20:32 -0700
> 
>> The attribute declaration is typically before the definition. Move
>> the __maybe_unused attribute declaration before the struct keyword.
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
> 

I did catch that while compiling with clang, and the exact error message
is:
drivers/net/ethernet/cirrus/cs89x0.c:1899:21: warning: attribute
declaration must precede definition [-Wignored-attributes]
static const struct __maybe_unused of_device_id cs89x0_match[] = {

> Well, I see if just as often after the variable name too:
> 
> net/irda/iriap.c:static const char *const ias_charset_types[] __maybe_unused = {
> net/irda/irlap.c:static const char *const lap_reasons[] __maybe_unused = {
> net/irda/irlap_event.c:static const char *const irlap_event[] __maybe_unused = {
> net/irda/irlmp_event.c:static const char *const irlmp_event[] __maybe_unused = {
> 

That seems not to fire when compiling with clang. I guess because the
attribute is after the _complete_ type?

> Or after the struct:
> 
> drivers/net/phy/ste10Xp.c:static struct mdio_device_id __maybe_unused
> ste10Xp_tbl[] = {
> drivers/net/phy/teranetics.c:static struct mdio_device_id
> __maybe_unused teranetics_tbl[] = {
> drivers/net/phy/vitesse.c:static struct mdio_device_id __maybe_unused
> vitesse_tbl[] = {
> 

Same here...

> So unless we decide tree wide to do it in one order or another, such changes
> are largely a waste of time.

Afaik, "struct of_device_id" as a whole is a type. This case is really
odd since it puts the attribute in the middle of a type. It is the only
instance which came across (not everything compiles fine with clang yet,
so there might be more... but a quick grep did not turn up more of the
same cases)...

> 
> Sorry I'm not applying this patch.

Given that, can you reconsider?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: cx89x0: move attribute declaration before struct keyword
  2017-04-17 20:31   ` Stefan Agner
@ 2017-04-17 20:44     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-04-17 20:44 UTC (permalink / raw)
  To: stefan; +Cc: shc_work, jarod, netdev, linux-kernel

From: Stefan Agner <stefan@agner.ch>
Date: Mon, 17 Apr 2017 13:31:28 -0700

> Given that, can you reconsider?

Please put the attribute after the compete type.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-17 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-17  6:20 [PATCH] net: cx89x0: move attribute declaration before struct keyword Stefan Agner
2017-04-17 20:09 ` David Miller
2017-04-17 20:31   ` Stefan Agner
2017-04-17 20:44     ` David Miller

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).