Commit c360d0a6 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[wan lapb] beginning of cleanups

Beginning of lapb cleanups: lapb_register gets net_device along with the
"token" and it gets stored in lapb_cb (token argument will die later).
parent 1970654b
...@@ -453,7 +453,7 @@ static int comxlapb_init(struct net_device *dev) ...@@ -453,7 +453,7 @@ static int comxlapb_init(struct net_device *dev)
lapbreg.disconnect_indication = comxlapb_disconnected; lapbreg.disconnect_indication = comxlapb_disconnected;
lapbreg.data_indication = comxlapb_data_indication; lapbreg.data_indication = comxlapb_data_indication;
lapbreg.data_transmit = comxlapb_data_transmit; lapbreg.data_transmit = comxlapb_data_transmit;
if (lapb_register(dev->priv, &lapbreg)) { if (lapb_register(dev, dev->priv, &lapbreg)) {
return -ENOMEM; return -ENOMEM;
} }
if (ch->debug_flags & DEBUG_COMX_LAPB) { if (ch->debug_flags & DEBUG_COMX_LAPB) {
......
...@@ -154,7 +154,7 @@ static int x25_open(hdlc_device *hdlc) ...@@ -154,7 +154,7 @@ static int x25_open(hdlc_device *hdlc)
cb.data_indication = x25_data_indication; cb.data_indication = x25_data_indication;
cb.data_transmit = x25_data_transmit; cb.data_transmit = x25_data_transmit;
result = lapb_register(hdlc, &cb); result = lapb_register(hdlc_to_dev(hdlc), hdlc, &cb);
if (result != LAPB_OK) if (result != LAPB_OK)
return result; return result;
return 0; return 0;
......
...@@ -307,7 +307,7 @@ static int lapbeth_open(struct net_device *dev) ...@@ -307,7 +307,7 @@ static int lapbeth_open(struct net_device *dev)
int err; int err;
lapbeth = (struct lapbethdev *)dev->priv; lapbeth = (struct lapbethdev *)dev->priv;
if ((err = lapb_register(lapbeth, &lapbeth_callbacks)) != LAPB_OK) { if ((err = lapb_register(dev, lapbeth, &lapbeth_callbacks)) != LAPB_OK) {
printk(KERN_ERR "lapbeth: lapb_register error - %d\n", err); printk(KERN_ERR "lapbeth: lapb_register error - %d\n", err);
return -ENODEV; return -ENODEV;
} }
......
...@@ -500,7 +500,7 @@ static int x25_asy_open(struct net_device *dev) ...@@ -500,7 +500,7 @@ static int x25_asy_open(struct net_device *dev)
/* /*
* Now attach LAPB * Now attach LAPB
*/ */
if((err=lapb_register(sl, &x25_asy_callbacks))==LAPB_OK) if((err=lapb_register(dev, sl, &x25_asy_callbacks))==LAPB_OK)
return 0; return 0;
/* Cleanup */ /* Cleanup */
......
...@@ -44,7 +44,7 @@ struct lapb_parms_struct { ...@@ -44,7 +44,7 @@ struct lapb_parms_struct {
unsigned int mode; unsigned int mode;
}; };
extern int lapb_register(void *token, struct lapb_register_struct *callbacks); extern int lapb_register(struct net_device *dev, void *token, struct lapb_register_struct *callbacks);
extern int lapb_unregister(void *token); extern int lapb_unregister(void *token);
extern int lapb_getparms(void *token, struct lapb_parms_struct *parms); extern int lapb_getparms(void *token, struct lapb_parms_struct *parms);
extern int lapb_setparms(void *token, struct lapb_parms_struct *parms); extern int lapb_setparms(void *token, struct lapb_parms_struct *parms);
......
...@@ -80,6 +80,7 @@ struct lapb_frame { ...@@ -80,6 +80,7 @@ struct lapb_frame {
*/ */
struct lapb_cb { struct lapb_cb {
struct list_head node; struct list_head node;
struct net_device *dev;
void *token; void *token;
/* Link status fields */ /* Link status fields */
......
...@@ -144,7 +144,7 @@ static struct lapb_cb *lapb_create_cb(void) ...@@ -144,7 +144,7 @@ static struct lapb_cb *lapb_create_cb(void)
return lapb; return lapb;
} }
int lapb_register(void *token, struct lapb_register_struct *callbacks) int lapb_register(struct net_device *dev, void *token, struct lapb_register_struct *callbacks)
{ {
struct lapb_cb *lapb; struct lapb_cb *lapb;
int rc = LAPB_BADTOKEN; int rc = LAPB_BADTOKEN;
...@@ -163,6 +163,7 @@ int lapb_register(void *token, struct lapb_register_struct *callbacks) ...@@ -163,6 +163,7 @@ int lapb_register(void *token, struct lapb_register_struct *callbacks)
goto out; goto out;
lapb->token = token; lapb->token = token;
lapb->dev = dev;
lapb->callbacks = *callbacks; lapb->callbacks = *callbacks;
__lapb_insert_cb(lapb); __lapb_insert_cb(lapb);
......
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