Lines Matching full:sb

18 xhci_ring_to_sgtable(struct xhci_sideband *sb, struct xhci_ring *ring)  in xhci_ring_to_sgtable()  argument
28 dev = xhci_to_hcd(sb->xhci)->self.sysdev; in xhci_ring_to_sgtable()
76 /* Caller must hold sb->mutex */
78 __xhci_sideband_remove_endpoint(struct xhci_sideband *sb, struct xhci_virt_ep *ep) in __xhci_sideband_remove_endpoint() argument
80 lockdep_assert_held(&sb->mutex); in __xhci_sideband_remove_endpoint()
86 xhci_stop_endpoint_sync(sb->xhci, ep, 0, GFP_KERNEL); in __xhci_sideband_remove_endpoint()
89 sb->eps[ep->ep_index] = NULL; in __xhci_sideband_remove_endpoint()
92 /* Caller must hold sb->mutex */
94 __xhci_sideband_remove_interrupter(struct xhci_sideband *sb) in __xhci_sideband_remove_interrupter() argument
98 lockdep_assert_held(&sb->mutex); in __xhci_sideband_remove_interrupter()
100 if (!sb->ir) in __xhci_sideband_remove_interrupter()
103 xhci_remove_secondary_interrupter(xhci_to_hcd(sb->xhci), sb->ir); in __xhci_sideband_remove_interrupter()
104 sb->ir = NULL; in __xhci_sideband_remove_interrupter()
105 udev = sb->vdev->udev; in __xhci_sideband_remove_interrupter()
115 * @sb: sideband instance for this usb device
124 void xhci_sideband_notify_ep_ring_free(struct xhci_sideband *sb, in xhci_sideband_notify_ep_ring_free() argument
132 if (sb->notify_client) in xhci_sideband_notify_ep_ring_free()
133 sb->notify_client(sb->intf, &evt); in xhci_sideband_notify_ep_ring_free()
139 * @sb: sideband instance for this usb device
150 xhci_sideband_add_endpoint(struct xhci_sideband *sb, in xhci_sideband_add_endpoint() argument
156 guard(mutex)(&sb->mutex); in xhci_sideband_add_endpoint()
158 if (!sb->vdev) in xhci_sideband_add_endpoint()
162 ep = &sb->vdev->eps[ep_index]; in xhci_sideband_add_endpoint()
175 if (sb->eps[ep_index] || ep->sideband) in xhci_sideband_add_endpoint()
178 ep->sideband = sb; in xhci_sideband_add_endpoint()
179 sb->eps[ep_index] = ep; in xhci_sideband_add_endpoint()
187 * @sb: sideband instance for this usb device
198 xhci_sideband_remove_endpoint(struct xhci_sideband *sb, in xhci_sideband_remove_endpoint() argument
204 guard(mutex)(&sb->mutex); in xhci_sideband_remove_endpoint()
207 ep = sb->eps[ep_index]; in xhci_sideband_remove_endpoint()
209 if (!ep || !ep->sideband || ep->sideband != sb) in xhci_sideband_remove_endpoint()
212 __xhci_sideband_remove_endpoint(sb, ep); in xhci_sideband_remove_endpoint()
220 xhci_sideband_stop_endpoint(struct xhci_sideband *sb, in xhci_sideband_stop_endpoint() argument
227 ep = sb->eps[ep_index]; in xhci_sideband_stop_endpoint()
229 if (!ep || !ep->sideband || ep->sideband != sb) in xhci_sideband_stop_endpoint()
232 return xhci_stop_endpoint_sync(sb->xhci, ep, 0, GFP_KERNEL); in xhci_sideband_stop_endpoint()
238 * @sb: sideband instance for this usb device
250 xhci_sideband_get_endpoint_buffer(struct xhci_sideband *sb, in xhci_sideband_get_endpoint_buffer() argument
257 ep = sb->eps[ep_index]; in xhci_sideband_get_endpoint_buffer()
259 if (!ep || !ep->ring || !ep->sideband || ep->sideband != sb) in xhci_sideband_get_endpoint_buffer()
262 return xhci_ring_to_sgtable(sb, ep->ring); in xhci_sideband_get_endpoint_buffer()
268 * @sb: sideband instance for this usb device
279 xhci_sideband_get_event_buffer(struct xhci_sideband *sb) in xhci_sideband_get_event_buffer() argument
281 if (!sb || !sb->ir) in xhci_sideband_get_event_buffer()
284 return xhci_ring_to_sgtable(sb, sb->ir->event_ring); in xhci_sideband_get_event_buffer()
315 * @sb: sideband instance for this usb device
329 xhci_sideband_create_interrupter(struct xhci_sideband *sb, int num_seg, in xhci_sideband_create_interrupter() argument
335 if (!sb || !sb->xhci) in xhci_sideband_create_interrupter()
338 guard(mutex)(&sb->mutex); in xhci_sideband_create_interrupter()
340 if (!sb->vdev) in xhci_sideband_create_interrupter()
343 if (sb->ir) in xhci_sideband_create_interrupter()
346 sb->ir = xhci_create_secondary_interrupter(xhci_to_hcd(sb->xhci), in xhci_sideband_create_interrupter()
349 if (!sb->ir) in xhci_sideband_create_interrupter()
352 udev = sb->vdev->udev; in xhci_sideband_create_interrupter()
355 sb->ir->ip_autoclear = ip_autoclear; in xhci_sideband_create_interrupter()
363 * @sb: sideband instance for this usb device
369 xhci_sideband_remove_interrupter(struct xhci_sideband *sb) in xhci_sideband_remove_interrupter() argument
371 if (!sb) in xhci_sideband_remove_interrupter()
374 guard(mutex)(&sb->mutex); in xhci_sideband_remove_interrupter()
376 __xhci_sideband_remove_interrupter(sb); in xhci_sideband_remove_interrupter()
382 * @sb: sideband instance for this usb device
393 xhci_sideband_interrupter_id(struct xhci_sideband *sb) in xhci_sideband_interrupter_id() argument
395 if (!sb || !sb->ir) in xhci_sideband_interrupter_id()
398 return sb->ir->intr_num; in xhci_sideband_interrupter_id()
420 struct xhci_sideband *sb; in xhci_sideband_register() local
430 sb = kzalloc_node(sizeof(*sb), GFP_KERNEL, dev_to_node(hcd->self.sysdev)); in xhci_sideband_register()
431 if (!sb) in xhci_sideband_register()
434 mutex_init(&sb->mutex); in xhci_sideband_register()
445 kfree(sb); in xhci_sideband_register()
449 sb->xhci = xhci; in xhci_sideband_register()
450 sb->vdev = vdev; in xhci_sideband_register()
451 sb->intf = intf; in xhci_sideband_register()
452 sb->type = type; in xhci_sideband_register()
453 sb->notify_client = notify_client; in xhci_sideband_register()
454 vdev->sideband = sb; in xhci_sideband_register()
458 return sb; in xhci_sideband_register()
464 * @sb: sideband instance to be unregistered
473 xhci_sideband_unregister(struct xhci_sideband *sb) in xhci_sideband_unregister() argument
479 if (!sb) in xhci_sideband_unregister()
482 xhci = sb->xhci; in xhci_sideband_unregister()
484 scoped_guard(mutex, &sb->mutex) { in xhci_sideband_unregister()
485 vdev = sb->vdev; in xhci_sideband_unregister()
490 if (sb->eps[i]) in xhci_sideband_unregister()
491 __xhci_sideband_remove_endpoint(sb, sb->eps[i]); in xhci_sideband_unregister()
493 __xhci_sideband_remove_interrupter(sb); in xhci_sideband_unregister()
495 sb->vdev = NULL; in xhci_sideband_unregister()
499 sb->xhci = NULL; in xhci_sideband_unregister()
503 kfree(sb); in xhci_sideband_unregister()