diff options
author | Harvey Yang <harvey.huawei.yang@gmail.com> | 2012-11-15 16:32:49 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-11-15 17:47:29 -0800 |
commit | a6bb87522f42aea056585282a70de7512d297323 (patch) | |
tree | 11464351f16ccd7e123818f62899add09d176c62 /drivers/staging/usbip | |
parent | 2a38e6fcf9173ffa8acf827c0b5d69863e012434 (diff) | |
download | blackbird-obmc-linux-a6bb87522f42aea056585282a70de7512d297323.tar.gz blackbird-obmc-linux-a6bb87522f42aea056585282a70de7512d297323.zip |
usb: usbip: userspace: remove the port state file when detaching port.
with the last detached port state file remaining, usbip reports error on
attaching. So clean up the state files on detaching.
Signed-off-by: Harvey Yang <harvey.huawei.yang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/usbip')
-rw-r--r-- | drivers/staging/usbip/userspace/src/usbip_detach.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/staging/usbip/userspace/src/usbip_detach.c b/drivers/staging/usbip/userspace/src/usbip_detach.c index 89bf3c195c28..dac5f065755a 100644 --- a/drivers/staging/usbip/userspace/src/usbip_detach.c +++ b/drivers/staging/usbip/userspace/src/usbip_detach.c @@ -19,6 +19,7 @@ #include <sysfs/libsysfs.h> #include <ctype.h> +#include <limits.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -46,6 +47,7 @@ static int detach_port(char *port) { int ret; uint8_t portnum; + char path[PATH_MAX+1]; for (unsigned int i=0; i < strlen(port); i++) if (!isdigit(port[i])) { @@ -57,6 +59,13 @@ static int detach_port(char *port) portnum = atoi(port); + /* remove the port state file */ + + snprintf(path, PATH_MAX, VHCI_STATE_PATH"/port%d", portnum); + + remove(path); + rmdir(VHCI_STATE_PATH); + ret = usbip_vhci_driver_open(); if (ret < 0) { err("open vhci_driver"); |