From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hans de Goede <hdegoede@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: roles: Cakk try_module_get() from usb_role_switch_find_by_fwnode()
Date: Fri, 9 Apr 2021 12:30:55 +0300 [thread overview]
Message-ID: <YHAez16ixJitMVtN@kuha.fi.intel.com> (raw)
In-Reply-To: <20210408230904.GA87058@roeck-us.net>
On Thu, Apr 08, 2021 at 04:09:04PM -0700, Guenter Roeck wrote:
> On Thu, Apr 08, 2021 at 10:36:11PM +0200, Hans de Goede wrote:
> > usb_role_switch_find_by_fwnode() returns a reference to the role-switch
> > which must be put by calling usb_role_switch_put().
> >
> > usb_role_switch_put() calls module_put(sw->dev.parent->driver->owner),
> > add a matching try_module_get() to usb_role_switch_find_by_fwnode(),
> > making it behave the same as the other usb_role_switch functions
> > which return a reference.
> >
> > This avoids a WARN_ON being hit at kernel/module.c:1158 due to the
> > module-refcount going below 0.
> >
>
> Took me a while to figure out what the subject line is supposed
> to mean.
>
> s/Cakk/Call/
>
> Otherwise
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>
> It might be useful though to explain the difference between
> fwnode_usb_role_switch_get() and usb_role_switch_find_by_fwnode(),
> and why two different functions are needed, both passing fwnode
> as parameter and returning a pointer to usb_role_switch.
Yes, the function names are confusing indeed. My proposal is to rename
usb_role_switch_find_by_fwnode() to fwnode_to_usb_role_switch().
I can prepare a patch for that if you guys are OK with it, or Hans,
would you prefer to send that together with this one?
Actually, shouldn't this be marked as a fix?
thanks,
--
heikki
next prev parent reply other threads:[~2021-04-09 9:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 20:36 [PATCH] usb: roles: Cakk try_module_get() from usb_role_switch_find_by_fwnode() Hans de Goede
2021-04-08 23:09 ` Guenter Roeck
2021-04-09 9:30 ` Heikki Krogerus [this message]
2021-04-09 12:41 ` Hans de Goede
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=YHAez16ixJitMVtN@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
/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).