mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-27 13:00:25 +09:00
ANDROID: usb: host: add xhci hooks for vendor specific container context
alloc_container_ctx free_container_ctx - called to alloc and free vendor specific container context Bug: 183761108 Signed-off-by: Daehwan Jung <dh10.jung@samsung.com> Change-Id: Iff5e905dd21d4ee438254380fb48b53b04bc31b1
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a7d2724e52
commit
3390f5d0dc
@@ -365,6 +365,23 @@ static int xhci_alloc_segments_for_ring(struct xhci_hcd *xhci,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void xhci_vendor_free_container_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx)
|
||||
{
|
||||
struct xhci_vendor_ops *ops = xhci_vendor_get_ops(xhci);
|
||||
|
||||
if (ops && ops->free_container_ctx)
|
||||
ops->free_container_ctx(xhci, ctx);
|
||||
}
|
||||
|
||||
static void xhci_vendor_alloc_container_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
|
||||
int type, gfp_t flags)
|
||||
{
|
||||
struct xhci_vendor_ops *ops = xhci_vendor_get_ops(xhci);
|
||||
|
||||
if (ops && ops->alloc_container_ctx)
|
||||
ops->alloc_container_ctx(xhci, ctx, type, flags);
|
||||
}
|
||||
|
||||
static struct xhci_ring *xhci_vendor_alloc_transfer_ring(struct xhci_hcd *xhci,
|
||||
u32 endpoint_type, enum xhci_ring_type ring_type,
|
||||
gfp_t mem_flags)
|
||||
@@ -524,7 +541,11 @@ struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci,
|
||||
if (type == XHCI_CTX_TYPE_INPUT)
|
||||
ctx->size += CTX_SIZE(xhci->hcc_params);
|
||||
|
||||
ctx->bytes = dma_pool_zalloc(xhci->device_pool, flags, &ctx->dma);
|
||||
if (xhci_vendor_is_usb_offload_enabled(xhci, NULL, 0))
|
||||
xhci_vendor_alloc_container_ctx(xhci, ctx, type, flags);
|
||||
else
|
||||
ctx->bytes = dma_pool_zalloc(xhci->device_pool, flags, &ctx->dma);
|
||||
|
||||
if (!ctx->bytes) {
|
||||
kfree(ctx);
|
||||
return NULL;
|
||||
@@ -537,7 +558,11 @@ void xhci_free_container_ctx(struct xhci_hcd *xhci,
|
||||
{
|
||||
if (!ctx)
|
||||
return;
|
||||
dma_pool_free(xhci->device_pool, ctx->bytes, ctx->dma);
|
||||
if (xhci_vendor_is_usb_offload_enabled(xhci, NULL, 0))
|
||||
xhci_vendor_free_container_ctx(xhci, ctx);
|
||||
else
|
||||
dma_pool_free(xhci->device_pool, ctx->bytes, ctx->dma);
|
||||
|
||||
kfree(ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -2222,6 +2222,8 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
|
||||
* @alloc_transfer_ring: called when remote transfer ring allocation is required
|
||||
* @free_transfer_ring: called to free vendor specific transfer ring
|
||||
* @sync_dev_ctx: called when synchronization for device context is required
|
||||
* @alloc_container_ctx: called when allocating vendor specific container context
|
||||
* @free_container_ctx: called to free vendor specific container context
|
||||
*/
|
||||
struct xhci_vendor_ops {
|
||||
int (*vendor_init)(struct xhci_hcd *xhci);
|
||||
@@ -2242,6 +2244,9 @@ struct xhci_vendor_ops {
|
||||
struct xhci_virt_device *virt_dev, unsigned int ep_index);
|
||||
int (*sync_dev_ctx)(struct xhci_hcd *xhci, unsigned int slot_id);
|
||||
bool (*usb_offload_skip_urb)(struct xhci_hcd *xhci, struct urb *urb);
|
||||
void (*alloc_container_ctx)(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
|
||||
int type, gfp_t flags);
|
||||
void (*free_container_ctx)(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx);
|
||||
};
|
||||
|
||||
struct xhci_vendor_ops *xhci_vendor_get_ops(struct xhci_hcd *xhci);
|
||||
|
||||
Reference in New Issue
Block a user