[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zh95rJqViOEpR40k@wunner.de>
Date: Wed, 17 Apr 2024 09:26:36 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Heiner Kallweit <hkallweit1@...il.com>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
David Miller <davem@...emloft.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net] r8169: fix LED-related deadlock on module removal
On Tue, Apr 16, 2024 at 04:41:13PM -0700, Jakub Kicinski wrote:
> On Mon, 15 Apr 2024 10:49:11 +0200 Lukas Wunner wrote:
> > > struct rtl8169_private;
> > > +struct r8169_led_classdev;
> >
> > Normally these forward declarations are not needed if you're just
> > referencing the struct name in a pointer. Usage of the struct name
> > in a pointer implies a forward declaration.
>
> Unless something changed recently that only works for struct members,
> function args need an explicit forward declaration.
Not for pointers:
"You can't use an incomplete type to declare a variable or field,
or use it for a function parameter or return type. [...]
However, you can define a pointer to an incomplete type,
and declare a variable or field with such a pointer type.
In general, you can do everything with such pointers except
dereference them."
https://gnu-c-language-manual.github.io/GNU-C-Language-Manual/Incomplete-Types.html
That's the case here:
struct r8169_led_classdev;
struct r8169_led_classdev *rtl8168_init_leds(struct net_device *ndev);
void r8169_remove_leds(struct r8169_led_classdev *leds);
In this particular case, struct r8169_led_classdev is only used as a
*pointer* passed to or returned from a function. There's no need
for a forward declaration of the type behind the pointer.
Thanks,
Lukas
Powered by blists - more mailing lists