Re: [balbi-usb:testing/next 64/67] otg.c:undefined reference to `usb_gadget_vbus_disconnect'

2016-06-12 Thread Felipe Balbi

Hi,

Peter Chen  writes:
> On Wed, Jun 08, 2016 at 12:59:51PM +0300, Felipe Balbi wrote:
>> 
>> Hi,
>> 
>> kbuild test robot  writes:
>> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git 
>> > testing/next
>> > head:   fc4d1f3f522648d92d0c046beedbc1469979499a
>> > commit: 74e51eb7b5b4f7ab33c099c20def3dce0c699006 [64/67] usb: gadget: move 
>> > gadget API functions to udc-core
>> > config: i386-randconfig-h1-06081244 (attached as .config)
>> > compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
>> > reproduce:
>> > git checkout 74e51eb7b5b4f7ab33c099c20def3dce0c699006
>> > # save the attached .config to linux build tree
>> > make ARCH=i386 
>> >
>> > All errors (new ones prefixed by >>):
>> >
>> >drivers/built-in.o: In function `nop_set_peripheral':
>> >phy-generic.c:(.text+0x59f7a6): undefined reference to 
>> > `usb_gadget_vbus_connect'
>> >drivers/built-in.o: In function `nop_gpio_vbus_thread':
>> >phy-generic.c:(.text+0x59f8a1): undefined reference to 
>> > `usb_gadget_vbus_connect'
>> >phy-generic.c:(.text+0x59f925): undefined reference to 
>> > `usb_gadget_vbus_disconnect'
>> >drivers/built-in.o: In function `gpio_vbus_set_peripheral':
>> >phy-gpio-vbus-usb.c:(.text+0x59ff45): undefined reference to 
>> > `usb_gadget_vbus_disconnect'
>> >drivers/built-in.o: In function `gpio_vbus_work':
>> >phy-gpio-vbus-usb.c:(.text+0x5a02dd): undefined reference to 
>> > `usb_gadget_vbus_disconnect'
>> >phy-gpio-vbus-usb.c:(.text+0x5a0333): undefined reference to 
>> > `usb_gadget_vbus_connect'
>> >drivers/built-in.o: In function `ci_handle_vbus_change.part.6':
>> >>> otg.c:(.text+0x605e3b): undefined reference to 
>> >>> `usb_gadget_vbus_disconnect'
>> >>> otg.c:(.text+0x605e49): undefined reference to `usb_gadget_vbus_connect'
>> >drivers/built-in.o: In function `isp1704_charger_work':
>> >isp1704_charger.c:(.text+0x648335): undefined reference to 
>> > `usb_gadget_disconnect'
>> >isp1704_charger.c:(.text+0x64839d): undefined reference to 
>> > `usb_gadget_connect'
>> >drivers/built-in.o: In function `isp1704_charger_probe':
>> >isp1704_charger.c:(.text+0x648760): undefined reference to 
>> > `usb_gadget_disconnect'
>> 
>> thanks, fixed:
>> 
>
> Hi Felipe,
>
> Your patch does not fix above issue, I have tried. At least, I can
> reproduce phy-gpio-vbus-usb build error if it is build in, and
> USB_GADGET is module.

alright, I'll look at this today.

-- 
balbi


signature.asc
Description: PGP signature


Re: Multiple chatty devices on Intel 5 Series/3400 USB2 EHCI controller act erratic

2016-06-12 Thread Sean M. Pappalardo


On 06/12/2016 06:05 PM, Alan Stern wrote:
> Okay, thanks.  I just wanted to be sure the patch was behaving as 
> intended.  It was, but since it didn't fix your problem the whole 
> thing's a moot point.

Anything else you'd like me to try or gather if you're interested in
fixing the underlying problem? (Even though I now have a workable
workaround for my problem.)

Sincerely,
Sean M. Pappalardo




smime.p7s
Description: S/MIME Cryptographic Signature


Re: [RFC v4 01/14] regulator: of: Add helper for getting all supplies

2016-06-12 Thread Peter Chen
On Sun, Jun 12, 2016 at 03:29:01PM +0800, Peter Chen wrote:
> On Fri, Jun 10, 2016 at 12:30:56PM -0500, Rob Herring wrote:
> > On Thu, Jun 09, 2016 at 01:42:02PM +0200, Krzysztof Kozlowski wrote:
> > > On 06/09/2016 12:29 PM, Mark Brown wrote:
> > > > On Thu, Jun 09, 2016 at 11:44:18AM +0200, Krzysztof Kozlowski wrote:
> > > >> Few drivers have a need of getting regulator supplies without knowing
> > > >> their names:
> > > >> 1. The Simple Framebuffer driver works on setup provided by bootloader
> > > >>(outside of scope of kernel);
> > > >> 2. Generic power sequence driver may be attached to any device node.
> > > >>
> > > >> Add a Device Tree helper for parsing "-supply" properties and returning
> > > >> allocated bulk regulator consumers.
> > > > 
> > > > I'm still very concerned that this is just an invitation to people to
> > > > write half baked regulator consumers and half baked DTs to go along with
> > > > it, making it a standard API that doesn't have big red flags on it that
> > > > will flag up when "normal" drivers use it is not good.  Right now this
> > > > just looks like a standard API and people are going to just start using
> > > > it.  If we are going to do this perhaps we need a separate header or
> > > > something to help flag this up.
> > > 
> > > No problem, I can move it to a special header.  Actually, if you dislike
> > > this as an API, it does not have to be in header at all.  I can just
> > > duplicate the simplefb code.
> > > 
> > > > In the case of power sequences I'd expect the sequences to perform
> > > > operations on named supplies - the core shouldn't know what the supplies
> > > > are but the thing specifying the sequence should.
> > > 
> > > Hm, so maybe passing names like:
> > > 
> > > usb3503@08 {
> > >   reset-gpios = < 5 GPIO_ACTIVE_HIGH>;
> > >   initial-mode = <1>;
> > >   vdd-supply = <_reg>;
> > >   foo-supply = <_reg>;
> > > 
> > > power-sequence;
> > >   power-sequence-supplies = "vdd", "foo";
> > 
> > This alone would be fine as it is just one property, but then what's 
> > next? power-sequence-delay, power-sequence-clocks, etc. What if you 
> > need to express ordering relationship of supplies, clocks, gpios? We end 
> > up with a scripting language in DT and we don't want to have that.
> > 
> 
> Can we do things like below:
> 
> - DT describes hardware elements (clock, gpios, etc) for power sequence, and 
> we
> need a node for power sequence.
> - Power sequence framework handles getting hardware elements.

Framework may do few things, since hardware elements are also different
for devices.

> - Power sequence platform driver handles special sequence for devices,
> and we can create some generic drivers for generic devices.
> 

So, my suggestion is do like mmc does (like this patch set does). The
reasons like belows:

- This piece of power sequence code needs to work like device driver, not
library, it is easy to manage resources using device driver.
- The device on the bus has still not been found, so this piece of code
can't be in device driver on each subsystem.
- We need to have a place for these power sequences drivers

Ideally, I hope it can work like regulator class, but it seems hard to
compatible with current mmc-pwrseq DT node.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/3] usbip: vhci extension: modifications to vhci driver

2016-06-12 Thread Nobuo Iwata
Modification to Kconfig, vhci_hc.c, vhci.h and vhci_sysfs.c.

1. kernel config

Followings are added.

USBIP_VHCI_HC_PORTS: Number of ports per USB/IP virtual host 
controller. The default is 8 - same as current VHCI_NPORTS.
USBIP_VHCI_NR_HCS: Number of USB/IP virtual host controllers. The 
default is 1. This paratmeter is replaced with USBIP_VHCI_INIT_HCS and 
USBIP_VHCI_MAX_HCS included in succeeding dynamic extension patch.

2. the_controller to controllers

the_controller is changed to vhci_pdevs: array of struct 
platform_device.

3. vhci_sysfs.c

Sysfs structure is changed as following.

BEFORE:
/sys/devices/platform
+-- vhci
+-- status
+-- attach
+-- detach
+-- usbip_debug

AFTER: example for CONFIG_USBIP_NR_HCS=4
/sys/devices/platform
+-- vhci
|   +-- nports
|   +-- status
|   +-- status.1
|   +-- status.2
|   +-- status.3
|   +-- attach
|   +-- detach
|   +-- usbip_debug
+-- vhci.1
+-- vhci.2
+-- vhci.3

vhci[.N] is shown for each host controller kobj. vhch.1, vhci.2, ... 
are shown only when CONFIG_USBIP_NR_HCS is more than 1. Only 'vhci' 
(without number) has user space interfaces. 'nports' is newly added to 
give ports-per-controller and number of controlles. Before that, number 
of ports is acquired by reading status lines. Status is divided for 
each controller to avoid page size (4KB) limitation.

Old userspace tool binaries work with the first status within the first 
controller.

Inconsistency between status header and content is fixed.
4th and 5th column are
header:  "dev bus"
content(unused): "000 000"
content(used):   "%08x", devid
Only 1st and 2nd column are used by program. In old version, sscanf() 
in parse_status expect no bus column. And bus_id string is shown in the 
last column. Then bus in the header is removed and unused content is 
replaced with 8 zeros. The sscanf() expects more than 5 columns and new 
has 6 columns so there's no compatibility issue in this change.

Signed-off-by: Nobuo Iwata 
---
 drivers/usb/usbip/Kconfig  |  21 +++
 drivers/usb/usbip/vhci.h   |  54 --
 drivers/usb/usbip/vhci_hcd.c   | 285 ---
 drivers/usb/usbip/vhci_rx.c|  21 +--
 drivers/usb/usbip/vhci_sysfs.c | 296 +
 5 files changed, 497 insertions(+), 180 deletions(-)

diff --git a/drivers/usb/usbip/Kconfig b/drivers/usb/usbip/Kconfig
index 17646b2..29492c7 100644
--- a/drivers/usb/usbip/Kconfig
+++ b/drivers/usb/usbip/Kconfig
@@ -24,6 +24,27 @@ config USBIP_VHCI_HCD
  To compile this driver as a module, choose M here: the
  module will be called vhci-hcd.
 
+config USBIP_VHCI_HC_PORTS
+   int "Number of ports per USB/IP virtual host controller"
+   range 1 31
+   default 8
+   depends on USBIP_VHCI_HCD
+   ---help---
+ To increase number of ports available for USB/IP virtual
+ host controller driver, this defines number of ports per
+ USB/IP virtual host controller.
+
+config USBIP_VHCI_NR_HCS
+   int "Number of USB/IP virtual host controllers"
+   range 1 128
+   default 1
+   depends on USBIP_VHCI_HCD
+   ---help---
+ To increase number of ports available for USB/IP virtual
+ host controller driver, this defines number of USB/IP
+ virtual host controllers as if adding physical host
+ controllers.
+
 config USBIP_HOST
tristate "Host driver"
depends on USBIP_CORE && USB
diff --git a/drivers/usb/usbip/vhci.h b/drivers/usb/usbip/vhci.h
index a863a98..88b71c4 100644
--- a/drivers/usb/usbip/vhci.h
+++ b/drivers/usb/usbip/vhci.h
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2003-2008 Takahiro Hirofuchi
+ * Copyright (C) 2015 Nobuo Iwata
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,13 +73,25 @@ struct vhci_unlink {
 };
 
 /* Number of supported ports. Value has an upperbound of USB_MAXCHILDREN */
-#define VHCI_NPORTS 8
+#ifdef CONFIG_USBIP_VHCI_HC_PORTS
+#define VHCI_HC_PORTS CONFIG_USBIP_VHCI_HC_PORTS
+#else
+#define VHCI_HC_PORTS 8
+#endif
+
+#ifdef CONFIG_USBIP_VHCI_NR_HCS
+#define VHCI_NR_HCS CONFIG_USBIP_VHCI_NR_HCS
+#else
+#define VHCI_NR_HCS 1
+#endif
+
+#define MAX_STATUS_NAME 16
 
 /* for usb_bus.hcpriv */
 struct vhci_hcd {
spinlock_t lock;
 
-   u32 port_status[VHCI_NPORTS];
+   u32 port_status[VHCI_HC_PORTS];
 
unsigned resuming:1;
unsigned long re_timeout;
@@ -90,14 +103,19 @@ struct vhci_hcd {
 * wIndex shows the port number and begins from 1.
 * But, the index of this array begins from 0.
 */
-   struct vhci_device vdev[VHCI_NPORTS];
+   struct vhci_device vdev[VHCI_HC_PORTS];
 };
 
-extern struct vhci_hcd *the_controller;
-extern const 

[PATCH v4 2/3] usbip: vhci extension: modifications to userspace

2016-06-12 Thread Nobuo Iwata
Modification to the userspace tools including usbip/libsrc and 
usbip/src.

Changed corresponding to new vhci_sysfs.c.

nports in sysfs is used to get total number of ports. 

Old get_nports() ignores the last status line because 
udev_device_get_sysattr_value() drops last new line. New version uses 
nports attribute so it's doesn't have this problem.

status[.N] in sysfs are used.

parse_status() which reads all status lines is broken into open, close, 
read-line and parse-line. Parse-line is reused to find free port and 
get imported device.

In daemon, status was loaded into memory by 
usbip_vhci_refresh_device_list() at receiving every request. The loaded 
status is used to find free port. It is changed to read status directly 
to find free port.

Wording inconsistencies are fixed according to the rule below.

rhport, HC_PORTS: ports within a controller (or root hub).
port, nports: ports across the controllers.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/libsrc/vhci_driver.c | 398 +++
 tools/usb/usbip/libsrc/vhci_driver.h |  45 +--
 tools/usb/usbip/src/usbip_attach.c   |   8 +-
 tools/usb/usbip/src/usbip_port.c |  13 +-
 tools/usb/usbip/src/usbipd_app.c |  49 ++--
 5 files changed, 253 insertions(+), 260 deletions(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index 50c723d..4d1b986 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -15,11 +15,24 @@
 #undef  PROGNAME
 #define PROGNAME "libusbip"
 
-struct usbip_vhci_driver *vhci_driver;
-struct udev *udev_context;
+static struct udev_device *vhci_hc_device;
+static struct udev *udev_context;
+static int vhci_nports;
 
-static struct usbip_imported_device *
-imported_device_init(struct usbip_imported_device *idev, char *busid)
+struct usbip_vhci_device {
+   int port;
+   uint32_t status;
+
+   uint32_t devid;
+
+   uint8_t busnum;
+   uint8_t devnum;
+
+   /* usbip_class_device list */
+   struct usbip_usb_device udev;
+};
+
+static int imported_device_init(struct usbip_vhci_device *vdev, char *busid)
 {
struct udev_device *sudev;
 
@@ -27,132 +40,131 @@ imported_device_init(struct usbip_imported_device *idev, 
char *busid)
   "usb", busid);
if (!sudev) {
dbg("udev_device_new_from_subsystem_sysname failed: %s", busid);
-   goto err;
+   return -1;
}
-   read_usb_device(sudev, >udev);
+   read_usb_device(sudev, >udev);
udev_device_unref(sudev);
 
-   return idev;
-
-err:
-   return NULL;
+   return 0;
 }
 
+struct status_context {
+   int controller;
+   const char *c;
+};
 
+#define OPEN_MODE_FIRST  0
+#define OPEN_MODE_REOPEN 1
 
-static int parse_status(const char *value)
-{
-   int ret = 0;
-   char *c;
+static int open_hc_device(int mode);
 
+#define MAX_STATUS_NAME 16
 
-   for (int i = 0; i < vhci_driver->nports; i++)
-   memset(_driver->idev[i], 0, sizeof(vhci_driver->idev[i]));
+static int open_status(struct status_context *ctx, int mode)
+{
+   char name[MAX_STATUS_NAME+1];
 
+   if (mode == OPEN_MODE_FIRST)
+   ctx->controller = 0;
+   else
+   (ctx->controller)++;
 
-   /* skip a header line */
-   c = strchr(value, '\n');
-   if (!c)
+   if (open_hc_device(OPEN_MODE_REOPEN))
return -1;
-   c++;
-
-   while (*c != '\0') {
-   int port, status, speed, devid;
-   unsigned long socket;
-   char lbusid[SYSFS_BUS_ID_SIZE];
-
-   ret = sscanf(c, "%d %d %d %x %lx %31s\n",
-   , , ,
-   , , lbusid);
-
-   if (ret < 5) {
-   dbg("sscanf failed: %d", ret);
-   BUG();
-   }
 
-   dbg("port %d status %d speed %d devid %x",
-   port, status, speed, devid);
-   dbg("socket %lx lbusid %s", socket, lbusid);
+   if (ctx->controller == 0)
+   strcpy(name, "status");
+   else
+   snprintf(name, MAX_STATUS_NAME + 1,
+   "status.%d", ctx->controller);
+   ctx->c = udev_device_get_sysattr_value(vhci_hc_device, name);
+   if (ctx->c == NULL)
+   return -1;
 
+   return 0;
+}
 
-   /* if a device is connected, look at it */
-   {
-   struct usbip_imported_device *idev = 
_driver->idev[port];
+static void close_status(struct status_context *ctx)
+{
+   ctx->c = NULL;
+}
 
-   idev->port  = port;
-   idev->status= status;
+static int next_status_line(struct status_context *ctx)
+{
+   const char *c = ctx->c;
 
- 

[PATCH v4 3/3] usbip: vhci extension: dynamic extension

2016-06-12 Thread Nobuo Iwata
Modification for dynamic device registration and unregistration.

1. kernel config

Followings are added.

USBIP_VHCI_HC_PORTS: Number of ports per USB/IP virtual host 
controller. The default is 8 - same as current VHCI_NPORTS.
USBIP_VHCI_MAX_HCS: Muximum number of USB/IP virtual host controllers. 
The default is 1.
USBIP_VHCI_INIT_HCS: Initial number of USB/IP virtual host controllers. 
The default is 1.
Static number of devices: USBIP_VHCI_NR_HCS in patch 1/3 is removed 
with this patch.

2. view from sysfs

Sysfs structure is changed as following.

BEFORE this patchset:
/sys/devices/platform
+-- vhci
+-- status
+-- attach
+-- detach
+-- usbip_debug

AFTER: example for CONFIG_USBIP_INIT_HCS=2 CONFIG_USBIP_MAX_HCS=4
At the beginning
/sys/devices/platform
+-- vhci
|   +-- nports
|   +-- status
|   +-- status.1
|   +-- status.2
|   +-- status.3
|   +-- attach
|   +-- detach
|   +-- usbip_debug
+-- vhci.1

The status files are shown to the maximum number of devices. Port 
status in status.2 and status.3 represents as free but corresponding 
devices are not yes registered.
When all ports in status and status.1 are used, userspace tool requests 
'attach' to a port in status.2 then vhci.2 will be registred. The limit 
is defined with USBIP_VHCI_MAX_NCS.

By preparing muximum number of status files, there's no need to 
introduce additional operations for userspace tool.

When number of free ports becomes more than USBIP_VHCI_HC_PORTS * 
VHCI_FREE_HCS(2), a free controller other than the first one will be 
unregistered. It will be invoked by 'detach' operation and other error 
situations which ports are released.

Signed-off-by: Nobuo Iwata 
---
 drivers/usb/usbip/Kconfig  |  17 ++-
 drivers/usb/usbip/vhci.h   |  36 -
 drivers/usb/usbip/vhci_hcd.c   | 251 -
 drivers/usb/usbip/vhci_rx.c|  10 +-
 drivers/usb/usbip/vhci_sysfs.c |  49 ---
 drivers/usb/usbip/vhci_tx.c|   6 +-
 6 files changed, 294 insertions(+), 75 deletions(-)

diff --git a/drivers/usb/usbip/Kconfig b/drivers/usb/usbip/Kconfig
index 29492c7..d11b548 100644
--- a/drivers/usb/usbip/Kconfig
+++ b/drivers/usb/usbip/Kconfig
@@ -34,8 +34,8 @@ config USBIP_VHCI_HC_PORTS
  host controller driver, this defines number of ports per
  USB/IP virtual host controller.
 
-config USBIP_VHCI_NR_HCS
-   int "Number of USB/IP virtual host controllers"
+config USBIP_VHCI_MAX_HCS
+   int "Maximum number of USB/IP virtual host controllers"
range 1 128
default 1
depends on USBIP_VHCI_HCD
@@ -43,7 +43,18 @@ config USBIP_VHCI_NR_HCS
  To increase number of ports available for USB/IP virtual
  host controller driver, this defines number of USB/IP
  virtual host controllers as if adding physical host
- controllers.
+ controllers. This defines the maximum number.
+
+config USBIP_VHCI_INIT_HCS
+   int "Initial number of USB/IP virtual host controllers"
+   range 1 USBIP_VHCI_MAX_HCS
+   default 1
+   depends on USBIP_VHCI_MAX_HCS
+   ---help---
+ To increase number of ports available for USB/IP virtual
+ host controller driver, this defines number of USB/IP
+ virtual host controllers as if adding physical host
+ controllers. This defines the number at initializing.
 
 config USBIP_HOST
tristate "Host driver"
diff --git a/drivers/usb/usbip/vhci.h b/drivers/usb/usbip/vhci.h
index 88b71c4..ba893a7 100644
--- a/drivers/usb/usbip/vhci.h
+++ b/drivers/usb/usbip/vhci.h
@@ -51,6 +51,9 @@ struct vhci_device {
 
/* vhci_tx thread sleeps for this queue */
wait_queue_head_t waitq_tx;
+
+   /* denotes port is in-use */
+   atomic_t using_port;
 };
 
 /* urb->hcpriv, use container_of() */
@@ -79,12 +82,21 @@ struct vhci_unlink {
 #define VHCI_HC_PORTS 8
 #endif
 
-#ifdef CONFIG_USBIP_VHCI_NR_HCS
-#define VHCI_NR_HCS CONFIG_USBIP_VHCI_NR_HCS
+#ifdef CONFIG_USBIP_VHCI_MAX_HCS
+#define VHCI_MAX_HCS CONFIG_USBIP_VHCI_MAX_HCS
+#else
+#define VHCI_MAX_HCS 1
+#endif
+
+#ifdef CONFIG_USBIP_VHCI_INIT_HCS
+#define VHCI_INIT_HCS CONFIG_USBIP_VHCI_INIT_HCS
 #else
-#define VHCI_NR_HCS 1
+#define VHCI_INIT_HCS 1
 #endif
 
+/* VHCI_FREE_HCS * VHCI_HC_PORTS: ports to keep free at unregister */
+#define VHCI_FREE_HCS 2
+
 #define MAX_STATUS_NAME 16
 
 /* for usb_bus.hcpriv */
@@ -98,6 +110,8 @@ struct vhci_hcd {
 
atomic_t seqnum;
 
+   unsigned int using_ports;
+
/*
 * NOTE:
 * wIndex shows the port number and begins from 1.
@@ -106,12 +120,18 @@ struct vhci_hcd {
struct vhci_device vdev[VHCI_HC_PORTS];
 };
 
+extern int vhci_max_controllers;
+extern int vhci_init_controllers;
 extern int vhci_num_controllers;
 extern struct platform_device **vhci_pdevs;
 extern struct 

[PATCH v4 0/3] usbip: vhci number of ports extension

2016-06-12 Thread Nobuo Iwata
This series of patches extends number of ports limitaion in application 
(vhci) side.

1. Background

Assuming a system shown below that services distributerd devices in 
home or office via USB/IP, if the devices are set at every doors and 
windows, number devices may be up to tens.

Home/SOHO/Enterprise Intranet/Internet
 +--+   +--+ USB/IP+-+
+|device|--+|Linux |---|Service  |
|+--+  |+--+---|on Linux |
+--+   +--++-+
ex)
Device  Service
 sensors ... environment analysis
 cameras ... monitoring, recording
 ID/biometric readers .. authentication

If USB/IP is used for ubiqitous devices or IoT devices, many devices 
might be handled. 

2. About this patch set

In current USB/IP, available number of ports (ie. number of supported 
devices) is VHCI_NPORTS(8) in drivers/usb/usbip/vhci.h. The value of 
the macro can be altered to USB_MAXCHILDREN(31). This limit is came 
from hub status bit array. See also the comment at USB_MAXCHILDREN 
include/uapi/linux/usb/ch11.h.

There are two way to increase number of available ports. The first way 
is to put hub emulator under vhci. This can add ports up to 255 - the 
limit of USB 2.0 host controller. The second way is to add host 
controller. It's as same as machines have several host controllers: 
most desktop or note PCs have more than one host controller.

Current USB/IP supports only one controller defined as 'the_controller' 
in drivers/usb/usbip/vhci_hcd.c. This patch takes the second way 
described above and adds virtual controllers. In this patch, the number 
is specified by kernel configuration. 

3. Dynamic extension

According to kernel configuration, vhci devices (platform device) will 
be added and removed when they are not used. When the vhci driver is 
loaded, USBIP_VHCI_INIT_HCS (default is 1) drivers are registered. They 
will be further registered upto USBIP_VHCI_MAX_HCS (default is 1). They 
are unregistered when number of free devices becomes more than 
VHCI_FREE_HCS(2) except the first device.

4. Wording

Wording inconsistencies in function and variable names are corrected 
according to the rule below. They were not strict because only one host 
controller was handled.

rhport, HC_PORTS: ports within a controller (or root hub).
port, nports: ports across the controllers.

5. Dependencis

This series depends on 'usbip: exporting devices' patch set because 
this includes changes to application side daemon which introduced the 
patch set.

---
Version information

v4)
# Changed the method to set number of controllers from a module 
parameter to kernel config.
# Excluded event thread patch merged to 4.7-rc1.
# Added dynamic extension.

v3)
# Fixed conflicts against linux-next 20160209.
# Changed sysfs object and attribute name for old tools compatibility.
# Changed nports status format not to include num_controllers value.
# Fixed checkpatch errors and warnings.

v2)
# Added static to some functions and variables not called from other 
files. 

*** BLURB HERE ***

Nobuo Iwata (3):
  usbip: vhci extension: modifications to vhci driver
  usbip: vhci extension: modifications to userspace
  usbip: vhci extension: dynamic extension

 drivers/usb/usbip/Kconfig|  32 ++
 drivers/usb/usbip/vhci.h |  84 -
 drivers/usb/usbip/vhci_hcd.c | 468 +--
 drivers/usb/usbip/vhci_rx.c  |  31 +-
 drivers/usb/usbip/vhci_sysfs.c   | 303 +
 drivers/usb/usbip/vhci_tx.c  |   6 +-
 tools/usb/usbip/libsrc/vhci_driver.c | 398 ---
 tools/usb/usbip/libsrc/vhci_driver.h |  45 +--
 tools/usb/usbip/src/usbip_attach.c   |   8 +-
 tools/usb/usbip/src/usbip_port.c |  13 +-
 tools/usb/usbip/src/usbipd_app.c |  49 ++-
 11 files changed, 983 insertions(+), 454 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 0/2] Add a new Rockchip usb2 phy driver

2016-06-12 Thread Frank Wang
The newer SoCs (rk3366, rk3399) of Rock-chip take a different usb-phy
IP block than rk3288 and before, and most of phy-related registers are
also different from the past, so a new phy driver is required necessarily.

These series patches add phy-rockchip-inno-usb2.c and the corresponding
documentation.

Changes in v5:
 - Added 'reg' property both in devicetree bindings and driver to match the 
different phy-blocks.

Changes in v4:
 - Used 'phy-supply' instead of 'vbus_*-supply'.

Changes in v3:
 - Supplemented some hardware-description into the devicetree bindings.
 - Resolved the mapping defect between fixed value in driver and the property
   in devicetree.
 - Code cleanup.

Changes in v2:
 - Specified more hardware-description into the devicetree bindings.
 - Optimized some process of driver.

Frank Wang (2):
  Documentation: bindings: add DT documentation for Rockchip USB2PHY
  phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy

 .../bindings/phy/phy-rockchip-inno-usb2.txt|   64 ++
 drivers/phy/Kconfig|7 +
 drivers/phy/Makefile   |1 +
 drivers/phy/phy-rockchip-inno-usb2.c   |  645 
 4 files changed, 717 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
 create mode 100644 drivers/phy/phy-rockchip-inno-usb2.c

-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 2/2] phy: rockchip-inno-usb2: add a new driver for Rockchip usb2phy

2016-06-12 Thread Frank Wang
The newer SoCs (rk3366, rk3399) take a different usb-phy IP block
than rk3288 and before, and most of phy-related registers are also
different from the past, so a new phy driver is required necessarily.

Signed-off-by: Frank Wang 
---

Changes in v5:
 - Added 'reg' in the data block to match the different phy-blocks in dt.

Changes in v4:
 - Removed some processes related to 'vbus_host-supply'.

Changes in v3:
 - Resolved the mapping defect between fixed value in driver and the property
   in devicetree.
 - Optimized 480m output clock register function.
 - Code cleanup.

Changes in v2:
 - Changed vbus_host operation from gpio to regulator in *_probe.
 - Improved the fault treatment relate to 480m clock register.
 - Cleaned up some meaningless codes in *_clk480m_disable.
 - made more clear the comment of *_sm_work.

 drivers/phy/Kconfig  |7 +
 drivers/phy/Makefile |1 +
 drivers/phy/phy-rockchip-inno-usb2.c |  645 ++
 3 files changed, 653 insertions(+)
 create mode 100644 drivers/phy/phy-rockchip-inno-usb2.c

diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index b869b98..29ef15c 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -347,6 +347,13 @@ config PHY_ROCKCHIP_USB
help
  Enable this to support the Rockchip USB 2.0 PHY.
 
+config PHY_ROCKCHIP_INNO_USB2
+   tristate "Rockchip INNO USB2PHY Driver"
+   depends on ARCH_ROCKCHIP && OF
+   select GENERIC_PHY
+   help
+ Support for Rockchip USB2.0 PHY with Innosilicon IP block.
+
 config PHY_ROCKCHIP_EMMC
tristate "Rockchip EMMC PHY Driver"
depends on ARCH_ROCKCHIP && OF
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 9c3e73c..4963fbc 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -38,6 +38,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)+= 
phy-s5pv210-usb2.o
 obj-$(CONFIG_PHY_EXYNOS5_USBDRD)   += phy-exynos5-usbdrd.o
 obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)+= phy-qcom-apq8064-sata.o
 obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
+obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2)   += phy-rockchip-inno-usb2.o
 obj-$(CONFIG_PHY_ROCKCHIP_EMMC) += phy-rockchip-emmc.o
 obj-$(CONFIG_PHY_ROCKCHIP_DP)  += phy-rockchip-dp.o
 obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)+= phy-qcom-ipq806x-sata.o
diff --git a/drivers/phy/phy-rockchip-inno-usb2.c 
b/drivers/phy/phy-rockchip-inno-usb2.c
new file mode 100644
index 000..fc599c7
--- /dev/null
+++ b/drivers/phy/phy-rockchip-inno-usb2.c
@@ -0,0 +1,645 @@
+/*
+ * Rockchip USB2.0 PHY with Innosilicon IP block driver
+ *
+ * Copyright (C) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BIT_WRITEABLE_SHIFT16
+#define SCHEDULE_DELAY (60 * HZ)
+
+enum rockchip_usb2phy_port_id {
+   USB2PHY_PORT_OTG,
+   USB2PHY_PORT_HOST,
+   USB2PHY_NUM_PORTS,
+};
+
+enum rockchip_usb2phy_host_state {
+   PHY_STATE_HS_ONLINE = 0,
+   PHY_STATE_DISCONNECT= 1,
+   PHY_STATE_HS_CONNECT= 2,
+   PHY_STATE_FS_CONNECT= 4,
+};
+
+struct usb2phy_reg {
+   unsigned intoffset;
+   unsigned intbitend;
+   unsigned intbitstart;
+   unsigned intdisable;
+   unsigned intenable;
+};
+
+/**
+ * struct rockchip_usb2phy_port_cfg: usb-phy port configuration.
+ * @phy_sus: phy suspend register.
+ * @ls_det_en: linestate detection enable register.
+ * @ls_det_st: linestate detection state register.
+ * @ls_det_clr: linestate detection clear register.
+ * @utmi_ls: utmi linestate state register.
+ * @utmi_hstdet: utmi host disconnect register.
+ */
+struct rockchip_usb2phy_port_cfg {
+   struct usb2phy_reg  phy_sus;
+   struct usb2phy_reg  ls_det_en;
+   struct usb2phy_reg  ls_det_st;
+   struct usb2phy_reg  ls_det_clr;
+   struct usb2phy_reg  utmi_ls;
+   struct usb2phy_reg  utmi_hstdet;
+};
+
+/**
+ * struct rockchip_usb2phy_cfg: usb-phy configuration.
+ * @reg: the address offset of grf for usb-phy config.
+ * @num_ports: specify how many ports that the phy has.
+ * @clkout_ctl: keep on/turn off output clk of phy.
+ */
+struct rockchip_usb2phy_cfg {
+   unsigned intreg;
+   unsigned intnum_ports;
+ 

[PATCH v5 1/2] Documentation: bindings: add DT documentation for Rockchip USB2PHY

2016-06-12 Thread Frank Wang
Signed-off-by: Frank Wang 
---

Changes in v5:
 - Added 'reg' property to identify the different phy-blocks.

Changes in v4:
 - Used 'phy-supply' instead of 'vbus_*-supply'.

Changes in v3:
 - Added 'clocks' and 'clock-names' optional properties.
 - Specified 'otg-port' and 'host-port' as the sub-node name.

Changes in v2:
 - Changed vbus_host optional property from gpio to regulator.
 - Specified vbus_otg-supply optional property.
 - Specified otg_id and otg_bvalid property.

 .../bindings/phy/phy-rockchip-inno-usb2.txt|   64 
 1 file changed, 64 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt

diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt 
b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
new file mode 100644
index 000..48bb5de
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt
@@ -0,0 +1,64 @@
+ROCKCHIP USB2.0 PHY WITH INNO IP BLOCK
+
+Required properties (phy (parent) node):
+ - compatible : should be one of the listed compatibles:
+   * "rockchip,rk3366-usb2phy"
+   * "rockchip,rk3399-usb2phy"
+ - reg : the address offset of grf for usb-phy configuration.
+ - #clock-cells : should be 0.
+ - clock-output-names : specify the 480m output clock name.
+
+Optional properties:
+ - clocks : phandle + phy specifier pair, for the input clock of phy.
+ - clock-names : input clock name of phy, must be "phyclk".
+
+Required nodes : a sub-node is required for each port the phy provides.
+The sub-node name is used to identify host or otg port,
+and shall be the following entries:
+   * "otg-port" : the name of otg port.
+   * "host-port" : the name of host port.
+
+Required properties (port (child) node):
+ - #phy-cells : must be 0. See ./phy-bindings.txt for details.
+ - interrupts : specify an interrupt for each entry in interrupt-names.
+ - interrupt-names : a list which shall be the following entries:
+   * "otg_id" : for the otg id interrupt.
+   * "otg_bvalid" : for the otg vbus interrupt.
+   * "linestate" : for the host/otg linestate interrupt.
+
+Optional properties:
+ - phy-supply : phandle to a regulator that provides power to VBUS.
+   See ./phy-bindings.txt for details.
+
+Example:
+
+grf: syscon@ff77 {
+   compatible = "rockchip,rk3366-grf", "syscon", "simple-mfd";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+...
+
+   u2phy: usb2-phy@700 {
+   compatible = "rockchip,rk3366-usb2phy";
+   reg = <0x700 0x2c>;
+   #clock-cells = <0>;
+   clock-output-names = "sclk_otgphy0_480m";
+
+   u2phy_otg: otg-port {
+   #phy-cells = <0>;
+   interrupts = ,
+,
+;
+   interrupt-names = "otg_id", "otg_bvalid", "linestate";
+   status = "okay";
+   };
+
+   u2phy_host: host-port {
+   #phy-cells = <0>;
+   interrupts = ;
+   interrupt-names = "linestate";
+   status = "okay";
+   };
+   };
+};
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v8 0/9] usbip: exporting devices

2016-06-12 Thread Nobuo Iwata
Dear all,

This series of patches adds exporting device operation to USB/IP.

1. Overview

Exporting devices may not be a new idea. The request and response PDU 
have been defined in tools/usbip/usbip/src/usbip_network.h.
#define OP_EXPORT   0x06
#define OP_REQ_EXPORT   (OP_REQUEST | OP_EXPORT)
#define OP_REP_EXPORT   (OP_REPLY   | OP_EXPORT)
# struct op_export_request
# struct op_export_reply
#define OP_UNEXPORT 0x07
#define OP_REQ_UNEXPORT (OP_REQUEST | OP_UNEXPORT)
#define OP_REP_UNEXPORT (OP_REPLY   | OP_UNEXPORT)
# struct op_unexport_request
# struct op_unexport_reply 

But they have not been used yet. This series adds new operations: 
'connect' and 'disconnect' using these PDUs.

EXISTING) - invites devices from application(vhci)-side
 +--+ +--+
 device--+ STUB | | application/VHCI |
 +--+ +--+
 1) usbipd ... start daemon
 = = =
 2) usbip list --local
 3) usbip bind
<--- list bound devices ---   4) usbip list --remote
<--- import a device --   5) usbip attach
 = = =
   X disconnected 6) usbip detach
 7) usbip unbind

NEW) - dedicates devices from device(stb)-side
 +--+ +--+
 device--+ STUB | | application/VHCI |
 +--+ +--+
  1) usbipa ... start daemon
 = = =
 2) usbip list --local
 3) usbip connect --- export a device -->
 = = =
 4) usbip disconnect  --- un-export a device --->

 Bind and unbind are done in connect and disconnect internally.

2. The use cases

EXISTING)

In existing way, computers in small distance, having same user account, 
can be easily managed by a same user. Bind in local machine and attach 
in remote machine by the user. The devices can be exporsed 
automatically in the local machine, for example, at strat up. They can 
be attached from remote.

When there are distributes linux nodes with USB devices in internet, 
they are exposed by bind operation at start upr, server behind firewall 
can list and attach the devices.  
   Internet  
 Exposed   +--+++++
 +--+  |Linux |+   |Router, ||Service |
+|device|--|Controller||---|proxy,  ||on  |
|+--+  +--+|   |firewall||Linux   |
+--++--+   ++++
   <--- attach(import)
  USB/IP + WS proxy   WS proxy + USB/IP

NEW)

Assuming that a server computer which runs application and VHCI is in a 
server room and device side machines are small distributed nodes 
outside of the server room, the operator of the server compter is 
different form the distributed nodes. The server computer may be in 
unattended operation. In the new way, after the daemon has been 
started, device can be connected with connect command in the 
distributed nodes. If the distributed nodes doesn't have user 
interface, the connect command can be executed from start up procedure.

In another senario to connect devices to a Linux based cloud service 
using WebSocket proxy, it's needed to establish connection from a 
device inside of firewall to a service outside. Exporting is suitable 
for the senario.

   Home/SOHO/Intranet   Internet  
   +--+ ++   ++
 +--+  |Linux |+|Router, |   |Internet|
+|device|--|Controller|||proxy,  |---|service |
|+--+  +--+||firewall|   |on Linux|
+--++--+++   ++
   connect(export) -->
  USB/IP + WS proxy   WS proxy + USB/IP
ex)
DeviceService 
 sensors . environment analysis 
 cameras . monitoring, recording
 ID/biometric readers  authentication

Connection from outside firewall is usually blocked.
So existing import request sent with attach command doesn't work.

# usbipd (blocked)|| <- # usbip attach

Firewall opens some ports, usually HTTP(80) and HTTPS(443), from inside.
Then export request sent with new connect command works.

# usbip connect  -> # usbipa
 (passed)

3. Combination with vUDC

New operations work with vUDC. --device option specifies vUDC mode as 
well as list operaion. With stub, connect and disconnect execute bind 
and unbind internally. With vUDC, 

[PATCH v8 5/9] usbip: exporting devices: modifications to daemon

2016-06-12 Thread Nobuo Iwata
Refactoring to the daemon.

usbipd_dev.c is device-side specific code extracted from usbipd.c.

usbipd.c is left as common parts for both device(stub)-side and 
application(vhci)-side daemon.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/src/Makefile.am  |   2 +-
 tools/usb/usbip/src/usbipd.c | 235 +++-
 tools/usb/usbip/src/usbipd.h |  39 +
 tools/usb/usbip/src/usbipd_dev.c | 256 +++
 4 files changed, 316 insertions(+), 216 deletions(-)

diff --git a/tools/usb/usbip/src/Makefile.am b/tools/usb/usbip/src/Makefile.am
index 42760c3..1aa5156 100644
--- a/tools/usb/usbip/src/Makefile.am
+++ b/tools/usb/usbip/src/Makefile.am
@@ -9,4 +9,4 @@ usbip_SOURCES := usbip.h utils.h usbip.c utils.c 
usbip_network.c \
 usbip_bind.c usbip_unbind.c usbip_port.c \
 usbip_connect.c usbip_disconnect.c
 
-usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c
+usbipd_SOURCES := usbip_network.h usbipd.c usbipd_dev.c usbip_network.c
diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
index a0972de..ef60026 100644
--- a/tools/usb/usbip/src/usbipd.c
+++ b/tools/usb/usbip/src/usbipd.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2011 matt mooney 
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
  *   2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *   Igor Kotrasinski 
@@ -43,25 +44,19 @@
 #include 
 #include 
 
-#include "usbip_host_driver.h"
-#include "usbip_host_common.h"
-#include "usbip_device_driver.h"
 #include "usbip_common.h"
 #include "usbip_network.h"
+#include "usbipd.h"
 #include "list.h"
 
-#undef  PROGNAME
-#define PROGNAME "usbipd"
 #define MAXSOCKFD 20
 
 #define MAIN_LOOP_TIMEOUT 10
 
-#define DEFAULT_PID_FILE "/var/run/" PROGNAME ".pid"
-
 static const char usbip_version_string[] = PACKAGE_STRING;
 
 static const char usbipd_help_string[] =
-   "usage: usbipd [options]\n"
+   "usage: %s [options]\n"
"\n"
"   -4, --ipv4\n"
"   Bind to IPv4. Default is both.\n"
@@ -82,7 +77,7 @@ static const char usbipd_help_string[] =
"\n"
"   -PFILE, --pid FILE\n"
"   Write process id to FILE.\n"
-   "   If no FILE specified, use " DEFAULT_PID_FILE "\n"
+   "   If no FILE specified, use %s.\n"
"\n"
"   -tPORT, --tcp-port PORT\n"
"   Listen on TCP/IP port PORT.\n"
@@ -93,198 +88,9 @@ static const char usbipd_help_string[] =
"   -v, --version\n"
"   Show version.\n";
 
-static struct usbip_host_driver *driver;
-
 static void usbipd_help(void)
 {
-   printf("%s\n", usbipd_help_string);
-}
-
-static int recv_request_import(int sockfd)
-{
-   struct op_import_request req;
-   struct usbip_exported_device *edev;
-   struct usbip_usb_device pdu_udev;
-   struct list_head *i;
-   int found = 0;
-   int error = 0;
-   int rc;
-
-   memset(, 0, sizeof(req));
-
-   rc = usbip_net_recv(sockfd, , sizeof(req));
-   if (rc < 0) {
-   dbg("usbip_net_recv failed: import request");
-   return -1;
-   }
-   PACK_OP_IMPORT_REQUEST(0, );
-
-   list_for_each(i, >edev_list) {
-   edev = list_entry(i, struct usbip_exported_device, node);
-   if (!strncmp(req.busid, edev->udev.busid, SYSFS_BUS_ID_SIZE)) {
-   info("found requested device: %s", req.busid);
-   found = 1;
-   break;
-   }
-   }
-
-   if (found) {
-   /* should set TCP_NODELAY for usbip */
-   usbip_net_set_nodelay(sockfd);
-
-   /* export device needs a TCP/IP socket descriptor */
-   rc = usbip_export_device(edev, sockfd);
-   if (rc < 0)
-   error = 1;
-   } else {
-   info("requested device not found: %s", req.busid);
-   error = 1;
-   }
-
-   rc = usbip_net_send_op_common(sockfd, OP_REP_IMPORT,
- (!error ? ST_OK : ST_NA));
-   if (rc < 0) {
-   dbg("usbip_net_send_op_common failed: %#0x", OP_REP_IMPORT);
-   return -1;
-   }
-
-   if (error) {
-   dbg("import request busid %s: failed", req.busid);
-   return -1;
-   }
-
-   memcpy(_udev, >udev, sizeof(pdu_udev));
-   usbip_net_pack_usb_device(1, _udev);
-
-   rc = usbip_net_send(sockfd, _udev, sizeof(pdu_udev));
-   if (rc < 0) {
-   dbg("usbip_net_send failed: devinfo");
-   return -1;
-   }
-
-   dbg("import request busid %s: complete", req.busid);
-
-   return 0;
-}
-
-static int send_reply_devlist(int connfd)
-{
-   

[PATCH v8 1/9] usbip: exporting devices: modifications to network header

2016-06-12 Thread Nobuo Iwata
Modification to export and un-export response in 
tools/usb/usbip/src/usbip_network.h. It just changes return code type 
from int to uint32_t as same as other responses.

Added export and un-export request/response to 
Documentation/usb/usbip_protocol.txt.

Signed-off-by: Nobuo Iwata 
---
 Documentation/usb/usbip_protocol.txt | 204 ---
 tools/usb/usbip/src/usbip_network.h  |   5 +-
 2 files changed, 184 insertions(+), 25 deletions(-)

diff --git a/Documentation/usb/usbip_protocol.txt 
b/Documentation/usb/usbip_protocol.txt
index 16b6fe2..d4be5b6 100644
--- a/Documentation/usb/usbip_protocol.txt
+++ b/Documentation/usb/usbip_protocol.txt
@@ -1,20 +1,26 @@
 PRELIMINARY DRAFT, MAY CONTAIN MISTAKES!
 28 Jun 2011
+MODIFIED FOR CONNECT AND DISCONNECT OPERARION.
+07 March 2016
 
-The USB/IP protocol follows a server/client architecture. The server exports 
the
-USB devices and the clients imports them. The device driver for the exported
-USB device runs on the client machine.
+The USB/IP protocol follows a server/client architecture between two computers
+one has USB devices and the other runs application using the devices. There are
+two ways for initiation.
 
-The client may ask for the list of the exported USB devices. To get the list 
the
-client opens a TCP/IP connection towards the server, and sends an 
OP_REQ_DEVLIST
-packet on top of the TCP/IP connection (so the actual OP_REQ_DEVLIST may be 
sent
-in one or more pieces at the low level transport layer). The server sends back
-the OP_REP_DEVLIST packet which lists the exported USB devices. Finally the
-TCP/IP connection is closed.
+The first way is to import devices from application-side. In this way, the
+server runs in device-side and the client runs in application-side. In device
+side user makes devices importable with 'bind' operation.
 
+The client may ask for the list of the importable USB devices. To get the list
+the client opens a TCP/IP connection towards the server, and sends an
+OP_REQ_DEVLIST packet on top of the TCP/IP connection (so the actual
+OP_REQ_DEVLIST may be sent in one or more pieces at the low level transport
+layer). The server sends back the OP_REP_DEVLIST packet which lists the
+importable USB devices. Finally the TCP/IP connection is closed.
+
+   application-sidedevice-side
  virtual host controller usb host
-  "client"   "server"
-  (imports USB devices) (exports USB devices)
+  "client" (lists importable devices)"server"
   | |
   |  OP_REQ_DEVLIST |
   | --> |
@@ -23,18 +29,13 @@ TCP/IP connection is closed.
   | <-- |
   | |
 
-Once the client knows the list of exported USB devices it may decide to use one
-of them. First the client opens a TCP/IP connection towards the server and
-sends an OP_REQ_IMPORT packet. The server replies with OP_REP_IMPORT. If the
-import was successful the TCP/IP connection remains open and will be used
-to transfer the URB traffic between the client and the server. The client may
-send two types of packets: the USBIP_CMD_SUBMIT to submit an URB, and
-USBIP_CMD_UNLINK to unlink a previously submitted URB. The answers of the
-server may be USBIP_RET_SUBMIT and USBIP_RET_UNLINK respectively.
+Once the client knows the list of importable USB devices it may decide to use
+one of them. First the client opens a TCP/IP connection towards the server and
+sends an OP_REQ_IMPORT packet. The server replies with OP_REP_IMPORT.
 
+   application-sidedevice-side
  virtual host controller usb host
-  "client"   "server"
-  (imports USB devices) (exports USB devices)
+  "client"   (imports a USB device)  "server"
   | |
   |  OP_REQ_IMPORT  |
   | --> |
@@ -42,6 +43,32 @@ server may be USBIP_RET_SUBMIT and USBIP_RET_UNLINK 
respectively.
   |  OP_REP_IMPORT  |
   | <-- |
   | |
+
+The second way is to export devices from device-side. In this way, the server
+runs in application-side and the client runs in device-side. The client binds a
+device to export, opens a TCP/IP connection towards the server and sends an
+OP_REQ_EXPORT packet. The server replies with OP_REP_EXPORT.
+
+   application-side   

[PATCH v8 2/9] usbip: exporting devices: modifications to host side libraries

2016-06-12 Thread Nobuo Iwata
usbip_host_find_device() is created based on usbip_host_get_device(). 
usbip_host_get_device() was not used yet.

bind and unbind function are exported for new operations.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/libsrc/usbip_host_common.c | 6 ++
 tools/usb/usbip/libsrc/usbip_host_common.h | 8 
 tools/usb/usbip/src/usbip.h| 3 +++
 tools/usb/usbip/src/usbip_bind.c   | 7 ---
 tools/usb/usbip/src/usbip_unbind.c | 7 ---
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/tools/usb/usbip/libsrc/usbip_host_common.c 
b/tools/usb/usbip/libsrc/usbip_host_common.c
index 9d41522..6a98d6c 100644
--- a/tools/usb/usbip/libsrc/usbip_host_common.c
+++ b/tools/usb/usbip/libsrc/usbip_host_common.c
@@ -256,17 +256,15 @@ int usbip_export_device(struct usbip_exported_device 
*edev, int sockfd)
 }
 
 struct usbip_exported_device *usbip_generic_get_device(
-   struct usbip_host_driver *hdriver, int num)
+   struct usbip_host_driver *hdriver, char *busid)
 {
struct list_head *i;
struct usbip_exported_device *edev;
-   int cnt = 0;
 
list_for_each(i, >edev_list) {
edev = list_entry(i, struct usbip_exported_device, node);
-   if (num == cnt)
+   if (!strncmp(busid, edev->udev.busid, SYSFS_BUS_ID_SIZE))
return edev;
-   cnt++;
}
 
return NULL;
diff --git a/tools/usb/usbip/libsrc/usbip_host_common.h 
b/tools/usb/usbip/libsrc/usbip_host_common.h
index a64b803..f9a9def 100644
--- a/tools/usb/usbip/libsrc/usbip_host_common.h
+++ b/tools/usb/usbip/libsrc/usbip_host_common.h
@@ -38,7 +38,7 @@ struct usbip_host_driver_ops {
void (*close)(struct usbip_host_driver *hdriver);
int (*refresh_device_list)(struct usbip_host_driver *hdriver);
struct usbip_exported_device * (*get_device)(
-   struct usbip_host_driver *hdriver, int num);
+   struct usbip_host_driver *hdriver, char *busid);
 
int (*read_device)(struct udev_device *sdev,
   struct usbip_usb_device *dev);
@@ -86,11 +86,11 @@ static inline int usbip_refresh_device_list(struct 
usbip_host_driver *hdriver)
 }
 
 static inline struct usbip_exported_device *
-usbip_get_device(struct usbip_host_driver *hdriver, int num)
+usbip_get_device(struct usbip_host_driver *hdriver, char *busid)
 {
if (!hdriver->ops.get_device)
return NULL;
-   return hdriver->ops.get_device(hdriver, num);
+   return hdriver->ops.get_device(hdriver, busid);
 }
 
 /* Helper functions for implementing driver backend */
@@ -99,6 +99,6 @@ void usbip_generic_driver_close(struct usbip_host_driver 
*hdriver);
 int usbip_generic_refresh_device_list(struct usbip_host_driver *hdriver);
 int usbip_export_device(struct usbip_exported_device *edev, int sockfd);
 struct usbip_exported_device *usbip_generic_get_device(
-   struct usbip_host_driver *hdriver, int num);
+   struct usbip_host_driver *hdriver, char *busid);
 
 #endif /* __USBIP_HOST_COMMON_H */
diff --git a/tools/usb/usbip/src/usbip.h b/tools/usb/usbip/src/usbip.h
index 84fe66a..c296910 100644
--- a/tools/usb/usbip/src/usbip.h
+++ b/tools/usb/usbip/src/usbip.h
@@ -37,4 +37,7 @@ void usbip_list_usage(void);
 void usbip_bind_usage(void);
 void usbip_unbind_usage(void);
 
+int usbip_bind_device(char *busid);
+int usbip_unbind_device(char *busid);
+
 #endif /* __USBIP_H */
diff --git a/tools/usb/usbip/src/usbip_bind.c b/tools/usb/usbip/src/usbip_bind.c
index fa46141..1c09338 100644
--- a/tools/usb/usbip/src/usbip_bind.c
+++ b/tools/usb/usbip/src/usbip_bind.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2011 matt mooney 
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
  *   2005-2007 Takahiro Hirofuchi
  *
  * This program is free software: you can redistribute it and/or modify
@@ -139,7 +140,7 @@ out:
return status;
 }
 
-static int bind_device(char *busid)
+int usbip_bind_device(char *busid)
 {
int rc;
struct udev *udev;
@@ -200,7 +201,7 @@ int usbip_bind(int argc, char *argv[])
 
switch (opt) {
case 'b':
-   ret = bind_device(optarg);
+   ret = usbip_bind_device(optarg);
goto out;
default:
goto err_out;
diff --git a/tools/usb/usbip/src/usbip_unbind.c 
b/tools/usb/usbip/src/usbip_unbind.c
index a4a496c..cc1ff26 100644
--- a/tools/usb/usbip/src/usbip_unbind.c
+++ b/tools/usb/usbip/src/usbip_unbind.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2011 matt mooney 
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
  *   2005-2007 Takahiro Hirofuchi
  *
  * This program is free software: you can redistribute it 

[PATCH v8 3/9] usbip: exporting devices: new connect operation

2016-06-12 Thread Nobuo Iwata
New connect operation.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/src/Makefile.am |   3 +-
 tools/usb/usbip/src/usbip.c |   9 +-
 tools/usb/usbip/src/usbip.h |   5 +-
 tools/usb/usbip/src/usbip_connect.c | 228 
 4 files changed, 242 insertions(+), 3 deletions(-)

diff --git a/tools/usb/usbip/src/Makefile.am b/tools/usb/usbip/src/Makefile.am
index e81a4eb..0947476 100644
--- a/tools/usb/usbip/src/Makefile.am
+++ b/tools/usb/usbip/src/Makefile.am
@@ -6,6 +6,7 @@ sbin_PROGRAMS := usbip usbipd
 
 usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \
 usbip_attach.c usbip_detach.c usbip_list.c \
-usbip_bind.c usbip_unbind.c usbip_port.c
+usbip_bind.c usbip_unbind.c usbip_port.c \
+usbip_connect.c
 
 usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c
diff --git a/tools/usb/usbip/src/usbip.c b/tools/usb/usbip/src/usbip.c
index d7599d9..584d7d5 100644
--- a/tools/usb/usbip/src/usbip.c
+++ b/tools/usb/usbip/src/usbip.c
@@ -2,7 +2,8 @@
  * command structure borrowed from udev
  * (git://git.kernel.org/pub/scm/linux/hotplug/udev.git)
  *
- * Copyright (C) 2011 matt mooney 
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
  *   2005-2007 Takahiro Hirofuchi
  *
  * This program is free software: you can redistribute it and/or modify
@@ -76,6 +77,12 @@ static const struct command cmds[] = {
.usage = usbip_detach_usage
},
{
+   .name  = "connect",
+   .fn= usbip_connect,
+   .help  = "Connect a USB device to a remote computer",
+   .usage = usbip_connect_usage
+   },
+   {
.name  = "list",
.fn= usbip_list,
.help  = "List exportable or local USB devices",
diff --git a/tools/usb/usbip/src/usbip.h b/tools/usb/usbip/src/usbip.h
index c296910..f365353 100644
--- a/tools/usb/usbip/src/usbip.h
+++ b/tools/usb/usbip/src/usbip.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2011 matt mooney 
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
  *   2005-2007 Takahiro Hirofuchi
  *
  * This program is free software: you can redistribute it and/or modify
@@ -30,12 +31,14 @@ int usbip_list(int argc, char *argv[]);
 int usbip_bind(int argc, char *argv[]);
 int usbip_unbind(int argc, char *argv[]);
 int usbip_port_show(int argc, char *argv[]);
+int usbip_connect(int argc, char *argv[]);
 
 void usbip_attach_usage(void);
 void usbip_detach_usage(void);
 void usbip_list_usage(void);
 void usbip_bind_usage(void);
 void usbip_unbind_usage(void);
+void usbip_connect_usage(void);
 
 int usbip_bind_device(char *busid);
 int usbip_unbind_device(char *busid);
diff --git a/tools/usb/usbip/src/usbip_connect.c 
b/tools/usb/usbip/src/usbip_connect.c
new file mode 100644
index 000..bbecc7e
--- /dev/null
+++ b/tools/usb/usbip/src/usbip_connect.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
+ *   2005-2007 Takahiro Hirofuchi
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "usbip_host_driver.h"
+#include "usbip_host_common.h"
+#include "usbip_device_driver.h"
+#include "usbip_common.h"
+#include "usbip_network.h"
+#include "usbip.h"
+
+static struct usbip_host_driver *driver = _driver;
+
+static const char usbip_connect_usage_string[] =
+   "usbip connect \n"
+   "-r, --remote=Address of a remote computer\n"
+   "-b, --busid=Bus ID of a device to be connected\n"
+   "-d, --device   Run with an alternate driver, e.g. vUDC\n";
+
+void usbip_connect_usage(void)
+{
+   printf("usage: %s", usbip_connect_usage_string);
+}
+
+static int send_export_device(int sockfd, struct usbip_usb_device *udev)
+{
+   int rc;
+   struct op_export_request request;
+   struct op_export_reply   reply;
+   uint16_t code = OP_REP_EXPORT;
+
+   memset(, 0, sizeof(request));
+   memset(, 0, sizeof(reply));
+
+   /* send a request */
+   rc = usbip_net_send_op_common(sockfd, 

[PATCH v8 6/9] usbip: exporting devices: modifications to attach and detach

2016-06-12 Thread Nobuo Iwata
Refactoring to attach and detatch operation. Common parts to new 
application(vhci)-side daemon are moved to libsrc/vhci_driver.c. 

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/libsrc/vhci_driver.c | 99 
 tools/usb/usbip/libsrc/vhci_driver.h |  6 +-
 tools/usb/usbip/src/usbip_attach.c   | 50 ++
 tools/usb/usbip/src/usbip_detach.c   | 13 ++--
 4 files changed, 100 insertions(+), 68 deletions(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index ad92047..b7ca63d 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2005-2007 Takahiro Hirofuchi
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2005-2007 Takahiro Hirofuchi
  */
 
 #include "usbip_common.h"
@@ -7,6 +8,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include "sysfs_utils.h"
 
 #undef  PROGNAME
@@ -215,6 +218,25 @@ static int read_record(int rhport, char *host, unsigned 
long host_len,
return 0;
 }
 
+#define OPEN_HC_MODE_FIRST 0
+#define OPEN_HC_MODE_REOPEN1
+
+static int open_hc_device(int mode)
+{
+   if (mode == OPEN_HC_MODE_REOPEN)
+   udev_device_unref(vhci_driver->hc_device);
+
+   vhci_driver->hc_device =
+   udev_device_new_from_subsystem_sysname(udev_context,
+  USBIP_VHCI_BUS_TYPE,
+  USBIP_VHCI_DRV_NAME);
+   if (!vhci_driver->hc_device) {
+   err("udev_device_new_from_subsystem_sysname failed");
+   return -1;
+   }
+   return 0;
+}
+
 /* -- */
 
 int usbip_vhci_driver_open(void)
@@ -227,28 +249,21 @@ int usbip_vhci_driver_open(void)
 
vhci_driver = calloc(1, sizeof(struct usbip_vhci_driver));
 
-   /* will be freed in usbip_driver_close() */
-   vhci_driver->hc_device =
-   udev_device_new_from_subsystem_sysname(udev_context,
-  USBIP_VHCI_BUS_TYPE,
-  USBIP_VHCI_DRV_NAME);
-   if (!vhci_driver->hc_device) {
-   err("udev_device_new_from_subsystem_sysname failed");
-   goto err;
-   }
+   if (open_hc_device(OPEN_HC_MODE_FIRST))
+   goto err_free_driver;
 
vhci_driver->nports = get_nports();
 
dbg("available ports: %d", vhci_driver->nports);
 
if (refresh_imported_device_list())
-   goto err;
+   goto err_unref_device;
 
return 0;
 
-err:
+err_unref_device:
udev_device_unref(vhci_driver->hc_device);
-
+err_free_driver:
if (vhci_driver)
free(vhci_driver);
 
@@ -277,7 +292,8 @@ void usbip_vhci_driver_close(void)
 
 int usbip_vhci_refresh_device_list(void)
 {
-
+   if (open_hc_device(OPEN_HC_MODE_REOPEN))
+   goto err;
if (refresh_imported_device_list())
goto err;
 
@@ -409,3 +425,58 @@ int usbip_vhci_imported_device_dump(struct 
usbip_imported_device *idev)
 
return 0;
 }
+
+#define MAX_BUFF 100
+int usbip_vhci_create_record(char *host, char *port, char *busid, int rhport)
+{
+   int fd;
+   char path[PATH_MAX+1];
+   char buff[MAX_BUFF+1];
+   int ret;
+
+   ret = mkdir(VHCI_STATE_PATH, 0700);
+   if (ret < 0) {
+   /* if VHCI_STATE_PATH exists, then it better be a directory */
+   if (errno == EEXIST) {
+   struct stat s;
+
+   ret = stat(VHCI_STATE_PATH, );
+   if (ret < 0)
+   return -1;
+   if (!(s.st_mode & S_IFDIR))
+   return -1;
+   } else
+   return -1;
+   }
+
+   snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", rhport);
+
+   fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
+   if (fd < 0)
+   return -1;
+
+   snprintf(buff, MAX_BUFF, "%s %s %s\n",
+   host, port, busid);
+
+   ret = write(fd, buff, strlen(buff));
+   if (ret != (ssize_t) strlen(buff)) {
+   close(fd);
+   return -1;
+   }
+
+   close(fd);
+
+   return 0;
+}
+
+int usbip_vhci_delete_record(int rhport)
+{
+   char path[PATH_MAX+1];
+
+   snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", rhport);
+
+   remove(path);
+   rmdir(VHCI_STATE_PATH);
+
+   return 0;
+}
diff --git a/tools/usb/usbip/libsrc/vhci_driver.h 
b/tools/usb/usbip/libsrc/vhci_driver.h
index fa2316c..f955ada 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.h
+++ b/tools/usb/usbip/libsrc/vhci_driver.h
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2005-2007 Takahiro Hirofuchi
+ * Copyright (C) 2015 

[PATCH v8 4/9] usbip: exporting devices: new disconnect operation

2016-06-12 Thread Nobuo Iwata
New disconnect operation.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/src/Makefile.am|   2 +-
 tools/usb/usbip/src/usbip.c|   6 +
 tools/usb/usbip/src/usbip.h|   2 +
 tools/usb/usbip/src/usbip_disconnect.c | 215 +
 4 files changed, 224 insertions(+), 1 deletion(-)

diff --git a/tools/usb/usbip/src/Makefile.am b/tools/usb/usbip/src/Makefile.am
index 0947476..42760c3 100644
--- a/tools/usb/usbip/src/Makefile.am
+++ b/tools/usb/usbip/src/Makefile.am
@@ -7,6 +7,6 @@ sbin_PROGRAMS := usbip usbipd
 usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \
 usbip_attach.c usbip_detach.c usbip_list.c \
 usbip_bind.c usbip_unbind.c usbip_port.c \
-usbip_connect.c
+usbip_connect.c usbip_disconnect.c
 
 usbipd_SOURCES := usbip_network.h usbipd.c usbip_network.c
diff --git a/tools/usb/usbip/src/usbip.c b/tools/usb/usbip/src/usbip.c
index 584d7d5..f0e9e06 100644
--- a/tools/usb/usbip/src/usbip.c
+++ b/tools/usb/usbip/src/usbip.c
@@ -83,6 +83,12 @@ static const struct command cmds[] = {
.usage = usbip_connect_usage
},
{
+   .name  = "disconnect",
+   .fn= usbip_disconnect,
+   .help  = "Disconnect a USB device from a remote computer",
+   .usage = usbip_disconnect_usage
+   },
+   {
.name  = "list",
.fn= usbip_list,
.help  = "List exportable or local USB devices",
diff --git a/tools/usb/usbip/src/usbip.h b/tools/usb/usbip/src/usbip.h
index f365353..a8cbd16 100644
--- a/tools/usb/usbip/src/usbip.h
+++ b/tools/usb/usbip/src/usbip.h
@@ -32,6 +32,7 @@ int usbip_bind(int argc, char *argv[]);
 int usbip_unbind(int argc, char *argv[]);
 int usbip_port_show(int argc, char *argv[]);
 int usbip_connect(int argc, char *argv[]);
+int usbip_disconnect(int argc, char *argv[]);
 
 void usbip_attach_usage(void);
 void usbip_detach_usage(void);
@@ -39,6 +40,7 @@ void usbip_list_usage(void);
 void usbip_bind_usage(void);
 void usbip_unbind_usage(void);
 void usbip_connect_usage(void);
+void usbip_disconnect_usage(void);
 
 int usbip_bind_device(char *busid);
 int usbip_unbind_device(char *busid);
diff --git a/tools/usb/usbip/src/usbip_disconnect.c 
b/tools/usb/usbip/src/usbip_disconnect.c
new file mode 100644
index 000..8155384
--- /dev/null
+++ b/tools/usb/usbip/src/usbip_disconnect.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
+ *   2005-2007 Takahiro Hirofuchi
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "usbip_host_driver.h"
+#include "usbip_host_common.h"
+#include "usbip_device_driver.h"
+#include "usbip_common.h"
+#include "usbip_network.h"
+#include "usbip.h"
+
+static struct usbip_host_driver *driver = _driver;
+
+static const char usbip_disconnect_usage_string[] =
+   "usbip disconnect \n"
+   "-r, --remote=Address of a remote computer\n"
+   "-b, --busid=Bus ID of a device to be disconnected\n"
+   "-d, --device   Run with an alternate driver, e.g. vUDC\n";
+
+void usbip_disconnect_usage(void)
+{
+   printf("usage: %s", usbip_disconnect_usage_string);
+}
+
+static int send_unexport_device(int sockfd, struct usbip_usb_device *udev)
+{
+   int rc;
+   struct op_unexport_request request;
+   struct op_unexport_reply   reply;
+   uint16_t code = OP_REP_UNEXPORT;
+
+   memset(, 0, sizeof(request));
+   memset(, 0, sizeof(reply));
+
+   /* send a request */
+   rc = usbip_net_send_op_common(sockfd, OP_REQ_UNEXPORT, 0);
+   if (rc < 0) {
+   err("send op_common");
+   return -1;
+   }
+
+   memcpy(, udev, sizeof(struct usbip_usb_device));
+
+   PACK_OP_UNEXPORT_REQUEST(0, );
+
+   rc = usbip_net_send(sockfd, (void *) , sizeof(request));
+   if (rc < 0) {
+   err("send op_export_request");
+   return -1;
+   }
+
+   /* receive a reply */
+   rc = usbip_net_recv_op_common(sockfd, );
+   if (rc < 0) {
+   err("recv op_common");
+   return -1;
+   }
+
+  

[PATCH v8 9/9] usbip: exporting devices: chage to documenattion

2016-06-12 Thread Nobuo Iwata
This patch adds function and usage of new connect operation, disconnect 
operation and application(vhci)-side daemon to README and manuals.

At this point, the wording, 'server' and 'client' are ambiguous in 
several place.

For existing attach command, the daemon runs device side machine and 
attach command is executed in application side machine. Then 'server' 
is used for device side and 'client' is for application side.

For the new connect command, the daemon runs applications side machine 
and connect command is executed in device side machine. Now, 'server' 
and 'client' run in different machine than before.

So, to avoid confusion, words 'device side (machine)' and 'application 
side (machine)' are used instead of 'client' and 'server'.

Please, see also diagrams in the cover letter.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/Makefile.am  |   2 +-
 tools/usb/usbip/README   |  70 --
 tools/usb/usbip/doc/usbip.8  | 136 ---
 tools/usb/usbip/doc/usbipa.8 |  79 
 tools/usb/usbip/doc/usbipd.8 |  37 ++
 5 files changed, 264 insertions(+), 60 deletions(-)

diff --git a/tools/usb/usbip/Makefile.am b/tools/usb/usbip/Makefile.am
index 66f8bf0..f371ed9 100644
--- a/tools/usb/usbip/Makefile.am
+++ b/tools/usb/usbip/Makefile.am
@@ -3,4 +3,4 @@ includedir = @includedir@/usbip
 include_HEADERS := $(addprefix libsrc/, \
 usbip_common.h vhci_driver.h usbip_host_driver.h)
 
-dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8)
+dist_man_MANS := $(addprefix doc/, usbip.8 usbipd.8 usbipa.8)
diff --git a/tools/usb/usbip/README b/tools/usb/usbip/README
index 831f49f..74f4afb 100644
--- a/tools/usb/usbip/README
+++ b/tools/usb/usbip/README
@@ -1,7 +1,8 @@
 #
 # README for usbip-utils
 #
-# Copyright (C) 2011 matt mooney 
+# Copyright (C) 2015 Nobuo Iwata
+#   2011 matt mooney 
 #   2005-2008 Takahiro Hirofuchi
 
 
@@ -36,41 +37,70 @@
 
 
 [Usage]
-server:# (Physically attach your USB device.)
+Device-side: a machine has USB device(s).
+Application-side: a machine runs an application software uses remote USB 
device.
 
-server:# insmod usbip-core.ko
-server:# insmod usbip-host.ko
+1) Connect from application-side to device-side.
 
-server:# usbipd -D
+dev:# (Physically attach your USB device.)
+
+dev:# insmod usbip-core.ko
+dev:# insmod usbip-host.ko
+
+dev:# usbipd -D
- Start usbip daemon.
 
-server:# usbip list -l
-   - List driver assignments for USB devices.
+dev:# usbip list -l
+   - List driver assignments for USB devices and their busid.
 
-server:# usbip bind --busid 1-2
-   - Bind usbip-host.ko to the device with busid 1-2.
-   - The USB device 1-2 is now exportable to other hosts!
-   - Use `usbip unbind --busid 1-2' to stop exporting the device.
+dev:# usbip bind --busid 
+   - Bind usbip-host.ko to the device with .
+   - The USB device with  is now exportable to other hosts!
+   - Use `usbip unbind --busid ` to stop exporting the device.
 
