Lines Matching full:ud
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()
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()
117 static void stub_shutdown_connection(struct usbip_device *ud) in stub_shutdown_connection() argument
119 struct stub_device *sdev = container_of(ud, struct stub_device, ud); in stub_shutdown_connection()
127 if (ud->tcp_socket) { in stub_shutdown_connection()
128 dev_dbg(&sdev->udev->dev, "shutdown sockfd %d\n", ud->sockfd); in stub_shutdown_connection()
129 kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR); in stub_shutdown_connection()
133 if (ud->tcp_rx) { in stub_shutdown_connection()
134 kthread_stop_put(ud->tcp_rx); in stub_shutdown_connection()
135 ud->tcp_rx = NULL; in stub_shutdown_connection()
137 if (ud->tcp_tx) { in stub_shutdown_connection()
138 kthread_stop_put(ud->tcp_tx); in stub_shutdown_connection()
139 ud->tcp_tx = NULL; in stub_shutdown_connection()
148 if (ud->tcp_socket) { in stub_shutdown_connection()
149 sockfd_put(ud->tcp_socket); in stub_shutdown_connection()
150 ud->tcp_socket = NULL; in stub_shutdown_connection()
151 ud->sockfd = -1; in stub_shutdown_connection()
176 static void stub_device_reset(struct usbip_device *ud) in stub_device_reset() argument
178 struct stub_device *sdev = container_of(ud, struct stub_device, ud); in stub_device_reset()
187 spin_lock_irq(&ud->lock); in stub_device_reset()
188 ud->status = SDEV_ST_ERROR; in stub_device_reset()
189 spin_unlock_irq(&ud->lock); in stub_device_reset()
197 spin_lock_irq(&ud->lock); in stub_device_reset()
200 ud->status = SDEV_ST_ERROR; in stub_device_reset()
203 ud->status = SDEV_ST_AVAILABLE; in stub_device_reset()
205 spin_unlock_irq(&ud->lock); in stub_device_reset()
208 static void stub_device_unusable(struct usbip_device *ud) in stub_device_unusable() argument
210 spin_lock_irq(&ud->lock); in stub_device_unusable()
211 ud->status = SDEV_ST_ERROR; in stub_device_unusable()
212 spin_unlock_irq(&ud->lock); in stub_device_unusable()
242 sdev->ud.side = USBIP_STUB; in stub_device_alloc()
243 sdev->ud.status = SDEV_ST_AVAILABLE; in stub_device_alloc()
244 spin_lock_init(&sdev->ud.lock); in stub_device_alloc()
245 sdev->ud.tcp_socket = NULL; in stub_device_alloc()
246 sdev->ud.sockfd = -1; in stub_device_alloc()
257 sdev->ud.eh_ops.shutdown = stub_shutdown_connection; in stub_device_alloc()
258 sdev->ud.eh_ops.reset = stub_device_reset; in stub_device_alloc()
259 sdev->ud.eh_ops.unusable = stub_device_unusable; in stub_device_alloc()
261 usbip_start_eh(&sdev->ud); in stub_device_alloc()
383 usbip_event_add(&busid_priv->sdev->ud, SDEV_EVENT_REMOVED); in shutdown_busid()
386 usbip_stop_eh(&busid_priv->sdev->ud); in shutdown_busid()