From: Benjamin Romer Date: Tue, 4 Nov 2014 16:25:12 +0000 (-0500) Subject: staging: unisys: refactor CHARQUEUE X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7a81a6e87e97c05524aa1d49d1f08dc7ca2260e5;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: unisys: refactor CHARQUEUE Remove the typedef and just use struct charqueue instead. Update all references. Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index cdc9cc347782..7861e7326d87 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -25,7 +25,7 @@ #define IS_EMPTY(charqueue) (charqueue->head == charqueue->tail) -struct CHARQUEUE_Tag { +struct charqueue { int alloc_size; int nslots; spinlock_t lock; @@ -33,10 +33,10 @@ struct CHARQUEUE_Tag { unsigned char buf[0]; }; -CHARQUEUE *visor_charqueue_create(ulong nslots) +struct charqueue *visor_charqueue_create(ulong nslots) { - int alloc_size = sizeof(CHARQUEUE) + nslots + 1; - CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); + int alloc_size = sizeof(struct charqueue) + nslots + 1; + struct charqueue *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); if (cq == NULL) { ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)", @@ -51,7 +51,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) } EXPORT_SYMBOL_GPL(visor_charqueue_create); -void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) +void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c) { int alloc_slots = charqueue->nslots+1; /* 1 slot is always empty */ @@ -65,7 +65,7 @@ void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) } EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); -BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) +BOOL visor_charqueue_is_empty(struct charqueue *charqueue) { BOOL b; @@ -76,7 +76,7 @@ BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) } EXPORT_SYMBOL_GPL(visor_charqueue_is_empty); -static int charqueue_dequeue_1(CHARQUEUE *charqueue) +static int charqueue_dequeue_1(struct charqueue *charqueue) { int alloc_slots = charqueue->nslots + 1; /* 1 slot is always empty */ @@ -86,7 +86,7 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue) return charqueue->buf[charqueue->tail]; } -int charqueue_dequeue(CHARQUEUE *charqueue) +int charqueue_dequeue(struct charqueue *charqueue) { int rc; @@ -96,7 +96,8 @@ int charqueue_dequeue(CHARQUEUE *charqueue) return rc; } -int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) +int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf, + int n) { int rc, counter = 0, c; @@ -118,7 +119,7 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) } EXPORT_SYMBOL_GPL(visor_charqueue_dequeue_n); -void visor_charqueue_destroy(CHARQUEUE *charqueue) +void visor_charqueue_destroy(struct charqueue *charqueue) { if (charqueue == NULL) return; diff --git a/drivers/staging/unisys/visorutil/charqueue.h b/drivers/staging/unisys/visorutil/charqueue.h index d6f16587a364..56c1f79a54b0 100644 --- a/drivers/staging/unisys/visorutil/charqueue.h +++ b/drivers/staging/unisys/visorutil/charqueue.h @@ -21,17 +21,18 @@ #include "uniklog.h" #include "timskmod.h" -/* CHARQUEUE is an opaque structure to users. +/* struct charqueue is an opaque structure to users. * Fields are declared only in the implementation .c files. */ -typedef struct CHARQUEUE_Tag CHARQUEUE; +struct charqueue; -CHARQUEUE *visor_charqueue_create(ulong nslots); -void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c); -int charqueue_dequeue(CHARQUEUE *charqueue); -int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n); -BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue); -void visor_charqueue_destroy(CHARQUEUE *charqueue); +struct charqueue *visor_charqueue_create(ulong nslots); +void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c); +int charqueue_dequeue(struct charqueue *charqueue); +int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf, + int n); +BOOL visor_charqueue_is_empty(struct charqueue *charqueue); +void visor_charqueue_destroy(struct charqueue *charqueue); #endif