#include "usbip_common.h"
#include "stub.h"
-
-
static int stub_probe(struct usb_interface *interface,
- const struct usb_device_id *id);
+ const struct usb_device_id *id);
static void stub_disconnect(struct usb_interface *interface);
-
/*
* Define device IDs here if you want to explicitly limit exportable devices.
* In the most cases, wild card matching will be ok because driver binding can
.id_table = stub_table,
};
-
/*-------------------------------------------------------------------------*/
/* Define sysfs entries for a usbip-bound device */
spin_unlock(&sdev->ud.lock);
return -EINVAL;
}
-
#if 0
setnodelay(socket);
setkeepalive(socket);
setreuse(socket);
#endif
-
sdev->ud.tcp_socket = socket;
spin_unlock(&sdev->ud.lock);
err_debug:
device_remove_file(dev, &dev_attr_usbip_sockfd);
-
err_sockfd:
device_remove_file(dev, &dev_attr_usbip_status);
-
err_status:
return err;
}
device_remove_file(dev, &dev_attr_usbip_debug);
}
-
-
/*-------------------------------------------------------------------------*/
/* Event handler functions called by an event handler thread */
struct stub_unlink *unlink, *tmp;
spin_lock_irqsave(&sdev->priv_lock, flags);
-
list_for_each_entry_safe(unlink, tmp, &sdev->unlink_tx, list) {
list_del(&unlink->list);
kfree(unlink);
}
-
list_for_each_entry_safe(unlink, tmp,
&sdev->unlink_free, list) {
list_del(&unlink->list);
kfree(unlink);
}
-
spin_unlock_irqrestore(&sdev->priv_lock, flags);
}
}
spin_lock(&ud->lock);
ud->status = SDEV_ST_ERROR;
spin_unlock(&ud->lock);
-
return;
}
spin_unlock(&ud->lock);
}
-
/*-------------------------------------------------------------------------*/
/**
* devnum may change later if a device is reset. However, devid never
* changes during a usbip connection.
*/
- sdev->devid = (busnum << 16) | devnum;
-
- sdev->ud.side = USBIP_STUB;
- sdev->ud.status = SDEV_ST_AVAILABLE;
+ sdev->devid = (busnum << 16) | devnum;
+ sdev->ud.side = USBIP_STUB;
+ sdev->ud.status = SDEV_ST_AVAILABLE;
/* sdev->ud.lock = SPIN_LOCK_UNLOCKED; */
spin_lock_init(&sdev->ud.lock);
- sdev->ud.tcp_socket = NULL;
+ sdev->ud.tcp_socket = NULL;
INIT_LIST_HEAD(&sdev->priv_init);
INIT_LIST_HEAD(&sdev->priv_tx);
return 0;
}
-
/*-------------------------------------------------------------------------*/
/*
/* check we should claim or not by busid_table */
busid_priv = get_busid_priv(udev_busid);
if (!busid_priv || (busid_priv->status == STUB_BUSID_REMOV) ||
- (busid_priv->status == STUB_BUSID_OTHER)) {
+ (busid_priv->status == STUB_BUSID_OTHER)) {
dev_info(&interface->dev,
"this device %s is not in match_busid table. skip!\n",
udev_busid);
if (udev->descriptor.bDeviceClass == USB_CLASS_HUB) {
usbip_udbg("this device %s is a usb hub device. skip!\n",
- udev_busid);
+ udev_busid);
return -ENODEV;
}
if (!strcmp(udev->bus->bus_name, "vhci_hcd")) {
usbip_udbg("this device %s is attached on vhci_hcd. skip!\n",
- udev_busid);
+ udev_busid);
return -ENODEV;
}
-
if (busid_priv->status == STUB_BUSID_ALLOC) {
sdev = busid_priv->sdev;
if (!sdev)
busid_priv->interf_count++;
dev_info(&interface->dev,
- "USB/IP Stub: register a new interface "
- "(bus %u dev %u ifn %u)\n", udev->bus->busnum, udev->devnum,
- interface->cur_altsetting->desc.bInterfaceNumber);
+ "USB/IP Stub: register a new interface "
+ "(bus %u dev %u ifn %u)\n",
+ udev->bus->busnum, udev->devnum,
+ interface->cur_altsetting->desc.bInterfaceNumber);
/* set private data to usb_interface */
usb_set_intfdata(interface, sdev);
/* 2. wait for the stop of the event handler */
usbip_stop_eh(&busid_priv->sdev->ud);
}
-
}
-
/*
* called in usb_disconnect() or usb_deregister()
* but only if actconfig(active configuration) exists
busid_priv->interf_count = 0;
-
/* 1. shutdown the current connection */
shutdown_busid(busid_priv);