Lines Matching refs:sdev
35 struct stub_device *sdev = dev_get_drvdata(dev); in usbip_status_show() local
38 if (!sdev) { in usbip_status_show()
43 spin_lock_irq(&sdev->ud.lock); in usbip_status_show()
44 status = sdev->ud.status; in usbip_status_show()
45 spin_unlock_irq(&sdev->ud.lock); in usbip_status_show()
59 struct stub_device *sdev = dev_get_drvdata(dev); in store_sockfd() local
64 if (!sdev) { in store_sockfd()
78 spin_lock_irq(&sdev->ud.lock); in store_sockfd()
80 if (sdev->ud.status != SDEV_ST_AVAILABLE) { in store_sockfd()
89 sdev->ud.tcp_socket = socket; in store_sockfd()
91 spin_unlock_irq(&sdev->ud.lock); in store_sockfd()
93 sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud, in store_sockfd()
95 sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud, in store_sockfd()
98 spin_lock_irq(&sdev->ud.lock); in store_sockfd()
99 sdev->ud.status = SDEV_ST_USED; in store_sockfd()
100 spin_unlock_irq(&sdev->ud.lock); in store_sockfd()
105 spin_lock_irq(&sdev->ud.lock); in store_sockfd()
106 if (sdev->ud.status != SDEV_ST_USED) in store_sockfd()
109 spin_unlock_irq(&sdev->ud.lock); in store_sockfd()
111 usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); in store_sockfd()
117 spin_unlock_irq(&sdev->ud.lock); in store_sockfd()
157 struct stub_device *sdev = container_of(ud, struct stub_device, ud); in stub_shutdown_connection() local
166 dev_dbg(&sdev->udev->dev, "shutdown tcp_socket %p\n", in stub_shutdown_connection()
193 stub_device_cleanup_urbs(sdev); in stub_shutdown_connection()
200 spin_lock_irqsave(&sdev->priv_lock, flags); in stub_shutdown_connection()
201 list_for_each_entry_safe(unlink, tmp, &sdev->unlink_tx, list) { in stub_shutdown_connection()
205 list_for_each_entry_safe(unlink, tmp, &sdev->unlink_free, in stub_shutdown_connection()
210 spin_unlock_irqrestore(&sdev->priv_lock, flags); in stub_shutdown_connection()
216 struct stub_device *sdev = container_of(ud, struct stub_device, ud); in stub_device_reset() local
217 struct usb_device *udev = sdev->udev; in stub_device_reset()
222 ret = usb_lock_device_for_reset(udev, sdev->interface); in stub_device_reset()
261 struct stub_device *sdev; in stub_device_alloc() local
268 sdev = kzalloc(sizeof(struct stub_device), GFP_KERNEL); in stub_device_alloc()
269 if (!sdev) in stub_device_alloc()
272 sdev->udev = usb_get_dev(udev); in stub_device_alloc()
279 sdev->devid = (busnum << 16) | devnum; in stub_device_alloc()
280 sdev->ud.side = USBIP_STUB; in stub_device_alloc()
281 sdev->ud.status = SDEV_ST_AVAILABLE; in stub_device_alloc()
282 spin_lock_init(&sdev->ud.lock); in stub_device_alloc()
283 sdev->ud.tcp_socket = NULL; in stub_device_alloc()
285 INIT_LIST_HEAD(&sdev->priv_init); in stub_device_alloc()
286 INIT_LIST_HEAD(&sdev->priv_tx); in stub_device_alloc()
287 INIT_LIST_HEAD(&sdev->priv_free); in stub_device_alloc()
288 INIT_LIST_HEAD(&sdev->unlink_free); in stub_device_alloc()
289 INIT_LIST_HEAD(&sdev->unlink_tx); in stub_device_alloc()
290 spin_lock_init(&sdev->priv_lock); in stub_device_alloc()
292 init_waitqueue_head(&sdev->tx_waitq); in stub_device_alloc()
294 sdev->ud.eh_ops.shutdown = stub_shutdown_connection; in stub_device_alloc()
295 sdev->ud.eh_ops.reset = stub_device_reset; in stub_device_alloc()
296 sdev->ud.eh_ops.unusable = stub_device_unusable; in stub_device_alloc()
298 usbip_start_eh(&sdev->ud); in stub_device_alloc()
302 return sdev; in stub_device_alloc()
305 static void stub_device_free(struct stub_device *sdev) in stub_device_free() argument
307 kfree(sdev); in stub_device_free()
312 struct stub_device *sdev = NULL; in stub_probe() local
350 sdev = stub_device_alloc(udev); in stub_probe()
351 if (!sdev) in stub_probe()
361 dev_set_drvdata(&udev->dev, sdev); in stub_probe()
362 busid_priv->sdev = sdev; in stub_probe()
391 kthread_stop_put(sdev->ud.eh); in stub_probe()
393 busid_priv->sdev = NULL; in stub_probe()
394 stub_device_free(sdev); in stub_probe()
400 if (busid_priv->sdev && !busid_priv->shutdown_busid) { in shutdown_busid()
402 usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED); in shutdown_busid()
405 usbip_stop_eh(&busid_priv->sdev->ud); in shutdown_busid()
415 struct stub_device *sdev; in stub_disconnect() local
428 sdev = dev_get_drvdata(&udev->dev); in stub_disconnect()
431 if (!sdev) { in stub_disconnect()
452 if (busid_priv->sdev->ud.eh == current) in stub_disconnect()
458 usb_put_dev(sdev->udev); in stub_disconnect()
461 busid_priv->sdev = NULL; in stub_disconnect()
462 stub_device_free(sdev); in stub_disconnect()