mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentina Manea <valentina.manea.m@gmail.com>
To: gregkh@linuxfoundation.org
Cc: tobias.polzer@fau.de, dominik.paulus@fau.de,
	ly80toro@cip.cs.fau.de, shuah.kh@samsung.com,
	ihadzic@research.bell-labs.com, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, devel@driverdev.osuosl.org,
	firefly@lists.rosedu.org, andy.grover@gmail.com,
	Valentina Manea <valentina.manea.m@gmail.com>
Subject: [PATCH 14/18] staging: usbip: let client choose device configuration
Date: Sat,  8 Mar 2014 14:53:32 +0200	[thread overview]
Message-ID: <1394283216-1277-15-git-send-email-valentina.manea.m@gmail.com> (raw)
In-Reply-To: <1394283216-1277-1-git-send-email-valentina.manea.m@gmail.com>

Since usbip-host is now a device driver and the client
has full access to the shared device, it makes sense to
let the client choose device configuration.

Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com>
---
 drivers/staging/usbip/stub_dev.c | 10 +---------
 drivers/staging/usbip/stub_rx.c  | 26 +++++++-------------------
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c
index 60a3e3f..1bd13cf 100644
--- a/drivers/staging/usbip/stub_dev.c
+++ b/drivers/staging/usbip/stub_dev.c
@@ -337,7 +337,7 @@ static int stub_probe(struct usb_device *udev)
 {
 	struct stub_device *sdev = NULL;
 	const char *udev_busid = dev_name(&udev->dev);
-	int err = 0, config;
+	int err = 0;
 	struct bus_id_priv *busid_priv;
 
 	dev_dbg(&udev->dev, "Enter\n");
@@ -383,14 +383,6 @@ static int stub_probe(struct usb_device *udev)
 
 	busid_priv->shutdown_busid = 0;
 
-	config = usb_choose_configuration(udev);
-	if (config >= 0) {
-		err = usb_set_configuration(udev, config);
-		if (err && err != -ENODEV)
-			dev_err(&udev->dev, "can't set config #%d, error %d\n",
-				config, err);
-	}
-
 	/* set private data to usb_device */
 	dev_set_drvdata(&udev->dev, sdev);
 	busid_priv->sdev = sdev;
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c
index 76e44d9..e0b6d6b 100644
--- a/drivers/staging/usbip/stub_rx.c
+++ b/drivers/staging/usbip/stub_rx.c
@@ -142,31 +142,19 @@ static int tweak_set_interface_cmd(struct urb *urb)
 
 static int tweak_set_configuration_cmd(struct urb *urb)
 {
+	struct stub_priv *priv = (struct stub_priv *) urb->context;
+	struct stub_device *sdev = priv->sdev;
 	struct usb_ctrlrequest *req;
 	__u16 config;
+	int err;
 
 	req = (struct usb_ctrlrequest *) urb->setup_packet;
 	config = le16_to_cpu(req->wValue);
 
-	/*
-	 * I have never seen a multi-config device. Very rare.
-	 * For most devices, this will be called to choose a default
-	 * configuration only once in an initialization phase.
-	 *
-	 * set_configuration may change a device configuration and its device
-	 * drivers will be unbound and assigned for a new device configuration.
-	 * This means this usbip driver will be also unbound when called, then
-	 * eventually reassigned to the device as far as driver matching
-	 * condition is kept.
-	 *
-	 * Unfortunately, an existing usbip connection will be dropped
-	 * due to this driver unbinding. So, skip here.
-	 * A user may need to set a special configuration value before
-	 * exporting the device.
-	 */
-	dev_info(&urb->dev->dev, "usb_set_configuration %d to %s... skip!\n",
-		 config, dev_name(&urb->dev->dev));
-
+	err = usb_set_configuration(sdev->udev, config);
+	if (err && err != -ENODEV)
+		dev_err(&sdev->udev->dev, "can't set config #%d, error %d\n",
+			config, err);
 	return 0;
 }
 
-- 
1.8.1.2


  parent reply	other threads:[~2014-03-08 12:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-08 12:53 [PATCH 00/18] Resend of usbip-utils migration patches and various other fixes Valentina Manea
2014-03-08 12:53 ` [PATCH 01/18] staging: usbip: userspace: migrate usbip_bind to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 02/18] staging: usbip: userspace: remove useless libsysfs includes Valentina Manea
2014-03-08 12:53 ` [PATCH 03/18] staging: usbip: userspace: migrate usbip_unbind to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 04/18] staging: usbip: userspace: migrate usbip_list " Valentina Manea
2014-03-08 12:53 ` [PATCH 05/18] staging: usbip: userspace: re-add interface information listing Valentina Manea
2014-03-08 12:53 ` [PATCH 06/18] staging: usbip: userspace: add new list API Valentina Manea
2014-03-08 12:53 ` [PATCH 07/18] staging: usbip: userspace: move sysfs_utils to libsrc Valentina Manea
2014-03-08 12:53 ` [PATCH 08/18] staging: usbip: userspace: migrate usbip_host_driver to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 09/18] staging: usbip: userspace: remove class device infrastructure in vhci_driver Valentina Manea
2014-03-08 12:53 ` [PATCH 10/18] staging: usbip: userspace: migrate vhci_driver to libudev Valentina Manea
2014-03-08 12:53 ` [PATCH 11/18] staging: usbip: userspace: remove libsysfs flag and autoconf check Valentina Manea
2014-03-08 12:53 ` [PATCH 12/18] staging: usbip: userspace: update dependencies in README Valentina Manea
2014-03-08 12:53 ` [PATCH 13/18] staging: usbip: userspace: increase version to 2.0 Valentina Manea
2014-03-08 12:53 ` Valentina Manea [this message]
2014-03-08 12:53 ` [PATCH 15/18] staging: usbip: trigger driver probing after unbinding from usbip-host Valentina Manea
2014-03-08 12:53 ` [PATCH 16/18] staging: usbip: claim ports used by shared devices Valentina Manea
2014-03-08 12:53 ` [PATCH 17/18] staging: usbip: userspace: don't throw error when trying to read configuration specific attributes Valentina Manea
2014-03-08 12:53 ` [PATCH 18/18] staging: usbip: userspace: add hwdata as optional dependency in README Valentina Manea
2014-03-09  6:50 ` [PATCH 00/18] Resend of usbip-utils migration patches and various other fixes Greg KH
2014-03-09 15:53   ` Valentina Manea
2014-03-09 16:58     ` Greg KH

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=1394283216-1277-15-git-send-email-valentina.manea.m@gmail.com \
    --to=valentina.manea.m@gmail.com \
    --cc=andy.grover@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=dominik.paulus@fau.de \
    --cc=firefly@lists.rosedu.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ihadzic@research.bell-labs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ly80toro@cip.cs.fau.de \
    --cc=shuah.kh@samsung.com \
    --cc=tobias.polzer@fau.de \
    /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

all inboxes | Powered by JetHome®