netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net] r8169: fix LED-related deadlock on module removal
Date: Wed, 17 Apr 2024 09:26:36 +0200	[thread overview]
Message-ID: <Zh95rJqViOEpR40k@wunner.de> (raw)
In-Reply-To: <20240416164113.3ada12c7@kernel.org>

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

  reply	other threads:[~2024-04-17  7:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  6:44 [PATCH net] r8169: fix LED-related deadlock on module removal Heiner Kallweit
2024-04-15  8:49 ` Lukas Wunner
2024-04-15 11:54   ` Heiner Kallweit
2024-04-16 23:41   ` Jakub Kicinski
2024-04-17  7:26     ` Lukas Wunner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-15 11:57 Heiner Kallweit
2024-04-17  2:34 ` Jakub Kicinski
2024-04-17  6:02   ` Heiner Kallweit
2024-04-17  7:04     ` Greg KH
2024-04-17  7:16       ` Heiner Kallweit
2024-04-17  7:43         ` Greg KH
2024-04-17 22:33           ` Lukas Wunner
2024-04-18  9:55             ` Greg KH
2024-04-18 14:33               ` Heiner Kallweit
2024-04-18 14:44                 ` Greg KH
2024-04-17 13:45     ` Jakub Kicinski
2024-04-05 20:29 Heiner Kallweit
2024-04-05 20:50 ` Andrew Lunn
2024-04-05 20:59 ` Lukas Wunner

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=Zh95rJqViOEpR40k@wunner.de \
    --to=lukas@wunner.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).