From: Alan Stern <stern@rowland.harvard.edu>
To: Bastien Nocera <hadess@hadess.net>
Cc: linux-usb@vger.kernel.org, linux-input@vger.kernel.org,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
"Filipe Laíns" <lains@riseup.net>,
"Nestor Lopez Casado" <nlopezcasad@logitech.com>
Subject: Re: [PATCH 4/5] USB: core: Add API to change the wireless_status
Date: Thu, 23 Feb 2023 11:25:53 -0500 [thread overview]
Message-ID: <Y/eTkXYlflDWllHZ@rowland.harvard.edu> (raw)
In-Reply-To: <f94acf520e62676c741c0959f91c8d951d74a36c.camel@hadess.net>
On Thu, Feb 23, 2023 at 05:17:13PM +0100, Bastien Nocera wrote:
> On Thu, 2023-02-23 at 10:41 -0500, Alan Stern wrote:
> > On Thu, Feb 23, 2023 at 02:24:51PM +0100, Bastien Nocera wrote:
> > > Allow device specific drivers to change the wireless status of a
> > > device.
> > > This will allow user-space to know whether the device is available,
> > > whether or not specific USB interfaces can detect it.
> > >
> > > This can be used by wireless headsets with USB receivers to
> > > propagate to
> > > user-space whether or not the headset is turned on, so as to
> > > consider it
> > > as unavailable, and not switch to it just because the receiver is
> > > plugged in.
> > >
> > > Signed-off-by: Bastien Nocera <hadess@hadess.net>
> > > ---
> > > drivers/usb/core/message.c | 13 +++++++++++++
> > > drivers/usb/core/usb.c | 24 ++++++++++++++++++++++++
> > > include/linux/usb.h | 4 ++++
> > > 3 files changed, 41 insertions(+)
> > >
> > > diff --git a/drivers/usb/core/message.c
> > > b/drivers/usb/core/message.c
> > > index 127fac1af676..d5c7749d515e 100644
> > > --- a/drivers/usb/core/message.c
> > > +++ b/drivers/usb/core/message.c
> > > @@ -1908,6 +1908,18 @@ static void __usb_queue_reset_device(struct
> > > work_struct *ws)
> > > usb_put_intf(iface); /* Undo _get_ in
> > > usb_queue_reset_device() */
> > > }
> > >
> > > +/*
> > > + * Internal function to set the wireless_status sysfs attribute
> > > + * See usb_set_wireless_status() for more details
> > > + */
> > > +static void __usb_wireless_status_intf(struct work_struct *ws)
> > > +{
> > > + struct usb_interface *iface =
> > > + container_of(ws, struct usb_interface,
> > > wireless_status_work);
> > > +
> > > + usb_update_wireless_status_attr(iface);
> > > + usb_put_intf(iface); /* Undo _get_ in
> > > usb_set_wireless_status() */
> > > +}
> >
> > Have you thought about what will happen if this routine ends up
> > running
> > after the interface has been deleted?
>
> I believe that usb_release_interface() will only be called once the
> last reference to the interface is dropped, so bar any refcounting
> bugs, the interface should always exist when this function is called.
Yes, but what about the calls made by usb_update_wireless_status_attr():
sysfs_update_group(), sysfs_notify(), and kobject_uevent()? Will they
work properly when called for an object that has been unregistered from
sysfs?
Alan Stern
next prev parent reply other threads:[~2023-02-23 16:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 13:24 [PATCH 1/5] HID: logitech-hidpp: Add support for ADC measurement feature Bastien Nocera
2023-02-23 13:24 ` [PATCH 2/5] HID: logitech-hidpp: Add Logitech G935 headset Bastien Nocera
2023-02-23 13:24 ` [PATCH 3/5] USB: core: Add wireless_status sysfs attribute Bastien Nocera
2023-02-23 13:51 ` Greg Kroah-Hartman
2023-02-23 14:58 ` Bastien Nocera
2023-02-23 13:24 ` [PATCH 4/5] USB: core: Add API to change the wireless_status Bastien Nocera
2023-02-23 13:52 ` Greg Kroah-Hartman
2023-02-23 14:59 ` Bastien Nocera
2023-02-23 15:41 ` Alan Stern
2023-02-23 16:17 ` Bastien Nocera
2023-02-23 16:25 ` Alan Stern [this message]
2023-02-23 16:51 ` Bastien Nocera
2023-02-23 17:07 ` Alan Stern
2023-02-23 23:04 ` Bastien Nocera
2023-02-24 2:34 ` Alan Stern
2023-02-28 16:23 ` Bastien Nocera
2023-02-23 13:24 ` [PATCH 5/5] HID: logitech-hidpp: Set wireless_status for G935 receiver Bastien Nocera
2023-02-23 13:56 ` [PATCH 1/5] HID: logitech-hidpp: Add support for ADC measurement feature Greg Kroah-Hartman
2023-02-23 14:57 ` Bastien Nocera
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=Y/eTkXYlflDWllHZ@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=benjamin.tissoires@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hadess@hadess.net \
--cc=lains@riseup.net \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nlopezcasad@logitech.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).