Commit 6565c3f9 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN: Use standard list for PPP compressors

replace the somewhat weird open-coded doubly-linked list with
a <linux/list.h> list.
parent f55c3d5c
...@@ -556,13 +556,13 @@ ippp_ccp_send_ccp(struct ippp_ccp *ccp, struct sk_buff *skb) ...@@ -556,13 +556,13 @@ ippp_ccp_send_ccp(struct ippp_ccp *ccp, struct sk_buff *skb)
} }
} }
static struct isdn_ppp_compressor *ipc_head = NULL; static LIST_HEAD(ipc_head);
int int
ippp_ccp_set_compressor(struct ippp_ccp *ccp, int unit, ippp_ccp_set_compressor(struct ippp_ccp *ccp, int unit,
struct isdn_ppp_comp_data *data) struct isdn_ppp_comp_data *data)
{ {
struct isdn_ppp_compressor *ipc = ipc_head; struct isdn_ppp_compressor *ipc;
int ret; int ret;
void *stat; void *stat;
int num = data->num; int num = data->num;
...@@ -571,7 +571,7 @@ ippp_ccp_set_compressor(struct ippp_ccp *ccp, int unit, ...@@ -571,7 +571,7 @@ ippp_ccp_set_compressor(struct ippp_ccp *ccp, int unit,
printk(KERN_DEBUG "[%d] Set %scompressor type %d\n", unit, printk(KERN_DEBUG "[%d] Set %scompressor type %d\n", unit,
data->flags & IPPP_COMP_FLAG_XMIT ? "" : "de", num); data->flags & IPPP_COMP_FLAG_XMIT ? "" : "de", num);
for (ipc = ipc_head; ipc; ipc = ipc->next) { list_for_each_entry(ipc, &ipc_head, list) {
if (ipc->num != num) if (ipc->num != num)
continue; continue;
...@@ -618,7 +618,7 @@ ippp_ccp_get_compressors(unsigned long protos[8]) ...@@ -618,7 +618,7 @@ ippp_ccp_get_compressors(unsigned long protos[8])
int i, j; int i, j;
memset(protos, 0, sizeof(unsigned long) * 8); memset(protos, 0, sizeof(unsigned long) * 8);
for (ipc = ipc_head; ipc; ipc = ipc->next) { list_for_each_entry(ipc, &ipc_head, list) {
j = ipc->num / (sizeof(long)*8); j = ipc->num / (sizeof(long)*8);
i = ipc->num % (sizeof(long)*8); i = ipc->num % (sizeof(long)*8);
if (j < 8) if (j < 8)
...@@ -629,25 +629,14 @@ ippp_ccp_get_compressors(unsigned long protos[8]) ...@@ -629,25 +629,14 @@ ippp_ccp_get_compressors(unsigned long protos[8])
int int
isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc) isdn_ppp_register_compressor(struct isdn_ppp_compressor *ipc)
{ {
ipc->next = ipc_head; list_add_tail(&ipc->list, &ipc_head);
ipc->prev = NULL;
if (ipc_head) {
ipc_head->prev = ipc;
}
ipc_head = ipc;
return 0; return 0;
} }
int int
isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc) isdn_ppp_unregister_compressor(struct isdn_ppp_compressor *ipc)
{ {
if (ipc->prev) list_del(&ipc->list);
ipc->prev->next = ipc->next;
else
ipc_head = ipc->next;
if (ipc->next)
ipc->next->prev = ipc->prev;
ipc->prev = ipc->next = NULL;
return 0; return 0;
} }
...@@ -96,7 +96,7 @@ struct isdn_ppp_resetparams { ...@@ -96,7 +96,7 @@ struct isdn_ppp_resetparams {
*/ */
struct isdn_ppp_compressor { struct isdn_ppp_compressor {
struct module *owner; struct module *owner;
struct isdn_ppp_compressor *next, *prev; struct list_head list;
int num; /* CCP compression protocol number */ int num; /* CCP compression protocol number */
void *(*alloc) (struct isdn_ppp_comp_data *); void *(*alloc) (struct isdn_ppp_comp_data *);
......
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