-client:# insmod usbip-core.ko
-client:# insmod vhci-hcd.ko
+app:# insmod usbip-core.ko
+app:# insmod vhci-hcd.ko
 
-client:# usbip list --remote 
+app:# usbip list --remote 
- List exported USB devices on the .
 
-client:# usbip attach --remote  --busid 1-2
+app:# usbip attach --remote  --busid 
- Connect the remote USB device.
 
-client:# usbip port
+app:# usbip port
- Show virtual port status.
 
-client:# usbip detach --port 
+app:# usbip detach --port 
- Detach the USB device.
 
+2) Connect from device-side to application-side.
+
+app:# insmod usbip-core.ko
+app:# insmod vhci-hcd.ko
+
+app:# usbipa -D
+   - Start usbip daemon.
+
+dev:# (Physically attach your USB device.)
+
+dev:# insmod usbip-core.ko
+dev:# insmod usbip-host.ko
+
+dev:# usbip list -l
+   - List driver assignments for USB devices and their busid.
+
+dev:# usbip connect --remote  --busid 
+   - Bind usbip-host.ko to the device with .
+   - The USB device of  is connected to remote host!
+
+dev:# usbip disconnect --remote  --busid 
+   - The USB device with  is disconnected from remote host.
+   - Unbind usbip-host.ko from the device.
+
 
 [Example]
 ---
