From 43de3f330c3407d799dad28effd6f4d8f5a80aad Mon Sep 17 00:00:00 2001 From: Noe Rubinstein Date: Tue, 21 Dec 2010 16:17:39 +0100 Subject: change xivovp_line_from_ctx to a single container_of call --- xivovp/base.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/xivovp/base.c b/xivovp/base.c index 7095e21..fedd38d 100644 --- a/xivovp/base.c +++ b/xivovp/base.c @@ -110,23 +110,10 @@ static void xivovp_receive_and_transmit(void *data) } #endif -/* Shouldn't there be something better there? TOTHINK */ +/* Returns the xivovp_line which line is the same as the VpLineCtxType */ static struct xivovp_line* xivovp_line_from_ctx(VpLineCtxType* line_ctx) { - Vp890LineObjectType* line_obj; - int i; - - if (!line_ctx) - panic(DRV_NAME ": LineCtx == NULL\n"); - - line_obj = line_ctx->pLineObj; - - for (i = 0; i < NB_LINES; i++) - if (&xivovp.line[i].line_obj == line_obj) - return &xivovp.line[i]; - - panic(DRV_NAME ": unknown FX line, this shouldn't happen\n"); - return NULL; + return container_of(line_ctx->pLineObj, struct xivovp_line, line_obj); } static void vp_set_debug_select_running(void) -- cgit v1.2.3