Commit 2c684c75 authored by Armin Schindler's avatar Armin Schindler Committed by Linus Torvalds

[PATCH] eicon ISDN driver: list handling

Fixed internel list handling for modules built-in kernel.
parent 0c8d50b6
/* $Id: dlist.c,v 1.1.2.2 2001/02/11 14:40:41 armin Exp $ */
/* $Id: dlist.c,v 1.6 2003/08/25 16:03:35 schindler Exp $ */
#include "platform.h"
#include "dlist.h"
......@@ -7,7 +7,7 @@
** Initialize linked list
*/
void diva_q_init(diva_entity_queue_t * q)
static void diva_q_init(diva_entity_queue_t * q)
{
memset(q, 0x00, sizeof(*q));
}
......@@ -15,7 +15,7 @@ void diva_q_init(diva_entity_queue_t * q)
/*
** Remove element from linked list
*/
void diva_q_remove(diva_entity_queue_t * q, diva_entity_link_t * what)
static void diva_q_remove(diva_entity_queue_t * q, diva_entity_link_t * what)
{
if (!what->prev) {
if ((q->head = what->next)) {
......@@ -36,7 +36,7 @@ void diva_q_remove(diva_entity_queue_t * q, diva_entity_link_t * what)
/*
** Add element to the tail of linked list
*/
void diva_q_add_tail(diva_entity_queue_t * q, diva_entity_link_t * what)
static void diva_q_add_tail(diva_entity_queue_t * q, diva_entity_link_t * what)
{
what->next = 0;
if (!q->head) {
......@@ -49,7 +49,7 @@ void diva_q_add_tail(diva_entity_queue_t * q, diva_entity_link_t * what)
}
}
diva_entity_link_t *diva_q_find(const diva_entity_queue_t * q,
static diva_entity_link_t *diva_q_find(const diva_entity_queue_t * q,
const void *what, diva_q_cmp_fn_t cmp_fn)
{
diva_entity_link_t *diva_current = q->head;
......@@ -64,35 +64,13 @@ diva_entity_link_t *diva_q_find(const diva_entity_queue_t * q,
return (diva_current);
}
diva_entity_link_t *diva_q_get_head(diva_entity_queue_t * q)
static diva_entity_link_t *diva_q_get_head(diva_entity_queue_t * q)
{
return (q->head);
}
diva_entity_link_t *diva_q_get_tail(diva_entity_queue_t * q)
{
return (q->tail);
}
diva_entity_link_t *diva_q_get_next(diva_entity_link_t * what)
static diva_entity_link_t *diva_q_get_next(diva_entity_link_t * what)
{
return ((what) ? what->next : 0);
}
diva_entity_link_t *diva_q_get_prev(diva_entity_link_t * what)
{
return ((what) ? what->prev : 0);
}
int diva_q_get_nr_of_entries(const diva_entity_queue_t * q)
{
int i = 0;
const diva_entity_link_t *diva_current = q->head;
while (diva_current) {
i++;
diva_current = diva_current->next;
}
return (i);
}
/* $Id: dlist.h,v 1.1.2.2 2001/02/08 12:25:43 armin Exp $ */
/* $Id: dlist.h,v 1.5 2003/08/25 16:03:35 schindler Exp $ */
#ifndef __DIVA_LINK_H__
#define __DIVA_LINK_H__
......@@ -17,16 +17,4 @@ typedef struct _diva_entity_queue {
typedef int (*diva_q_cmp_fn_t) (const void *what,
const diva_entity_link_t *);
void diva_q_remove(diva_entity_queue_t * q, diva_entity_link_t * what);
void diva_q_add_tail(diva_entity_queue_t * q, diva_entity_link_t * what);
diva_entity_link_t *diva_q_find(const diva_entity_queue_t * q,
const void *what, diva_q_cmp_fn_t cmp_fn);
diva_entity_link_t *diva_q_get_head(diva_entity_queue_t * q);
diva_entity_link_t *diva_q_get_tail(diva_entity_queue_t * q);
diva_entity_link_t *diva_q_get_next(diva_entity_link_t * what);
diva_entity_link_t *diva_q_get_prev(diva_entity_link_t * what);
int diva_q_get_nr_of_entries(const diva_entity_queue_t * q);
void diva_q_init(diva_entity_queue_t * q);
#endif
/* $Id: um_idi.c,v 1.1.2.2 2001/02/11 14:40:41 armin Exp $ */
/* $Id: um_idi.c,v 1.9 2003/09/09 06:00:47 schindler Exp $ */
#include "platform.h"
#include "di_defs.h"
......@@ -37,6 +37,11 @@ static int process_idi_rc(divas_um_idi_entity_t * e, byte rc);
static int process_idi_ind(divas_um_idi_entity_t * e, byte ind);
static int write_return_code(divas_um_idi_entity_t * e, byte rc);
/*
* include queue functions
*/
#include "dlist.c"
/* --------------------------------------------------------------------------
MAIN
-------------------------------------------------------------------------- */
......@@ -171,7 +176,15 @@ static diva_um_idi_adapter_t *diva_um_idi_find_adapter(dword nr)
------------------------------------------------------------------------ */
int diva_um_idi_nr_of_adapters(void)
{
return (diva_q_get_nr_of_entries(&adapter_q));
int i = 0;
const diva_entity_queue_t * q = &adapter_q;
const diva_entity_link_t *diva_current = q->head;
while (diva_current) {
i++;
diva_current = diva_current->next;
}
return(i);
}
/* ------------------------------------------------------------------------
......
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