All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeremy Figgins <kernel@jeremyfiggins.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	zaitcev@redhat.com
Subject: Re: [PATCH] USB: usblp: add USBLP_QUIRK_NO_SET_INTF flag
Date: Sun, 17 Jan 2021 23:44:16 -0600	[thread overview]
Message-ID: <20210117234416.49d59761@suzdal.zaitcev.lan> (raw)
In-Reply-To: <YASt5wgOCkXhH2Dv@watson>

On Sun, 17 Jan 2021 15:36:39 -0600
Jeremy Figgins <kernel@jeremyfiggins.com> wrote:

> The naming is designed to mirror the existing
> USB_QUIRK_NO_SET_INTF flag, but that flag is
> not sufficient to make these devices work.
> +	{ 0x0416, 0x5011, USBLP_QUIRK_NO_SET_INTF }, /* Winbond Electronics Corp. Virtual Com Port */

Jeremy, thanks for the patch. It looks mostly fine code-wise (quirk is
out of numerical order), but I have a question: did you consider keying
off usblp->dev->quirks instead?

How about this:

diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
index 37062130a03c..0c4a98f00797 100644
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -1315,7 +1315,11 @@ static int usblp_set_protocol(struct usblp *usblp, int protocol)
 	alts = usblp->protocol[protocol].alt_setting;
 	if (alts < 0)
 		return -EINVAL;
-	r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
+	if (usblp->dev->quirks & USB_QUIRK_NO_SET_INTF) {
+		r = 0;
+	} else {
+		r = usb_set_interface(usblp->dev, usblp->ifnum, alts);
+	}
 	if (r < 0) {
 		printk(KERN_ERR "usblp: can't set desired altsetting %d on interface %d\n",
 			alts, usblp->ifnum);
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 1b4eb7046b07..632c60401d53 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -205,6 +205,9 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* HP v222w 16GB Mini USB Drive */
 	{ USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT },
 
+	/* Winbond Electronics Corp. Virtual Com Port */
+	{ USB_DEVICE(0x0416, 0x5011), .driver_info = USB_QUIRK_NO_SET_INTF },
+
 	/* Creative SB Audigy 2 NX */
 	{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
 

Please let me know if it works for you.

-- Pete


  reply	other threads:[~2021-01-18  5:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 21:36 [PATCH] USB: usblp: add USBLP_QUIRK_NO_SET_INTF flag Jeremy Figgins
2021-01-18  5:44 ` Pete Zaitcev [this message]
2021-01-18 16:31   ` Alan Stern
2021-01-18 16:43     ` Michael Sweet
2021-01-19  0:01       ` Jeremy Figgins
2021-01-21 19:21         ` Pete Zaitcev
2021-01-21 19:19     ` Pete Zaitcev
2021-01-21 19:29       ` Alan Stern
2021-01-21 23:02         ` Pete Zaitcev
2021-01-22  1:06           ` Jeremy Figgins
2021-01-22 16:22             ` Alan Stern
2021-01-23 18:46               ` Jeremy Figgins
2021-01-23 21:33                 ` Alan Stern
2021-01-22 16:20           ` Alan Stern
2021-01-18  9:02 ` Sergei Shtylyov
2021-01-17 21:39 Jeremy Figgins

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=20210117234416.49d59761@suzdal.zaitcev.lan \
    --to=zaitcev@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@jeremyfiggins.com \
    --cc=linux-usb@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.