Commit 7a81a6e8 authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: refactor CHARQUEUE

Remove the typedef and just use struct charqueue instead. Update all references.
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 20188dd9
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define IS_EMPTY(charqueue) (charqueue->head == charqueue->tail) #define IS_EMPTY(charqueue) (charqueue->head == charqueue->tail)
struct CHARQUEUE_Tag { struct charqueue {
int alloc_size; int alloc_size;
int nslots; int nslots;
spinlock_t lock; spinlock_t lock;
...@@ -33,10 +33,10 @@ struct CHARQUEUE_Tag { ...@@ -33,10 +33,10 @@ struct CHARQUEUE_Tag {
unsigned char buf[0]; unsigned char buf[0];
}; };
CHARQUEUE *visor_charqueue_create(ulong nslots) struct charqueue *visor_charqueue_create(ulong nslots)
{ {
int alloc_size = sizeof(CHARQUEUE) + nslots + 1; int alloc_size = sizeof(struct charqueue) + nslots + 1;
CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); struct charqueue *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY);
if (cq == NULL) { if (cq == NULL) {
ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)", ERRDRV("visor_charqueue_create allocation failed (alloc_size=%d)",
...@@ -51,7 +51,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) ...@@ -51,7 +51,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots)
} }
EXPORT_SYMBOL_GPL(visor_charqueue_create); 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 */ int alloc_slots = charqueue->nslots+1; /* 1 slot is always empty */
...@@ -65,7 +65,7 @@ void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) ...@@ -65,7 +65,7 @@ void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c)
} }
EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); EXPORT_SYMBOL_GPL(visor_charqueue_enqueue);
BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) BOOL visor_charqueue_is_empty(struct charqueue *charqueue)
{ {
BOOL b; BOOL b;
...@@ -76,7 +76,7 @@ BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) ...@@ -76,7 +76,7 @@ BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue)
} }
EXPORT_SYMBOL_GPL(visor_charqueue_is_empty); 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 */ int alloc_slots = charqueue->nslots + 1; /* 1 slot is always empty */
...@@ -86,7 +86,7 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue) ...@@ -86,7 +86,7 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue)
return charqueue->buf[charqueue->tail]; return charqueue->buf[charqueue->tail];
} }
int charqueue_dequeue(CHARQUEUE *charqueue) int charqueue_dequeue(struct charqueue *charqueue)
{ {
int rc; int rc;
...@@ -96,7 +96,8 @@ int charqueue_dequeue(CHARQUEUE *charqueue) ...@@ -96,7 +96,8 @@ int charqueue_dequeue(CHARQUEUE *charqueue)
return rc; 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; int rc, counter = 0, c;
...@@ -118,7 +119,7 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) ...@@ -118,7 +119,7 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n)
} }
EXPORT_SYMBOL_GPL(visor_charqueue_dequeue_n); EXPORT_SYMBOL_GPL(visor_charqueue_dequeue_n);
void visor_charqueue_destroy(CHARQUEUE *charqueue) void visor_charqueue_destroy(struct charqueue *charqueue)
{ {
if (charqueue == NULL) if (charqueue == NULL)
return; return;
......
...@@ -21,17 +21,18 @@ ...@@ -21,17 +21,18 @@
#include "uniklog.h" #include "uniklog.h"
#include "timskmod.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. * Fields are declared only in the implementation .c files.
*/ */
typedef struct CHARQUEUE_Tag CHARQUEUE; struct charqueue;
CHARQUEUE *visor_charqueue_create(ulong nslots); struct charqueue *visor_charqueue_create(ulong nslots);
void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c); void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c);
int charqueue_dequeue(CHARQUEUE *charqueue); int charqueue_dequeue(struct charqueue *charqueue);
int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n); int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf,
BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue); int n);
void visor_charqueue_destroy(CHARQUEUE *charqueue); BOOL visor_charqueue_is_empty(struct charqueue *charqueue);
void visor_charqueue_destroy(struct charqueue *charqueue);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment