From: Alan Stern <stern@rowland.harvard.edu>
To: Bastien Nocera <hadess@hadess.net>
Cc: "M. Vefa Bicakci" <m.v.b@runbox.com>,
Pany <pany@fedoraproject.org>,
linux-usb@vger.kernel.org
Subject: Re: Bug caused by 53965c79c2db (USB: Fix device driver race)
Date: Wed, 21 Oct 2020 08:29:37 -0400 [thread overview]
Message-ID: <20201021122937.GA982989@rowland.harvard.edu> (raw)
In-Reply-To: <530352a1e69aaf7c8c0933b56aaba68119e0b7fa.camel@hadess.net>
On Wed, Oct 21, 2020 at 02:02:55PM +0200, Bastien Nocera wrote:
> On Wed, 2020-10-21 at 13:53 +0200, Bastien Nocera wrote:
> <snip>
> > I'll prepare a patch that adds a match function. I'll let you (Vefa)
> > look at which of your patches need backporting though, as I'm really
> > quite a bit lost in the different patch sets and branches :/
>
> Something like that (untested):
>
> diff --git a/drivers/usb/misc/apple-mfi-fastcharge.c b/drivers/usb/misc/apple-mfi-fastcharge.c
> index b403094a6b3a..bb89dde018b1 100644
> --- a/drivers/usb/misc/apple-mfi-fastcharge.c
> +++ b/drivers/usb/misc/apple-mfi-fastcharge.c
> @@ -163,17 +163,26 @@ static const struct power_supply_desc apple_mfi_fc_desc = {
> .property_is_writeable = apple_mfi_fc_property_is_writeable
> };
>
> +static bool mfi_fc_match(struct usb_device *udev)
> +{
> + int idProduct, idVendor;
> +
> + idVendor = le16_to_cpu(udev->descriptor.idVendor);
> + idProduct = le16_to_cpu(udev->descriptor.idProduct);
> + /* See comment above mfi_fc_id_table[] */
> + return (idVendor == APPLE_VENDOR_ID &&
> + idProduct >= 0x1200 &&
> + idProduct <= 0x12ff);
> +}
> +
> static int mfi_fc_probe(struct usb_device *udev)
> {
> struct power_supply_config battery_cfg = {};
> struct mfi_device *mfi = NULL;
> - int err, idProduct;
> + int err;
>
> - idProduct = le16_to_cpu(udev->descriptor.idProduct);
> - /* See comment above mfi_fc_id_table[] */
> - if (idProduct < 0x1200 || idProduct > 0x12ff) {
> + if (!mfi_fc_probe(udev))
That should be mfi_fc_match(udev).
Alan Stern
next prev parent reply other threads:[~2020-10-21 12:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-17 16:07 Bug caused by 53965c79c2db (USB: Fix device driver race) Pany
2020-10-17 20:02 ` Alan Stern
2020-10-19 9:36 ` Pany
2020-10-19 17:40 ` Alan Stern
2020-10-20 12:03 ` M. Vefa Bicakci
2020-10-20 15:28 ` Alan Stern
2020-10-21 4:18 ` M. Vefa Bicakci
2020-10-21 11:53 ` Bastien Nocera
2020-10-21 12:02 ` Bastien Nocera
2020-10-21 12:29 ` Alan Stern [this message]
2020-10-21 12:31 ` Bastien Nocera
2020-10-21 13:01 ` Bastien Nocera
2020-10-21 13:08 ` M. Vefa Bicakci
2020-10-21 13:18 ` Bastien Nocera
2020-10-21 13:21 ` Bastien Nocera
2020-10-21 20:11 ` Alan Stern
2020-10-21 20:49 ` M. Vefa Bicakci
2020-10-21 20:49 ` M. Vefa Bicakci
2020-10-22 13:55 ` [PATCH 0/2] Patches to prevent re-probing all Apple USB devices on apple-mfi-fastcharge load M. Vefa Bicakci
2020-10-22 13:55 ` [PATCH 1/2] usbcore: Check both id_table and match() when both available M. Vefa Bicakci
2020-10-22 13:59 ` M. Vefa Bicakci
[not found] ` <CAHp75VeBgQ2ywLzU5PZEdfS+9M_niD0KoiEG=UMNH+4cPfsCNw@mail.gmail.com>
2020-10-23 12:51 ` M. Vefa Bicakci
2020-10-27 14:02 ` Bastien Nocera
2020-10-28 4:00 ` Pany
2020-10-29 3:33 ` M. Vefa Bicakci
2020-10-29 5:35 ` Pany
2020-10-22 13:55 ` [PATCH 2/2] USB: apple-mfi-fastcharge: don't probe unhandled devices M. Vefa Bicakci
2020-10-27 14:02 ` Bastien Nocera
2020-10-28 4:01 ` Pany
2020-10-21 3:17 ` Bug caused by 53965c79c2db (USB: Fix device driver race) Pany
2020-10-21 4:18 ` M. Vefa Bicakci
2020-10-21 5:19 ` Pany
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=20201021122937.GA982989@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=hadess@hadess.net \
--cc=linux-usb@vger.kernel.org \
--cc=m.v.b@runbox.com \
--cc=pany@fedoraproject.org \
/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