From 69166d252536b644f82782840cf31e6d685616dc Mon Sep 17 00:00:00 2001
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Mon, 9 Nov 2015 15:05:03 +0530
Subject: [PATCH] greybus: es2: Send cport-id in wValue field to
 usb_control_msg()

wIndex field has a special meaning, as that can be used by the core to
index into the possible USB interfaces. And that specifically broke with
gbsim, as it has a single USB interface.

Other similar requests (REQUEST_LATENCY_TAG_{EN|DIS}) are already using
wValue field for passing cport-id.

Fix cport_reset() by sending the cport-id in wValue field instead of
wIndex.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Fabien Parent <fparent@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
---
 drivers/staging/greybus/es2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/es2.c b/drivers/staging/greybus/es2.c
index c1a6fe4513c69..a0e20376bebfe 100644
--- a/drivers/staging/greybus/es2.c
+++ b/drivers/staging/greybus/es2.c
@@ -440,7 +440,7 @@ static int cport_reset(struct gb_host_device *hd, u16 cport_id)
 	retval = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 				 REQUEST_RESET_CPORT,
 				 USB_DIR_OUT | USB_TYPE_VENDOR |
-				 USB_RECIP_INTERFACE, 0, cport_id,
+				 USB_RECIP_INTERFACE, cport_id, 0,
 				 NULL, 0, ES2_TIMEOUT);
 	if (retval < 0) {
 		dev_err(&udev->dev, "failed to reset cport %hu: %d\n", cport_id,
-- 
2.30.2