-   SERVER SIDE
+   DEVICE SIDE
 ---
 Physically attach your USB devices to this host.
 
@@ -131,7 +161,7 @@ Mark the device of busid 3-3.2 as exportable:
 ...
 
 ---
-   CLIENT SIDE
+ APPLICATION SIDE
 ---
 First, let's list available remote devices that are marked as
 exportable on the host.
@@ -170,7 +200,7 @@ Attach a remote USB device:
 deux:# usbip attach --remote 10.0.0.3 --busid 1-1
 port 0 attached
 

[PATCH v8 7/9] usbip: exporting devices: new application-side daemon

2016-06-12 Thread Nobuo Iwata
New application(vhci)-side daemon.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/libsrc/vhci_driver.c |  19 +++
 tools/usb/usbip/libsrc/vhci_driver.h |   1 +
 tools/usb/usbip/src/Makefile.am  |   7 +-
 tools/usb/usbip/src/usbipd.c |  12 +-
 tools/usb/usbip/src/usbipd_app.c | 243 +++
 5 files changed, 280 insertions(+), 2 deletions(-)

diff --git a/tools/usb/usbip/libsrc/vhci_driver.c 
b/tools/usb/usbip/libsrc/vhci_driver.c
index b7ca63d..50c723d 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -314,6 +314,25 @@ int usbip_vhci_get_free_port(void)
return -1;
 }
 
