20 #include <linux/string.h>
21 #include <linux/module.h>
26 #define DRIVER_AUTHOR "Takahiro Hirofuchi"
27 #define DRIVER_DESC "USB/IP Host Driver"
39 static void init_busid_table(
void)
43 memset(busid_table, 0,
sizeof(busid_table));
54 static int get_busid_idx(
const char *
busid)
60 if (busid_table[i].
name[0])
73 spin_lock(&busid_table_lock);
74 idx = get_busid_idx(busid);
76 bid = &(busid_table[
idx]);
77 spin_unlock(&busid_table_lock);
82 static int add_match_busid(
char *busid)
87 spin_lock(&busid_table_lock);
89 if (get_busid_idx(busid) >= 0) {
95 if (!busid_table[i].name[0]) {
105 spin_unlock(&busid_table_lock);
115 spin_lock(&busid_table_lock);
116 idx = get_busid_idx(busid);
131 spin_unlock(&busid_table_lock);
141 spin_lock(&busid_table_lock);
143 if (busid_table[i].name[0])
144 out +=
sprintf(out,
"%s ", busid_table[i].name);
145 spin_unlock(&busid_table_lock);
169 if (!
strncmp(buf,
"add ", 4)) {
170 if (add_match_busid(busid) < 0) {
176 }
else if (!
strncmp(buf,
"del ", 4)) {
209 priv = stub_priv_pop_from_listhead(&sdev->
priv_init);
213 priv = stub_priv_pop_from_listhead(&sdev->
priv_tx);
217 priv = stub_priv_pop_from_listhead(&sdev->
priv_free);
220 spin_unlock_irqrestore(&sdev->
priv_lock, flags);
232 while ((priv = stub_priv_pop(sdev))) {
239 kfree(urb->transfer_buffer);
240 kfree(urb->setup_packet);
245 static int __init usbip_host_init(
void)
252 if (!stub_priv_cache) {
253 pr_err(
"kmem_cache_create failed\n");
257 ret = usb_register(&stub_driver);
259 pr_err(
"usb_register failed %d\n", ret);
260 goto err_usb_register;
264 &driver_attr_match_busid);
266 pr_err(
"driver_create_file failed\n");
267 goto err_create_file;
280 static void __exit usbip_host_exit(
void)
283 &driver_attr_match_busid);