Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c8c9815 authored by Valentina Manea's avatar Valentina Manea Committed by Greg Kroah-Hartman
Browse files

staging: usbip: let client choose device configuration



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: default avatarValentina Manea <valentina.manea.m@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 435d948c
Loading
Loading
Loading
Loading
+1 −9
Original line number Original line Diff line number Diff line
@@ -337,7 +337,7 @@ static int stub_probe(struct usb_device *udev)
{
{
	struct stub_device *sdev = NULL;
	struct stub_device *sdev = NULL;
	const char *udev_busid = dev_name(&udev->dev);
	const char *udev_busid = dev_name(&udev->dev);
	int err = 0, config;
	int err = 0;
	struct bus_id_priv *busid_priv;
	struct bus_id_priv *busid_priv;


	dev_dbg(&udev->dev, "Enter\n");
	dev_dbg(&udev->dev, "Enter\n");
@@ -383,14 +383,6 @@ static int stub_probe(struct usb_device *udev)


	busid_priv->shutdown_busid = 0;
	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 */
	/* set private data to usb_device */
	dev_set_drvdata(&udev->dev, sdev);
	dev_set_drvdata(&udev->dev, sdev);
	busid_priv->sdev = sdev;
	busid_priv->sdev = sdev;
+7 −19
Original line number Original line Diff line number Diff line
@@ -142,31 +142,19 @@ static int tweak_set_interface_cmd(struct urb *urb)


static int tweak_set_configuration_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;
	struct usb_ctrlrequest *req;
	__u16 config;
	__u16 config;
	int err;


	req = (struct usb_ctrlrequest *) urb->setup_packet;
	req = (struct usb_ctrlrequest *) urb->setup_packet;
	config = le16_to_cpu(req->wValue);
	config = le16_to_cpu(req->wValue);


	/*
	err = usb_set_configuration(sdev->udev, config);
	 * I have never seen a multi-config device. Very rare.
	if (err && err != -ENODEV)
	 * For most devices, this will be called to choose a default
		dev_err(&sdev->udev->dev, "can't set config #%d, error %d\n",
	 * configuration only once in an initialization phase.
			config, err);
	 *
	 * 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));

	return 0;
	return 0;
}
}