+struct usbip_imported_device *usbip_vhci_find_device(char *host, char *busid)
+{
+   int ret;
+   char rhost[NI_MAXHOST] = "unknown host";
+   char rserv[NI_MAXSERV] = "unknown port";
+   char rbusid[SYSFS_BUS_ID_SIZE];
+
+   for (int i = 0; i < vhci_driver->nports; i++) {
+   ret = read_record(vhci_driver->idev[i].port, rhost, NI_MAXHOST,
+   rserv, NI_MAXSERV, rbusid);
+   if (!ret &&
+   !strncmp(host, rhost, NI_MAXHOST) &&
+   !strncmp(busid, rbusid, SYSFS_BUS_ID_SIZE)) {
+   return vhci_driver->idev + i;
+   }
+   }
+   return NULL;
+}
+
 int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid,
uint32_t speed) {
char buff[200]; /* what size should be ? */
diff --git a/tools/usb/usbip/libsrc/vhci_driver.h 
b/tools/usb/usbip/libsrc/vhci_driver.h
index f955ada..acb427d 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.h
+++ b/tools/usb/usbip/libsrc/vhci_driver.h
@@ -46,6 +46,7 @@ int  usbip_vhci_refresh_device_list(void);
 
 
 int usbip_vhci_get_free_port(void);
+struct usbip_imported_device *usbip_vhci_find_device(char *host, char *busid);
 int usbip_vhci_attach_device2(uint8_t port, int sockfd, uint32_t devid,
uint32_t speed);
 
diff --git a/tools/usb/usbip/src/Makefile.am b/tools/usb/usbip/src/Makefile.am
index 1aa5156..8fdebce 100644
--- a/tools/usb/usbip/src/Makefile.am
+++ b/tools/usb/usbip/src/Makefile.am
@@ -2,11 +2,16 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc 
-DUSBIDS_FILE='"@USBIDS_DIR@/usb.ids"'
 AM_CFLAGS   = @EXTRA_CFLAGS@
 LDADD   = $(top_builddir)/libsrc/libusbip.la
 
-sbin_PROGRAMS := usbip usbipd
+sbin_PROGRAMS := usbip usbipd usbipa
 
 usbip_SOURCES := usbip.h utils.h usbip.c utils.c usbip_network.c \
 usbip_attach.c usbip_detach.c usbip_list.c \
 usbip_bind.c usbip_unbind.c usbip_port.c \
 usbip_connect.c usbip_disconnect.c
+usbip_CFLAGS := $(AM_CFLAGS)
 
 usbipd_SOURCES := usbip_network.h usbipd.c usbipd_dev.c usbip_network.c
+usbipd_CFLAGS := $(AM_CFLAGS)
+
+usbipa_SOURCES := usbip_network.h usbipd.c usbipd_app.c usbip_network.c
+usbipa_CFLAGS := $(AM_CFLAGS) -DUSBIP_DAEMON_APP
diff --git a/tools/usb/usbip/src/usbipd.c b/tools/usb/usbip/src/usbipd.c
index ef60026..71e2d52 100644
--- a/tools/usb/usbip/src/usbipd.c
+++ b/tools/usb/usbip/src/usbipd.c
@@ -64,11 +64,13 @@ static const char usbipd_help_string[] =
"   -6, --ipv6\n"
"   Bind to IPv6. Default is both.\n"
"\n"
+#ifndef USBIP_DAEMON_APP
"   -e, --device\n"
"   Run in device mode.\n"
"   Rather than drive an attached device, create\n"
"   a virtual UDC to bind gadgets to.\n"
"\n"
+#endif
"   -D, --daemon\n"
"   Run as a daemon process.\n"
"\n"
@@ -401,7 +403,9 @@ int main(int argc, char *argv[])
{ "ipv6", no_argument,   NULL, '6' },
{ "daemon",   no_argument,   NULL, 'D' },
{ "debug",no_argument,   NULL, 'd' },
+#ifndef USBIP_DAEMON_APP
{ "device",   no_argument,   NULL, 'e' },
+#endif
{ "pid",  optional_argument, NULL, 'P' },
{ "tcp-port", required_argument, NULL, 't' },
{ "help", no_argument,   NULL, 'h' },
@@ -430,7 +434,11 @@ int main(int argc, char *argv[])
cmd = cmd_standalone_mode;
usbip_init_driver();
for (;;) {
-   opt = getopt_long(argc, argv, "46DdeP::t:hv", longopts, NULL);
+   opt = getopt_long(argc, argv, "46Dd"
+#ifndef USBIP_DAEMON_APP
+ "e"
+#endif
+ "P::t:hv", longopts, NULL);
 
if (opt == -1)
break;
@@ -460,9 +468,11 @@ int main(int argc, char *argv[])
case 'v':
cmd = cmd_version;
break;
+#ifndef USBIP_DAEMON_APP
case 'e':
usbip_update_driver();
break;
+#endif
case '?':
 

Re: Multiple chatty devices on Intel 5 Series/3400 USB2 EHCI controller act erratic

2016-06-12 Thread Alan Stern
On Sun, 12 Jun 2016, Sean M. Pappalardo wrote:

> Hello again.
> 
> On 06/12/2016 07:57 AM, Alan Stern wrote:
> > Would you mind posting the contents of 
> > /sys/kernel/debug/usb/ehci/:00:1d.0/periodic, for the patched 
> > kernel, while the test is running?
> 
> Sure, attached. Sorry I didn't think to gather that before.

Okay, thanks.  I just wanted to be sure the patch was behaving as 
intended.  It was, but since it didn't fix your problem the whole 
thing's a moot point.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v8 8/9] usbip: exporting devices: change to usbip_list.c

2016-06-12 Thread Nobuo Iwata
Correction to wording inconsistency around import and export in 
usbip_list.c.

Please, see also cover letter about wording.

Signed-off-by: Nobuo Iwata 
---
 tools/usb/usbip/src/usbip_list.c | 22 --
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
index f1b38e8..37f9afa 100644
--- a/tools/usb/usbip/src/usbip_list.c
+++ b/tools/usb/usbip/src/usbip_list.c
@@ -1,5 +1,6 @@
 /*
- * Copyright (C) 2011 matt mooney 
+ * Copyright (C) 2015 Nobuo Iwata
+ *   2011 matt mooney 
  *   2005-2007 Takahiro Hirofuchi
  * Copyright (C) 2015-2016 Samsung Electronics
  *   Igor Kotrasinski 
@@ -42,9 +43,9 @@
 #include "usbip.h"
 
 static const char usbip_list_usage_string[] =
-   "usbip list [-p|--parsable] \n"
+   "usbip list \n"
"-p, --parsable Parsable list format\n"
-   "-r, --remote=List the exportable USB devices on \n"
+   "-r, --remote=List the importable USB devices on \n"
"-l, --localList the local USB devices\n";
 
 void usbip_list_usage(void)
@@ -52,7 +53,7 @@ void usbip_list_usage(void)
printf("usage: %s", usbip_list_usage_string);
 }
 
-static int get_exported_devices(char *host, int sockfd)
+static int get_importable_devices(char *host, int sockfd)
 {
char product_name[100];
char class_name[100];
@@ -82,14 +83,14 @@ static int get_exported_devices(char *host, int sockfd)
return -1;
}
PACK_OP_DEVLIST_REPLY(0, );
-   dbg("exportable devices: %d\n", reply.ndev);
+   dbg("importable devices: %d\n", reply.ndev);
 
if (reply.ndev == 0) {
-   info("no exportable devices found on %s", host);
+   info("no importable devices found on %s", host);
return 0;
}
 
-   printf("Exportable USB devices\n");
+   printf("Importable USB devices\n");
printf("==\n");
printf(" - %s\n", host);
 
@@ -134,7 +135,7 @@ static int get_exported_devices(char *host, int sockfd)
return 0;
 }
 
-static int list_exported_devices(char *host)
+static int list_importable_devices(char *host)
 {
int rc;
int sockfd;
@@ -147,9 +148,10 @@ static int list_exported_devices(char *host)
}
dbg("connected to %s:%s", host, usbip_port_string);
 
-   rc = get_exported_devices(host, sockfd);
+   rc = get_importable_devices(host, sockfd);
if (rc < 0) {
err("failed to get device list from %s", host);
+   close(sockfd);
return -1;
}
 
@@ -351,7 +353,7 @@ int usbip_list(int argc, char *argv[])
parsable = true;
break;
case 'r':
-   ret = list_exported_devices(optarg);
+   ret = list_importable_devices(optarg);
goto out;
case 'l':
ret = list_devices(parsable);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] cdc-acm: no data available after port open

2016-06-12 Thread Ladislav Michl
On Sun, Jun 12, 2016 at 11:03:45PM +0200, Ladislav Michl wrote:
> Once ttyACM0 starts behave strangely, read() returns only what's in buffer 
> before
> ttyACM0 was opened and then hangs infinitely. As this bug is hard to trigger, 
> has
> anyone clue where to start debugging?

Forgot to mention, once this happens "usb 3-1.4: clear tt 1 (9061) error -75"
starts showing in the syslog. Also "cdc_acm 3-1.4.3:1.0: failed to set dtr/rts",
but this one is there normally.

ladis
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Multiple chatty devices on Intel 5 Series/3400 USB2 EHCI controller act erratic

2016-06-12 Thread Sean M. Pappalardo
Hello again.

On 06/12/2016 07:57 AM, Alan Stern wrote:
> Would you mind posting the contents of 
> /sys/kernel/debug/usb/ehci/:00:1d.0/periodic, for the patched 
> kernel, while the test is running?

Sure, attached. Sorry I didn't think to gather that before.

Sincerely,
Sean M. Pappalardo
size = 1024
   1:  qh256-0080/88022ed32940 (h2 ep1in [1/0] q1 p2)
   3:  qh8-8020/8801d2d60dc0 (f6 ep5in [1/2] q1 p3)
  11:  qh8-8020/8801d2d60dc0
  19:  qh8-8020/8801d2d60dc0
  27:  qh8-8020/8801d2d60dc0
  35:  qh8-8020/8801d2d60dc0
  43:  qh8-8020/8801d2d60dc0
  51:  qh8-8020/8801d2d60dc0
  59:  qh8-8020/8801d2d60dc0
  67:  qh8-8020/8801d2d60dc0
  75:  qh8-8020/8801d2d60dc0
  83:  qh8-8020/8801d2d60dc0
  91:  qh8-8020/8801d2d60dc0
  99:  qh8-8020/8801d2d60dc0
 107:  qh8-8020/8801d2d60dc0
 115:  qh8-8020/8801d2d60dc0
 123:  qh8-8020/8801d2d60dc0
 131:  qh8-8020/8801d2d60dc0
 139:  qh8-8020/8801d2d60dc0
 147:  qh8-8020/8801d2d60dc0
 155:  qh8-8020/8801d2d60dc0
 163:  qh8-8020/8801d2d60dc0
 171:  qh8-8020/8801d2d60dc0
 179:  qh8-8020/8801d2d60dc0
 187:  qh8-8020/8801d2d60dc0
 195:  qh8-8020/8801d2d60dc0
 203:  qh8-8020/8801d2d60dc0
 211:  qh8-8020/8801d2d60dc0
 219:  qh8-8020/8801d2d60dc0
 227:  qh8-8020/8801d2d60dc0
 235:  qh8-8020/8801d2d60dc0
 243:  qh8-8020/8801d2d60dc0
 251:  qh8-8020/8801d2d60dc0
 257:  qh256-0080/88022ed32940
 259:  qh8-8020/8801d2d60dc0
 267:  qh8-8020/8801d2d60dc0
 275:  qh8-8020/8801d2d60dc0
 283:  qh8-8020/8801d2d60dc0
 291:  qh8-8020/8801d2d60dc0
 299:  qh8-8020/8801d2d60dc0
 307:  qh8-8020/8801d2d60dc0
 315:  qh8-8020/8801d2d60dc0
 319:  sitd1-001e/88008752a540
 320:  sitd1-001e/88008752a240
 321:  sitd1-001e/88008752a600
 322:  sitd1-001e/88008752a480
 323:  sitd1-001e/88008752a4e0 qh8-8020/8801d2d60dc0
 331:  qh8-8020/8801d2d60dc0
 339:  qh8-8020/8801d2d60dc0
 347:  qh8-8020/8801d2d60dc0
 355:  qh8-8020/8801d2d60dc0
 363:  qh8-8020/8801d2d60dc0
 371:  qh8-8020/8801d2d60dc0
 379:  qh8-8020/8801d2d60dc0
 387:  qh8-8020/8801d2d60dc0
 395:  qh8-8020/8801d2d60dc0
 403:  qh8-8020/8801d2d60dc0
 411:  qh8-8020/8801d2d60dc0
 419:  qh8-8020/8801d2d60dc0
 427:  qh8-8020/8801d2d60dc0
 435:  qh8-8020/8801d2d60dc0
 443:  qh8-8020/8801d2d60dc0
 451:  qh8-8020/8801d2d60dc0
 459:  qh8-8020/8801d2d60dc0
 467:  qh8-8020/8801d2d60dc0
 475:  qh8-8020/8801d2d60dc0
 483:  qh8-8020/8801d2d60dc0
 491:  qh8-8020/8801d2d60dc0
 499:  qh8-8020/8801d2d60dc0
 507:  qh8-8020/8801d2d60dc0
 513:  qh256-0080/88022ed32940
 515:  qh8-8020/8801d2d60dc0
 523:  qh8-8020/8801d2d60dc0
 531:  qh8-8020/8801d2d60dc0
 539:  qh8-8020/8801d2d60dc0
 547:  qh8-8020/8801d2d60dc0
 555:  qh8-8020/8801d2d60dc0
 563:  qh8-8020/8801d2d60dc0
 571:  qh8-8020/8801d2d60dc0
 579:  qh8-8020/8801d2d60dc0
 587:  qh8-8020/8801d2d60dc0
 595:  qh8-8020/8801d2d60dc0
 603:  qh8-8020/8801d2d60dc0
 611:  qh8-8020/8801d2d60dc0
 619:  qh8-8020/8801d2d60dc0
 627:  qh8-8020/8801d2d60dc0
 635:  qh8-8020/8801d2d60dc0
 643:  qh8-8020/8801d2d60dc0
 651:  qh8-8020/8801d2d60dc0
 659:  qh8-8020/8801d2d60dc0
 667:  qh8-8020/8801d2d60dc0
 675:  qh8-8020/8801d2d60dc0
 683:  qh8-8020/8801d2d60dc0
 691:  qh8-8020/8801d2d60dc0
 699:  qh8-8020/8801d2d60dc0
 707:  qh8-8020/8801d2d60dc0
 715:  qh8-8020/8801d2d60dc0
 723:  qh8-8020/8801d2d60dc0
 731:  qh8-8020/8801d2d60dc0
 739:  qh8-8020/8801d2d60dc0
 747:  qh8-8020/8801d2d60dc0
 755:  qh8-8020/8801d2d60dc0
 763:  qh8-8020/8801d2d60dc0
 769:  qh256-0080/88022ed32940
 771:  qh8-8020/8801d2d60dc0
 779:  qh8-8020/8801d2d60dc0
 787:  qh8-8020/8801d2d60dc0
 795:  qh8-8020/8801d2d60dc0
 803:  qh8-8020/8801d2d60dc0
 811:  qh8-8020/8801d2d60dc0
 819:  qh8-8020/8801d2d60dc0
 827:  qh8-8020/8801d2d60dc0
 835:  qh8-8020/8801d2d60dc0
 843:  qh8-8020/8801d2d60dc0
 851:  qh8-8020/8801d2d60dc0
 859:  qh8-8020/8801d2d60dc0
 867:  qh8-8020/8801d2d60dc0
 875:  qh8-8020/8801d2d60dc0
 883:  qh8-8020/8801d2d60dc0
 891:  qh8-8020/8801d2d60dc0
 899:  qh8-8020/8801d2d60dc0
 907:  qh8-8020/8801d2d60dc0
 915:  qh8-8020/8801d2d60dc0
 923:  qh8-8020/8801d2d60dc0
 931:  qh8-8020/8801d2d60dc0
 939:  qh8-8020/8801d2d60dc0
 947:  qh8-8020/8801d2d60dc0
 955:  qh8-8020/8801d2d60dc0
 963:  qh8-8020/8801d2d60dc0
 971:  qh8-8020/8801d2d60dc0
 979:  qh8-8020/8801d2d60dc0
 987:  qh8-8020/8801d2d60dc0
 995:  qh8-8020/8801d2d60dc0
1003:  qh8-8020/8801d2d60dc0
1011:  qh8-8020/8801d2d60dc0
1019:  qh8-8020/8801d2d60dc0


smime.p7s
Description: S/MIME Cryptographic Signature


[BUG] cdc-acm: no data available after port open

2016-06-12 Thread Ladislav Michl
Hi there!

I'm sorry for imprecise subject, but I really have no clue how to describe
shortly...

My setup is IGEPv2 board with DM3730 SoC which has usb device connected
on EHCI controler via hub running linux-4.6. This device acts as serial-usb
converter and feeds IGEP with data. After some time some IGEPs are unable
to read data from ttyACM0, select claims no data are available, although
device is still transmitting. After ttyACM0 is closed and reopened, there
are those data available device sent while port was closed - no more data
are read, those device transmitted since port was opened and read after
next close and reopen. No other process has ttyACM0 opened.
To test above behaviour:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

int main(int argc, char *argv[])
{
int fd;
struct termios tio;

fd = open("/dev/ttyACM0", O_CLOEXEC | O_NOCTTY | O_RDWR);
if (fd == -1) {
printf("open (%d): %s\n", errno, strerror(errno));
return EXIT_FAILURE;
}

memset(, 0, sizeof (struct termios));
if (tcgetattr(fd, ) != 0) {
printf("tcgetattr (%d): %s\n", errno, strerror(errno));
return EXIT_FAILURE;
}
cfsetspeed(, B115200);
cfmakeraw();
tio.c_cflag |= CLOCAL | CREAD;
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
if (tcsetattr(fd, TCSANOW, ) != 0) {
printf("tcgetattr (%d): %s\n", errno, strerror(errno));
return EXIT_FAILURE;
}

while (1) {
char buf[4096];
ssize_t l = read(fd, buf, sizeof(buf) - 1);
switch (l) {
case -1:
printf("read %d: %s\n", errno, strerror(errno));
return EXIT_FAILURE;
case 0:
printf("empty read?\n");
continue;
default:
buf[l] = '\0';
printf("%s", buf);
break;
}
}

return EXIT_SUCCESS;
}

Once ttyACM0 starts behave strangely, read() returns only what's in buffer 
before
ttyACM0 was opened and then hangs infinitely. As this bug is hard to trigger, 
has
anyone clue where to start debugging?

thank you,
ladis
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


usbip/vhci_hcd.c: vhci_get_frame_number

2016-06-12 Thread Lars Täuber
Hello kernel hackers,

please excuse the way I'm writing this. I know I'm for sure braking rules.
I'm trying to use the usbip vhcd_hcd driver to monitor a beehive via an 
exported usb mic. Usbip is great, because I can use a very small router running 
openwrt and export the mic via usbip. Thanks for it!

The usbip README said patches should be sent to Greg Kroah-Hartman but in the 
MAINTAINERS file you all are mentioned. So please excuse me for writing to you 
all.

USBIP works just as expected. But the driver on the client side polutes the 
kernel ring buffer (and syslog) with this message:
[...]
[ 8761.874551] vhci_hcd: Not yet implemented
[ 8761.875561] vhci_hcd: Not yet implemented
[ 8761.876558] vhci_hcd: Not yet implemented
[ 8761.877704] vhci_hcd: Not yet implemented
[ 8761.878592] vhci_hcd: Not yet implemented
[...]

This is annoying because I want to record the sound inside the beehive for at 
least one complete year.
The function that is printing this must be:

drivers/usb/usbip/vhci_hcd.c (lines 942ff):
static int vhci_get_frame_number(struct usb_hcd *hcd)
{
pr_err("Not yet implemented\n");
return 0;
}


It would be nice if you could add some lines like this:
usbip: vhci_get_frame_number
static int vhci_get_frame_number(struct usb_hcd *hcd)
{
static unsigned int to_be_seen = 5;

if (to_be_seen) {
pr_err("Not yet implemented\n");
to_be_seen--;
}
return 0;
}


I'm not a programer nor do I know if this compiles. I can't test this, because 
the server is a standard ubuntu LTS server. I don't want it to run kernels made 
by me.
Maybe a module parameter option or something complete different is the better 
solution.
I'm just a linux user.

Thank you again for this great driver and all the open source you're creating!
Have a good time.

Best regards
Lars Täuber

PS: I'm not subscribed to the mailing list.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: USB broken on Banana Pi in Linux 4.6

2016-06-12 Thread Alan Stern
On Sun, 12 Jun 2016, Marc Haber wrote:

> On Sat, Jun 11, 2016 at 02:55:04PM +0200, Marc Haber wrote:
> > On Tue, Jun 07, 2016 at 10:30:17AM -0700, Greg KH wrote:
> > > Nothing obvious, can you use 'git bisect' to go from 4.5.0 to 4.6.0 to
> > > find the offending commit?
> > 
> > I can. The first round of bisecting let me end up with
> > c8b710b3e4348119924051551b836c94835331b1 as the first bad commit,
> > which is wrong, since c8b710b3e4348119924051551b836c94835331b1^ is bad
> > as well. I am not sure whether things went well since I had to use git
> > bisect skip twice because the resulting kernel wouldn't boot on the pi.
> 
> The kernel panic on boot is caused by bugs in the parport part. I
> worked around these by disabling PARPORT in the kernel configuration.
> 
> However, a weekend of bisecting just sent me back to commit
> d85ce830eef6c10d1e9617172dea4681f02b8424, which is a purely cosmetic
> commit. What totally confuses me is the sheer size of the diff.
> 
> [8/506]mh@fan:~/linux/debug/linux.bad$ less .git/BISECT_LOG 
> [9/507]mh@fan:~/linux/debug/linux.bad$ git log 
> v4.5..d85ce830eef6c10d1e9617172dea4681f02b8424 | cat
> d85ce830eef6c10d1e9617172dea4681f02b8424 perf pmu: Fix misleadingly indented 
> assignment (whitespace)
> [10/508]mh@fan:~/linux/debug/linux.bad$ git diff 
> v4.5..d85ce830eef6c10d1e9617172dea4681f02b8424 | wc -l
> 811131
> [11/509]mh@fan:~/linux/debug/linux.bad$ git show 
> d85ce830eef6c10d1e9617172dea4681f02b8424 | wc -l
> 14
> [12/510]mh@fan:~/linux/debug/linux.bad$
> 
> Why do I get a 80+ line diff for a 14 line commit?
> 
> This can't be correct. Hints?

That diff is the difference all the way from v4.5 to the d85ce830eef6
commit.  Not just the commit itself, but also everything along the way.

> Here is the BISECT_LOG:
> 
> git bisect start
> # bad: [2dcd0af568b0cf583645c8a317dd12e344b1c72a] Linux 4.6
> git bisect bad 2dcd0af568b0cf583645c8a317dd12e344b1c72a
> # good: [b562e44f507e863c6792946e4e1b1449fbbac85d] Linux 4.5
> git bisect good b562e44f507e863c6792946e4e1b1449fbbac85d
> # bad: [6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f] Merge branch 'for-4.6' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
> git bisect bad 6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f
> # bad: [96b9b1c95660d4bc5510c5d798d3817ae9f0b391] Merge tag 'tty-4.6-rc1' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
> git bisect bad 96b9b1c95660d4bc5510c5d798d3817ae9f0b391
> # bad: [277edbabf6fece057b14fb6db5e3a34e00f42f42] Merge tag 
> 'pm+acpi-4.6-rc1-1' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
> git bisect bad 277edbabf6fece057b14fb6db5e3a34e00f42f42
> # bad: [5ca5446ec5ba5e79a6f271cd026bb153d6850fcc] Merge tag 'pinctrl-v4.6-1' 
> of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
> git bisect bad 5ca5446ec5ba5e79a6f271cd026bb153d6850fcc
> # bad: [e71c2c1eeb8de7a083a728c5b7e0b83ed1faf047] Merge branch 
> 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
> git bisect bad e71c2c1eeb8de7a083a728c5b7e0b83ed1faf047
> # bad: [54fbad54ebcde9db9c7459e9e379f2350c25e1f1] perf mem record: Check for 
> memory events support
> git bisect bad 54fbad54ebcde9db9c7459e9e379f2350c25e1f1
> # bad: [598b7c6919c7bbcc1243009721a01bc12275ff3e] perf jit: add source line 
> info support
> git bisect bad 598b7c6919c7bbcc1243009721a01bc12275ff3e
> # bad: [3848c23b19e07188bfa15e3d9a2ac27692f2ff3c] perf report: Don't show 
> blank lines if entry has no callchain
> git bisect bad 3848c23b19e07188bfa15e3d9a2ac27692f2ff3c
> # bad: [5ac76283b32b116c58e362e99542182ddcfc8262] perf cpumap: Auto 
> initialize cpu__max_{node,cpu}
> git bisect bad 5ac76283b32b116c58e362e99542182ddcfc8262
> # bad: [cfd92dadc5e830268036efb25ff41618f29c3306] perf sort: Provide a way to 
> find out if per-thread bucketing is in place
> git bisect bad cfd92dadc5e830268036efb25ff41618f29c3306
> # bad: [3379e0c3effa87d7734fc06277a7023292aadb0c] perf tools: Document the 
> perf sysctls
> git bisect bad 3379e0c3effa87d7734fc06277a7023292aadb0c
> # bad: [86a2cf3123bfec118bfb98728d88be0668779b2b] perf stat: Making several 
> helper functions static
> git bisect bad 86a2cf3123bfec118bfb98728d88be0668779b2b
> # bad: [403567217d3fa5d4801f820317ada52e5c5f0e53] perf symbols: Do not read 
> symbols/data from device files
> git bisect bad 403567217d3fa5d4801f820317ada52e5c5f0e53
> # bad: [d85ce830eef6c10d1e9617172dea4681f02b8424] perf pmu: Fix misleadingly 
> indented assignment (whitespace)
> git bisect bad d85ce830eef6c10d1e9617172dea4681f02b8424
> # first bad commit: [d85ce830eef6c10d1e9617172dea4681f02b8424] perf pmu: Fix 
> misleadingly indented assignment (whitespace)
> [13/511]mh@fan:~/linux/debug/linux.bad$
> 
> (started with git checkout v4.6, git bisect start, git bisect bad, git
> bisect good v4.5).

According to this log, all the commits you tested were bad.  The only 
good commit listed is v4.5 itself.  That doesn't seem right.

Alan Stern

--
To unsubscribe 

Re: USB broken on Banana Pi in Linux 4.6

2016-06-12 Thread Marc Haber
On Sat, Jun 11, 2016 at 02:55:04PM +0200, Marc Haber wrote:
> On Tue, Jun 07, 2016 at 10:30:17AM -0700, Greg KH wrote:
> > Nothing obvious, can you use 'git bisect' to go from 4.5.0 to 4.6.0 to
> > find the offending commit?
> 
> I can. The first round of bisecting let me end up with
> c8b710b3e4348119924051551b836c94835331b1 as the first bad commit,
> which is wrong, since c8b710b3e4348119924051551b836c94835331b1^ is bad
> as well. I am not sure whether things went well since I had to use git
> bisect skip twice because the resulting kernel wouldn't boot on the pi.

The kernel panic on boot is caused by bugs in the parport part. I
worked around these by disabling PARPORT in the kernel configuration.

However, a weekend of bisecting just sent me back to commit
d85ce830eef6c10d1e9617172dea4681f02b8424, which is a purely cosmetic
commit. What totally confuses me is the sheer size of the diff.

[8/506]mh@fan:~/linux/debug/linux.bad$ less .git/BISECT_LOG 
[9/507]mh@fan:~/linux/debug/linux.bad$ git log 
v4.5..d85ce830eef6c10d1e9617172dea4681f02b8424 | cat
d85ce830eef6c10d1e9617172dea4681f02b8424 perf pmu: Fix misleadingly indented 
assignment (whitespace)
[10/508]mh@fan:~/linux/debug/linux.bad$ git diff 
v4.5..d85ce830eef6c10d1e9617172dea4681f02b8424 | wc -l
811131
[11/509]mh@fan:~/linux/debug/linux.bad$ git show 
d85ce830eef6c10d1e9617172dea4681f02b8424 | wc -l
14
[12/510]mh@fan:~/linux/debug/linux.bad$

Why do I get a 80+ line diff for a 14 line commit?

This can't be correct. Hints?

Here is the BISECT_LOG:

git bisect start
# bad: [2dcd0af568b0cf583645c8a317dd12e344b1c72a] Linux 4.6
git bisect bad 2dcd0af568b0cf583645c8a317dd12e344b1c72a
# good: [b562e44f507e863c6792946e4e1b1449fbbac85d] Linux 4.5
git bisect good b562e44f507e863c6792946e4e1b1449fbbac85d
# bad: [6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f] Merge branch 'for-4.6' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
git bisect bad 6b5f04b6cf8ebab9a65d9c0026c650bb2538fd0f
# bad: [96b9b1c95660d4bc5510c5d798d3817ae9f0b391] Merge tag 'tty-4.6-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
git bisect bad 96b9b1c95660d4bc5510c5d798d3817ae9f0b391
# bad: [277edbabf6fece057b14fb6db5e3a34e00f42f42] Merge tag 'pm+acpi-4.6-rc1-1' 
of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
git bisect bad 277edbabf6fece057b14fb6db5e3a34e00f42f42
# bad: [5ca5446ec5ba5e79a6f271cd026bb153d6850fcc] Merge tag 'pinctrl-v4.6-1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
git bisect bad 5ca5446ec5ba5e79a6f271cd026bb153d6850fcc
# bad: [e71c2c1eeb8de7a083a728c5b7e0b83ed1faf047] Merge branch 
'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad e71c2c1eeb8de7a083a728c5b7e0b83ed1faf047
# bad: [54fbad54ebcde9db9c7459e9e379f2350c25e1f1] perf mem record: Check for 
memory events support
git bisect bad 54fbad54ebcde9db9c7459e9e379f2350c25e1f1
# bad: [598b7c6919c7bbcc1243009721a01bc12275ff3e] perf jit: add source line 
info support
git bisect bad 598b7c6919c7bbcc1243009721a01bc12275ff3e
# bad: [3848c23b19e07188bfa15e3d9a2ac27692f2ff3c] perf report: Don't show blank 
lines if entry has no callchain
git bisect bad 3848c23b19e07188bfa15e3d9a2ac27692f2ff3c
# bad: [5ac76283b32b116c58e362e99542182ddcfc8262] perf cpumap: Auto initialize 
cpu__max_{node,cpu}
git bisect bad 5ac76283b32b116c58e362e99542182ddcfc8262
# bad: [cfd92dadc5e830268036efb25ff41618f29c3306] perf sort: Provide a way to 
find out if per-thread bucketing is in place
git bisect bad cfd92dadc5e830268036efb25ff41618f29c3306
# bad: [3379e0c3effa87d7734fc06277a7023292aadb0c] perf tools: Document the perf 
sysctls
git bisect bad 3379e0c3effa87d7734fc06277a7023292aadb0c
# bad: [86a2cf3123bfec118bfb98728d88be0668779b2b] perf stat: Making several 
helper functions static
git bisect bad 86a2cf3123bfec118bfb98728d88be0668779b2b
# bad: [403567217d3fa5d4801f820317ada52e5c5f0e53] perf symbols: Do not read 
symbols/data from device files
git bisect bad 403567217d3fa5d4801f820317ada52e5c5f0e53
# bad: [d85ce830eef6c10d1e9617172dea4681f02b8424] perf pmu: Fix misleadingly 
indented assignment (whitespace)
git bisect bad d85ce830eef6c10d1e9617172dea4681f02b8424
# first bad commit: [d85ce830eef6c10d1e9617172dea4681f02b8424] perf pmu: Fix 
misleadingly indented assignment (whitespace)
[13/511]mh@fan:~/linux/debug/linux.bad$

(started with git checkout v4.6, git bisect start, git bisect bad, git
bisect good v4.5).

Greetings
Marc


-- 
-
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany|  lose things."Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] hid: migrate Riso Kagaku LED driver from USB misc to HID

2016-06-12 Thread Heiner Kallweit
The Riso Kagaku Webmail Notifier (and its clones) is supported as part of
usb/misc/usbled driver currently. This patch migrates the driver for this
device to the HID subsystem.

Benefits:
- Avoid using USB low-level calls and use the HID subsystem instead
  (as this device provides a USB HID interface)
- Use standard LED subsystem instead of proprietary sysfs entries,
  this allows e.g. to use the device with features like triggers

I know at least one cheap clone coming with green and blue LED switched.
There's a module paramater to deal with this.

There might be users of the current module, therefore so far allow
compilation of the new driver only if the old one is disabled.

Signed-off-by: Heiner Kallweit 
---
v2:
- change config symbol from HID_RIKA to HID_RISO_KAGAKU
- use full name Riso Kagaku instead of rika in several places
- don't remove device from ignore list if CONFIG_USB_LED is defined
- fix module parameter permissions
---
 drivers/hid/Kconfig   |   9 +++
 drivers/hid/Makefile  |   1 +
 drivers/hid/hid-core.c|   3 +
 drivers/hid/hid-riso-kagaku.c | 171 ++
 4 files changed, 184 insertions(+)
 create mode 100644 drivers/hid/hid-riso-kagaku.c

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 5646ca4..16fe27d 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -784,6 +784,15 @@ config HID_HYPERV_MOUSE
---help---
Select this option to enable the Hyper-V mouse driver.
 
+config HID_RISO_KAGAKU
+   tristate "Riso Kagaku Webmail Notifier USB LED"
+   depends on HID
+   depends on LEDS_CLASS
+   depends on USB_LED = 'n'
+   ---help---
+   Support for the Riso Kagaku Webmail Notifier. This driver registers
+   a LED class instance for red, green, and blue color component.
+
 config HID_SMARTJOYPLUS
tristate "SmartJoy PLUS PS2/USB adapter support"
depends on HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index a2fb562..90300f3 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -91,6 +91,7 @@ obj-$(CONFIG_HID_STEELSERIES) += hid-steelseries.o
 obj-$(CONFIG_HID_SUNPLUS)  += hid-sunplus.o
 obj-$(CONFIG_HID_GREENASIA)+= hid-gaff.o
 obj-$(CONFIG_HID_THINGM)   += hid-thingm.o
+obj-$(CONFIG_HID_RISO_KAGAKU)  += hid-riso-kagaku.o
 obj-$(CONFIG_HID_THRUSTMASTER) += hid-tmff.o
 obj-$(CONFIG_HID_TIVO) += hid-tivo.o
 obj-$(CONFIG_HID_TOPSEED)  += hid-topseed.o
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 8ea3a26..730589a 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2008,6 +2008,7 @@ static const struct hid_device_id 
hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, 
USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
+   { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, 
USB_DEVICE_ID_RI_KA_WEBMAIL) },
 #if IS_ENABLED(CONFIG_HID_ROCCAT)
{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) },
@@ -2486,7 +2487,9 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) 
},
 #endif
{ HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, 
USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
+#if IS_ENABLED(CONFIG_USB_LED)
{ HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, 
USB_DEVICE_ID_RI_KA_WEBMAIL) },
+#endif
{ }
 };
 
diff --git a/drivers/hid/hid-riso-kagaku.c b/drivers/hid/hid-riso-kagaku.c
new file mode 100644
index 000..0a37f18
--- /dev/null
+++ b/drivers/hid/hid-riso-kagaku.c
@@ -0,0 +1,171 @@
+/*
+ * Riso Kagaku Webmail Notifier USB RGB LED driver
+ *
+ * Copyright 2016 Heiner Kallweit 
+ * Based on drivers/hid/hid-thingm.c and
+ * drivers/usb/misc/usbled.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "hid-ids.h"
+
+#define REPORT_SIZE6
+
+static unsigned const char riso_kagaku_tbl[] = {
+/* R+2G+4B -> riso kagaku color index */
+   [0] = 0, /* black   */
+   [1] = 2, /* red */
+   [2] = 1, /* green   */
+   [3] = 5, /* yellow  */
+   [4] = 3, /* blue*/
+   [5] = 6, /* magenta */
+   [6] = 4, /* cyan*/
+   [7] = 7  /* white   */
+};
+
+#define RISO_KAGAKU_IX(r, g, b) riso_kagaku_tbl[((r)?1:0)+((g)?2:0)+((b)?4:0)]
+
+struct rika_led {
+   struct led_classdev cdev;
+   struct rika_device  *rdev;
+   charname[32];
+};
+
+struct rika_device {
+   struct rika_led red;
+   struct 

Re: Multiple chatty devices on Intel 5 Series/3400 USB2 EHCI controller act erratic

2016-06-12 Thread Alan Stern
On Sat, 11 Jun 2016, Sean M. Pappalardo wrote:

> 
> 
> On 06/10/2016 02:18 PM, Alan Stern wrote:
> > Actually, after reviewing the data files you sent I did have a thought.  
> > Can you try out the patch below and see if it makes any difference?
> 
> It did not, sorry.

Would you mind posting the contents of 
/sys/kernel/debug/usb/ehci/:00:1d.0/periodic, for the patched 
kernel, while the test is running?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 13/14] usb: gadget: udc: adapt to OTG core

2016-06-12 Thread Peter Chen
On Fri, Jun 10, 2016 at 04:07:22PM +0300, Roger Quadros wrote:
>  
> +/**
> + * usb_otg_add_gadget_udc - adds a new gadget to the udc class driver list
> + * @parent: the parent device to this udc. Usually the controller
> + * driver's device.

It seems it should be udc device

> +/* udc_lock must be held */
>  static int udc_bind_to_driver(struct usb_udc *udc, struct usb_gadget_driver 
> *driver)
>  {
>   int ret;
> @@ -1282,17 +1449,26 @@ static int udc_bind_to_driver(struct usb_udc *udc, 
> struct usb_gadget_driver *dri
>   ret = driver->bind(udc->gadget, driver);
>   if (ret)
>   goto err1;
> - ret = usb_gadget_udc_start(udc);
> - if (ret) {
> - driver->unbind(udc->gadget);
> - goto err1;
> +
> + /* If OTG/dual-role, the otg core manages UDC start/stop */
> + if (udc->gadget->otg_dev) {
> + mutex_unlock(_lock);
> + usb_otg_gadget_ready(udc->gadget, true);
> + mutex_lock(_lock);
> + } else {
> + ret = usb_gadget_udc_start(udc);
> + if (ret) {
> + mutex_unlock(_lock);
> + driver->unbind(udc->gadget);
> + goto err1;
> + }
> + usb_udc_connect_control(udc);
>   }
> - usb_udc_connect_control(udc);
>  
>   kobject_uevent(>dev.kobj, KOBJ_CHANGE);
>   return 0;
>  err1:
> - if (ret != -EISNAM)
> + if ((ret != -EISNAM) && (ret != -EPROBE_DEFER))

It seems it will not introduce -EPROBE_DEFER with your changes
in udc_bind_to_driver

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 08/14] usb: otg: add OTG/dual-role core

2016-06-12 Thread Peter Chen
On Fri, Jun 10, 2016 at 04:07:17PM +0300, Roger Quadros wrote:
> index dca7856..03f7204 100644
> --- a/drivers/usb/Makefile
> +++ b/drivers/usb/Makefile
> @@ -59,5 +59,6 @@ obj-$(CONFIG_USB_RENESAS_USBHS) += renesas_usbhs/
>  obj-$(CONFIG_USB_GADGET) += gadget/
>  
>  obj-$(CONFIG_USB_COMMON) += common/
> +obj-$(CONFIG_USB_OTG_CORE)   += common/

I don't think you need to make above change, why you do it?

> +
> +/**
> + * usb_otg_get_data() - get usb_otg data structa

%s/structa/structure

> +
> +/**
> + * usb_otg_kick_fsm() - Kick the OTG state machine
> + * @otg_dev: OTG controller device
> + *
> + * Used by USB host/gadget stack to sync OTG related
> + * events to the OTG state machine.
> + * e.g. change in host_bus->b_hnp_enable, gadget->b_hnp_enable
> + *
> + * Return: 0 on success, error value otherwise.
> + */
> +int usb_otg_kick_fsm(struct device *otg_dev)
> +{
> + struct usb_otg *otg;
> +
> + mutex_lock(_list_mutex);
> + otg = usb_otg_get_data(otg_dev);
> + mutex_unlock(_list_mutex);
> + if (!otg) {
> + dev_dbg(otg_dev, "otg: %s: invalid otg device\n",
> + __func__);
> + return -ENODEV;
> + }
> +
> + usb_otg_sync_inputs(otg);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(usb_otg_kick_fsm);

Do you have any users for this API? If no, please delete it in this
version.

> +
> +/**
> + * usb_otg_register_hcd() - Register the host controller to OTG core
> + * @hcd: host controller
> + * @irqnum:  interrupt number
> + * @irqflags:interrupt flags
> + * @ops: HCD ops to interface with the HCD
> + *
> + * This is used by the USB Host stack to register the host controller
> + * to the OTG core. Host controller must not be started by the
> + * caller as it is left upto the OTG state machine to do so.

%s/upto/up to

> +
> +/**
> + * usb_otg_register_gadget() - Register the gadget controller to OTG core
> + * @gadget:  gadget controller instance
> + * @ops: gadget interface ops
> + *
> + * This is used by the USB gadget stack to register the gadget controller
> + * to the OTG core. Gadget controller must not be started by the
> + * caller as it is left upto the OTG state machine to do so.
> + *

%s/upto/up to

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


usb: common: otg-fsm: add license to usb-otg-fsm

2016-06-12 Thread Oscar

usb: common: otg-fsm: add license to usb-otg-fsm.

Fix warning about tainted kernel because usb-otg-fsm has no license.
WARNING: with this patch usb-otg-fsm module can be loaded
but then the kernel hangs. Tested with a udoo quad board.

Signed-off-by: Oscar Curero 
---

--- a/drivers/usb/common/usb-otg-fsm.c.orig 2016-06-12 
12:02:09.269814317 +0200
+++ b/drivers/usb/common/usb-otg-fsm.c  2016-06-12 12:01:54.473000410 
+0200

@@ -21,6 +21,7 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */

+#include 
 #include 
 #include 
 #include 
@@ -452,3 +453,4 @@ int otg_statemachine(struct otg_fsm *fsm
return state_changed;
 }
 EXPORT_SYMBOL_GPL(otg_statemachine);
+MODULE_LICENSE("GPL");
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

2016-06-12 Thread Peter Chen
On Sun, Jun 12, 2016 at 02:26:17PM +0800, Peter Chen wrote:
> On Thu, Jun 09, 2016 at 10:24:44AM +0300, Roger Quadros wrote:
> > On 08/06/16 15:42, Peter Chen wrote:
> > > On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote:
> > >> Hi,
> > >>
> > >> On 08/06/16 12:53, Peter Chen wrote:
> > >>> On Wed, Jun 08, 2016 at 12:03:40PM +0300, Roger Quadros wrote:
> >  +int usb_otg_unregister(struct device *dev)
> >  +{
> >  +  struct usb_otg *otg;
> >  +
> >  +  mutex_lock(_list_mutex);
> >  +  otg = usb_otg_get_data(dev);
> >  +  if (!otg) {
> >  +  dev_err(dev, "otg: %s: device not in otg list\n",
> >  +  __func__);
> >  +  mutex_unlock(_list_mutex);
> >  +  return -EINVAL;
> >  +  }
> >  +
> >  +  /* prevent unregister till both host & gadget have unregistered 
> >  */
> >  +  if (otg->host || otg->gadget) {
> >  +  dev_err(dev, "otg: %s: host/gadget still registered\n",
> >  +  __func__);
> > >>>
> > >>> You need to call mutex_unlock here
> > >>
> > >> Indeed. good catch.
> > >>>
> >  +
> >  +int usb_otg_gadget_ready(struct usb_gadget *gadget, bool ready)
> >  +{
> > >>>
> > >>> What this API is for? Why need it in this version?
> > >>
> > >> we moved gadget to otg registration from udc_bind_to_driver() to 
> > >> usb_add_gadget_udc_release().
> > >> This means there is a window when gadget function driver (e.g. g_zero) 
> > >> is not loaded.
> > >> We don't want to start the gadget controller in that window.
> > >>
> > >> usb_otg_gadget_ready() is used by gadget core to notify the otg core 
> > >> when the function driver
> > >> is ready or not-ready.
> > >>
> > > 
> > > Why you need to move this from gadget's probe to udc's probe? Currently,
> > > the sequence of gadget and udc's probe is random, but udc_bind_to_driver
> > > is called when udc is ready.
> > > 
> > Because we need to support -EPROBE_DEFER at udc probe.
> > At udc_bind_to_driver there is no scope for -EPROBE_DEFER.
> > 
> 
> Why udc_bind_to_driver can't return -EPROBE_DEFER if register to OTG is
> failed?
> 
> > Another issue is that we need to register with otg and have otg->caps 
> > available
> > before driver->bind() is called in udc_bind_to_driver(). Else gadget 
> > function
> > will not have the correct OTG descriptor.
> > 
> 
> You can do register before calling driver->bind.
> 

Please skip my comments, I understand your changes now.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 06/14] usb: gadget.h: Add OTG to gadget interface

2016-06-12 Thread Peter Chen
On Fri, Jun 10, 2016 at 04:07:15PM +0300, Roger Quadros wrote:
> The OTG core will use struct otg_gadget_ops to
> start/stop the gadget controller.
> 
> The main purpose of this interface is to avoid directly
> calling usb_gadget_start/stop() from the OTG core as they
> wouldn't be defined in the built-in symbol table if
> CONFIG_USB_GADGET is m.
> 
> Signed-off-by: Roger Quadros 

Acked-by: Peter Chen 

> ---
>  include/linux/usb/gadget.h | 16 
>  1 file changed, 16 insertions(+)
> 
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index 2dd9e6b..f4fc0aa 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -639,6 +639,22 @@ struct usb_gadget_driver {
>  };
>  
>  
> +/*-*/
> +
> +/**
> + * struct otg_gadget_ops - Interface between OTG core and gadget
> + *
> + * Provided by the gadget core to allow the OTG core to start/stop the gadget
> + *
> + * @start: function to start the gadget
> + * @stop: function to stop the gadget
> + * @connect_control: function to connect/disconnect from the bus
> + */
> +struct otg_gadget_ops {
> + int (*start)(struct usb_gadget *gadget);
> + int (*stop)(struct usb_gadget *gadget);
> + int (*connect_control)(struct usb_gadget *gadget, bool connect);
> +};
>  
>  /*-*/
>  
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v7 2/4] usb: dwc3: add dual-role support

2016-06-12 Thread Peter Chen
On Fri, Jun 10, 2016 at 04:17:28PM +0300, Roger Quadros wrote:
> Register with the USB OTG/DRD core. Since we don't support
> OTG yet we just work as a dual-role device even
> if device tree says "otg".
> 
> Get ID and VBUS information from the OTG controller
> and kick the OTG state machine.
> 

Hi Roger,

I can't apply it after rebase usb-next rc1 and felipe's testing/next.
How to apply it?

Peter
> Signed-off-by: Roger Quadros 
> ---
>  drivers/usb/dwc3/core.c   | 546 
> +-
>  drivers/usb/dwc3/core.h   |  30 ++-
>  drivers/usb/dwc3/gadget.c |   6 +-
>  drivers/usb/dwc3/host.c   |   2 +
>  4 files changed, 574 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index d51c9a9..28d2da2 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -56,6 +56,7 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
>   reg = dwc3_readl(dwc->regs, DWC3_GCTL);
>   reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));
>   reg |= DWC3_GCTL_PRTCAPDIR(mode);
> + dwc->current_mode = mode;
>   dwc3_writel(dwc->regs, DWC3_GCTL, reg);
>  }
>  
> @@ -756,6 +757,448 @@ static int dwc3_core_get_phy(struct dwc3 *dwc)
>   return 0;
>  }
>  
> +/* Get OTG events and sync it to OTG fsm */
> +static void dwc3_otg_fsm_sync(struct dwc3 *dwc)
> +{
> + u32 reg;
> + int id, vbus;
> +
> + /*
> +  * calling usb_otg_sync_inputs() during resume breaks host
> +  * if adapter was removed during suspend as xhci driver
> +  * is not prepared to see hcd removal before xhci_resume.
> +  */
> + if (dwc->otg_prevent_sync)
> + return;
> +
> + reg = dwc3_readl(dwc->regs, DWC3_OSTS);
> + dwc3_trace(trace_dwc3_core, "otgstatus 0x%x\n", reg);
> +
> + id = !!(reg & DWC3_OSTS_CONIDSTS);
> + vbus = !!(reg & DWC3_OSTS_BSESVLD);
> +
> + dwc3_trace(trace_dwc3_core, "id %d vbus %d\n", id, vbus);
> + dwc->otg->fsm.id = id;
> + dwc->otg->fsm.b_sess_vld = vbus;
> + usb_otg_sync_inputs(dwc->otg);
> +}
> +
> +static void dwc3_otg_mask_irq(struct dwc3 *dwc)
> +{
> + dwc->oevten = dwc3_readl(dwc->regs, DWC3_OEVTEN);
> + dwc3_writel(dwc->regs, DWC3_OEVTEN, 0);
> +}
> +
> +static void dwc3_otg_unmask_irq(struct dwc3 *dwc)
> +{
> + dwc3_writel(dwc->regs, DWC3_OEVTEN, dwc->oevten);
> +}
> +
> +static void dwc3_otg_disable_events(struct dwc3 *dwc, u32 disable_mask)
> +{
> + dwc->oevten &= ~(disable_mask);
> + dwc3_writel(dwc->regs, DWC3_OEVTEN, dwc->oevten);
> +}
> +
> +static void dwc3_otg_enable_events(struct dwc3 *dwc, u32 enable_mask)
> +{
> + dwc->oevten |= (enable_mask);
> + dwc3_writel(dwc->regs, DWC3_OEVTEN, dwc->oevten);
> +}
> +
> +#define DWC3_OTG_ALL_EVENTS  (DWC3_OEVTEN_XHCIRUNSTPSETEN | \
> + DWC3_OEVTEN_DEVRUNSTPSETEN | DWC3_OEVTEN_HIBENTRYEN | \
> + DWC3_OEVTEN_CONIDSTSCHNGEN | DWC3_OEVTEN_HRRCONFNOTIFEN | \
> + DWC3_OEVTEN_HRRINITNOTIFEN | DWC3_OEVTEN_ADEVIDLEEN | \
> + DWC3_OEVTEN_ADEVBHOSTENDEN | DWC3_OEVTEN_ADEVHOSTEN | \
> + DWC3_OEVTEN_ADEVHNPCHNGEN | DWC3_OEVTEN_ADEVSRPDETEN | \
> + DWC3_OEVTEN_ADEVSESSENDDETEN | DWC3_OEVTEN_BDEVHOSTENDEN | \
> + DWC3_OEVTEN_BDEVHNPCHNGEN | DWC3_OEVTEN_BDEVSESSVLDDETEN | \
> + DWC3_OEVTEN_BDEVVBUSCHNGE)
> +
> +static int dwc3_drd_start_host(struct usb_otg *otg, int on);
> +static int dwc3_drd_start_gadget(struct usb_otg *otg, int on);
> +static irqreturn_t dwc3_otg_thread_irq(int irq, void *_dwc)
> +{
> + struct dwc3 *dwc = _dwc;
> + unsigned long flags;
> +
> + spin_lock_irqsave(>lock, flags);
> +
> + /*
> +  * this bit is needed for otg-host to work after system suspend/resume
> +  */
> + if ((dwc->otg->state == OTG_STATE_A_HOST) &&
> + !(dwc->oevt & DWC3_OEVT_DEVICEMODE)) {
> + spin_unlock_irqrestore(>lock, flags);
> + dwc3_drd_start_host(dwc->otg, true);
> + spin_lock_irqsave(>lock, flags);
> + }
> +
> + dwc3_otg_fsm_sync(dwc);
> + dwc3_otg_unmask_irq(dwc);
> +
> + dwc->oevt = 0;
> + spin_unlock_irqrestore(>lock, flags);
> +
> + return IRQ_HANDLED;
> +}
> +
> +static irqreturn_t dwc3_otg_irq(int irq, void *_dwc)
> +{
> + struct dwc3 *dwc = _dwc;
> + irqreturn_t ret = IRQ_NONE;
> + u32 reg;
> +
> + reg = dwc3_readl(dwc->regs, DWC3_OEVT);
> + if (reg) {
> + dwc->oevt = reg;
> + dwc3_writel(dwc->regs, DWC3_OEVT, reg);
> + dwc3_otg_mask_irq(dwc);
> + ret = IRQ_WAKE_THREAD;
> + }
> +
> + return ret;
> +}
> +
> +/* - Dual-Role management 
> --- */
> +static void dwc3_otgregs_init(struct dwc3 *dwc)
> +{
> + u32 reg;
> +
> + /*
> +  * Prevent host/device reset from resetting OTG core.
> +  * If we don't do this then xhci_reset (USBCMD.HCRST) will 

Re: [RFC v4 01/14] regulator: of: Add helper for getting all supplies

2016-06-12 Thread Peter Chen
On Fri, Jun 10, 2016 at 12:30:56PM -0500, Rob Herring wrote:
> On Thu, Jun 09, 2016 at 01:42:02PM +0200, Krzysztof Kozlowski wrote:
> > On 06/09/2016 12:29 PM, Mark Brown wrote:
> > > On Thu, Jun 09, 2016 at 11:44:18AM +0200, Krzysztof Kozlowski wrote:
> > >> Few drivers have a need of getting regulator supplies without knowing
> > >> their names:
> > >> 1. The Simple Framebuffer driver works on setup provided by bootloader
> > >>(outside of scope of kernel);
> > >> 2. Generic power sequence driver may be attached to any device node.
> > >>
> > >> Add a Device Tree helper for parsing "-supply" properties and returning
> > >> allocated bulk regulator consumers.
> > > 
> > > I'm still very concerned that this is just an invitation to people to
> > > write half baked regulator consumers and half baked DTs to go along with
> > > it, making it a standard API that doesn't have big red flags on it that
> > > will flag up when "normal" drivers use it is not good.  Right now this
> > > just looks like a standard API and people are going to just start using
> > > it.  If we are going to do this perhaps we need a separate header or
> > > something to help flag this up.
> > 
> > No problem, I can move it to a special header.  Actually, if you dislike
> > this as an API, it does not have to be in header at all.  I can just
> > duplicate the simplefb code.
> > 
> > > In the case of power sequences I'd expect the sequences to perform
> > > operations on named supplies - the core shouldn't know what the supplies
> > > are but the thing specifying the sequence should.
> > 
> > Hm, so maybe passing names like:
> > 
> > usb3503@08 {
> > reset-gpios = < 5 GPIO_ACTIVE_HIGH>;
> > initial-mode = <1>;
> > vdd-supply = <_reg>;
> > foo-supply = <_reg>;
> > 
> > power-sequence;
> > power-sequence-supplies = "vdd", "foo";
> 
> This alone would be fine as it is just one property, but then what's 
> next? power-sequence-delay, power-sequence-clocks, etc. What if you 
> need to express ordering relationship of supplies, clocks, gpios? We end 
> up with a scripting language in DT and we don't want to have that.
> 

Can we do things like below:

- DT describes hardware elements (clock, gpios, etc) for power sequence, and we
need a node for power sequence.
- Power sequence framework handles getting hardware elements.
- Power sequence platform driver handles special sequence for devices,
and we can create some generic drivers for generic devices.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 08/14] usb: otg: add OTG/dual-role core

2016-06-12 Thread Peter Chen
On Thu, Jun 09, 2016 at 10:24:44AM +0300, Roger Quadros wrote:
> On 08/06/16 15:42, Peter Chen wrote:
> > On Wed, Jun 08, 2016 at 01:12:10PM +0300, Roger Quadros wrote:
> >> Hi,
> >>
> >> On 08/06/16 12:53, Peter Chen wrote:
> >>> On Wed, Jun 08, 2016 at 12:03:40PM +0300, Roger Quadros wrote:
>  +int usb_otg_unregister(struct device *dev)
>  +{
>  +struct usb_otg *otg;
>  +
>  +mutex_lock(_list_mutex);
>  +otg = usb_otg_get_data(dev);
>  +if (!otg) {
>  +dev_err(dev, "otg: %s: device not in otg list\n",
>  +__func__);
>  +mutex_unlock(_list_mutex);
>  +return -EINVAL;
>  +}
>  +
>  +/* prevent unregister till both host & gadget have unregistered 
>  */
>  +if (otg->host || otg->gadget) {
>  +dev_err(dev, "otg: %s: host/gadget still registered\n",
>  +__func__);
> >>>
> >>> You need to call mutex_unlock here
> >>
> >> Indeed. good catch.
> >>>
>  +
>  +int usb_otg_gadget_ready(struct usb_gadget *gadget, bool ready)
>  +{
> >>>
> >>> What this API is for? Why need it in this version?
> >>
> >> we moved gadget to otg registration from udc_bind_to_driver() to 
> >> usb_add_gadget_udc_release().
> >> This means there is a window when gadget function driver (e.g. g_zero) is 
> >> not loaded.
> >> We don't want to start the gadget controller in that window.
> >>
> >> usb_otg_gadget_ready() is used by gadget core to notify the otg core when 
> >> the function driver
> >> is ready or not-ready.
> >>
> > 
> > Why you need to move this from gadget's probe to udc's probe? Currently,
> > the sequence of gadget and udc's probe is random, but udc_bind_to_driver
> > is called when udc is ready.
> > 
> Because we need to support -EPROBE_DEFER at udc probe.
> At udc_bind_to_driver there is no scope for -EPROBE_DEFER.
> 

Why udc_bind_to_driver can't return -EPROBE_DEFER if register to OTG is
failed?

> Another issue is that we need to register with otg and have otg->caps 
> available
> before driver->bind() is called in udc_bind_to_driver(). Else gadget function
> will not have the correct OTG descriptor.
> 

You can do register before calling driver->bind.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/2] mfd: ti-smusbdig: Add support for the TI SM-USB-DIG

2016-06-12 Thread kbuild test robot
Hi,

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.7-rc2 next-20160609]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Andrew-F-Davis/mfd-ti-smusbdig-Add-support-for-the-TI-SM-USB-DIG/20160611-012112
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-randconfig-x016-06120748 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "usb_deregister" [drivers/mfd/ti-smusbdig.ko] undefined!
>> ERROR: "usb_get_dev" [drivers/mfd/ti-smusbdig.ko] undefined!
>> ERROR: "usb_interrupt_msg" [drivers/mfd/ti-smusbdig.ko] undefined!
>> ERROR: "usb_register_driver" [drivers/mfd/ti-smusbdig.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data