Lines Matching refs:sdev

21 	struct stub_device *sdev = dev_get_drvdata(dev);  in usbip_status_show()  local
24 if (!sdev) { in usbip_status_show()
29 spin_lock_irq(&sdev->ud.lock); in usbip_status_show()
30 status = sdev->ud.status; in usbip_status_show()
31 spin_unlock_irq(&sdev->ud.lock); in usbip_status_show()
45 struct stub_device *sdev = dev_get_drvdata(dev); in usbip_sockfd_store() local
50 if (!sdev) { in usbip_sockfd_store()
64 spin_lock_irq(&sdev->ud.lock); in usbip_sockfd_store()
66 if (sdev->ud.status != SDEV_ST_AVAILABLE) { in usbip_sockfd_store()
75 sdev->ud.tcp_socket = socket; in usbip_sockfd_store()
76 sdev->ud.sockfd = sockfd; in usbip_sockfd_store()
78 spin_unlock_irq(&sdev->ud.lock); in usbip_sockfd_store()
80 sdev->ud.tcp_rx = kthread_get_run(stub_rx_loop, &sdev->ud, in usbip_sockfd_store()
82 sdev->ud.tcp_tx = kthread_get_run(stub_tx_loop, &sdev->ud, in usbip_sockfd_store()
85 spin_lock_irq(&sdev->ud.lock); in usbip_sockfd_store()
86 sdev->ud.status = SDEV_ST_USED; in usbip_sockfd_store()
87 spin_unlock_irq(&sdev->ud.lock); in usbip_sockfd_store()
92 spin_lock_irq(&sdev->ud.lock); in usbip_sockfd_store()
93 if (sdev->ud.status != SDEV_ST_USED) in usbip_sockfd_store()
96 spin_unlock_irq(&sdev->ud.lock); in usbip_sockfd_store()
98 usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); in usbip_sockfd_store()
104 spin_unlock_irq(&sdev->ud.lock); in usbip_sockfd_store()
144 struct stub_device *sdev = container_of(ud, struct stub_device, ud); in stub_shutdown_connection() local
153 dev_dbg(&sdev->udev->dev, "shutdown sockfd %d\n", ud->sockfd); in stub_shutdown_connection()
180 stub_device_cleanup_urbs(sdev); in stub_shutdown_connection()
187 spin_lock_irqsave(&sdev->priv_lock, flags); in stub_shutdown_connection()
188 list_for_each_entry_safe(unlink, tmp, &sdev->unlink_tx, list) { in stub_shutdown_connection()
192 list_for_each_entry_safe(unlink, tmp, &sdev->unlink_free, in stub_shutdown_connection()
197 spin_unlock_irqrestore(&sdev->priv_lock, flags); in stub_shutdown_connection()
203 struct stub_device *sdev = container_of(ud, struct stub_device, ud); in stub_device_reset() local
204 struct usb_device *udev = sdev->udev; in stub_device_reset()
248 struct stub_device *sdev; in stub_device_alloc() local
255 sdev = kzalloc(sizeof(struct stub_device), GFP_KERNEL); in stub_device_alloc()
256 if (!sdev) in stub_device_alloc()
259 sdev->udev = usb_get_dev(udev); in stub_device_alloc()
266 sdev->devid = (busnum << 16) | devnum; in stub_device_alloc()
267 sdev->ud.side = USBIP_STUB; in stub_device_alloc()
268 sdev->ud.status = SDEV_ST_AVAILABLE; in stub_device_alloc()
269 spin_lock_init(&sdev->ud.lock); in stub_device_alloc()
270 sdev->ud.tcp_socket = NULL; in stub_device_alloc()
271 sdev->ud.sockfd = -1; in stub_device_alloc()
273 INIT_LIST_HEAD(&sdev->priv_init); in stub_device_alloc()
274 INIT_LIST_HEAD(&sdev->priv_tx); in stub_device_alloc()
275 INIT_LIST_HEAD(&sdev->priv_free); in stub_device_alloc()
276 INIT_LIST_HEAD(&sdev->unlink_free); in stub_device_alloc()
277 INIT_LIST_HEAD(&sdev->unlink_tx); in stub_device_alloc()
278 spin_lock_init(&sdev->priv_lock); in stub_device_alloc()
280 init_waitqueue_head(&sdev->tx_waitq); in stub_device_alloc()
282 sdev->ud.eh_ops.shutdown = stub_shutdown_connection; in stub_device_alloc()
283 sdev->ud.eh_ops.reset = stub_device_reset; in stub_device_alloc()
284 sdev->ud.eh_ops.unusable = stub_device_unusable; in stub_device_alloc()
286 usbip_start_eh(&sdev->ud); in stub_device_alloc()
290 return sdev; in stub_device_alloc()
293 static void stub_device_free(struct stub_device *sdev) in stub_device_free() argument
295 kfree(sdev); in stub_device_free()
300 struct stub_device *sdev = NULL; in stub_probe() local
341 sdev = stub_device_alloc(udev); in stub_probe()
342 if (!sdev) { in stub_probe()
354 dev_set_drvdata(&udev->dev, sdev); in stub_probe()
355 busid_priv->sdev = sdev; in stub_probe()
387 busid_priv->sdev = NULL; in stub_probe()
388 stub_device_free(sdev); in stub_probe()
397 if (busid_priv->sdev && !busid_priv->shutdown_busid) { in shutdown_busid()
399 usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED); in shutdown_busid()
402 usbip_stop_eh(&busid_priv->sdev->ud); in shutdown_busid()
412 struct stub_device *sdev; in stub_disconnect() local
425 sdev = dev_get_drvdata(&udev->dev); in stub_disconnect()
428 if (!sdev) { in stub_disconnect()
455 usb_put_dev(sdev->udev); in stub_disconnect()
458 busid_priv->sdev = NULL; in stub_disconnect()
459 stub_device_free(sdev); in stub_disconnect()