diff options
| author | Alexander Viro <viro@parcelfarce.linux.theplanet.co.uk> | 2004-01-10 08:37:28 -0500 |
|---|---|---|
| committer | Stephen Hemminger <shemminger@osdl.org> | 2004-01-10 08:37:28 -0500 |
| commit | a01d4ab4699e5947109d09f71067631f3bcac5b8 (patch) | |
| tree | e8b6d604efab332417f384c59096a168eac945cf /net/lapb/lapb_iface.c | |
| parent | c360d0a60e57217733e00b5ad7c4cf3a94a2b07e (diff) | |
[wan lapb] switch to use net_device instead of custom token
lapb functions that used to take a token to select lapb_cb they'll deal with
are switched to getting net_device instead. Callbacks switched to using
lapb->dev instead of lapb->token.
Diffstat (limited to 'net/lapb/lapb_iface.c')
| -rw-r--r-- | net/lapb/lapb_iface.c | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c index 8be730427a3d..634e04c69622 100644 --- a/net/lapb/lapb_iface.c +++ b/net/lapb/lapb_iface.c @@ -81,18 +81,14 @@ static void __lapb_insert_cb(struct lapb_cb *lapb) lapb_hold(lapb); } -/* - * Convert the integer token used by the device driver into a pointer - * to a LAPB control structure. - */ -static struct lapb_cb *__lapb_tokentostruct(void *token) +static struct lapb_cb *__lapb_devtostruct(struct net_device *dev) { struct list_head *entry; struct lapb_cb *lapb, *use = NULL; list_for_each(entry, &lapb_list) { lapb = list_entry(entry, struct lapb_cb, node); - if (lapb->token == token) { + if (lapb->dev == dev) { use = lapb; break; } @@ -104,12 +100,12 @@ static struct lapb_cb *__lapb_tokentostruct(void *token) return use; } -static struct lapb_cb *lapb_tokentostruct(void *token) +static struct lapb_cb *lapb_devtostruct(struct net_device *dev) { struct lapb_cb *rc; read_lock_bh(&lapb_list_lock); - rc = __lapb_tokentostruct(token); + rc = __lapb_devtostruct(dev); read_unlock_bh(&lapb_list_lock); return rc; @@ -151,7 +147,7 @@ int lapb_register(struct net_device *dev, void *token, struct lapb_register_stru write_lock_bh(&lapb_list_lock); - lapb = __lapb_tokentostruct(token); + lapb = __lapb_devtostruct(dev); if (lapb) { lapb_put(lapb); goto out; @@ -176,13 +172,13 @@ out: return rc; } -int lapb_unregister(void *token) +int lapb_unregister(struct net_device *dev) { struct lapb_cb *lapb; int rc = LAPB_BADTOKEN; write_unlock_bh(&lapb_list_lock); - lapb = __lapb_tokentostruct(token); + lapb = __lapb_devtostruct(dev); if (!lapb) goto out; @@ -200,10 +196,10 @@ out: return rc; } -int lapb_getparms(void *token, struct lapb_parms_struct *parms) +int lapb_getparms(struct net_device *dev, struct lapb_parms_struct *parms) { int rc = LAPB_BADTOKEN; - struct lapb_cb *lapb = lapb_tokentostruct(token); + struct lapb_cb *lapb = lapb_devtostruct(dev); if (!lapb) goto out; @@ -232,10 +228,10 @@ out: return rc; } -int lapb_setparms(void *token, struct lapb_parms_struct *parms) +int lapb_setparms(struct net_device *dev, struct lapb_parms_struct *parms) { int rc = LAPB_BADTOKEN; - struct lapb_cb *lapb = lapb_tokentostruct(token); + struct lapb_cb *lapb = lapb_devtostruct(dev); if (!lapb) goto out; @@ -265,9 +261,9 @@ out: return rc; } -int lapb_connect_request(void *token) +int lapb_connect_request(struct net_device *dev) { - struct lapb_cb *lapb = lapb_tokentostruct(token); + struct lapb_cb *lapb = lapb_devtostruct(dev); int rc = LAPB_BADTOKEN; if (!lapb) @@ -295,9 +291,9 @@ out: return rc; } -int lapb_disconnect_request(void *token) +int lapb_disconnect_request(struct net_device *dev) { - struct lapb_cb *lapb = lapb_tokentostruct(token); + struct lapb_cb *lapb = lapb_devtostruct(dev); int rc = LAPB_BADTOKEN; if (!lapb) @@ -347,9 +343,9 @@ out: return rc; } -int lapb_data_request(void *token, struct sk_buff *skb) +int lapb_data_request(struct net_device *dev, struct sk_buff *skb) { - struct lapb_cb *lapb = lapb_tokentostruct(token); + struct lapb_cb *lapb = lapb_devtostruct(dev); int rc = LAPB_BADTOKEN; if (!lapb) @@ -368,9 +364,9 @@ out: return rc; } -int lapb_data_received(void *token, struct sk_buff *skb) +int lapb_data_received(struct net_device *dev, struct sk_buff *skb) { - struct lapb_cb *lapb = lapb_tokentostruct(token); + struct lapb_cb *lapb = lapb_devtostruct(dev); int rc = LAPB_BADTOKEN; if (lapb) { @@ -385,31 +381,31 @@ int lapb_data_received(void *token, struct sk_buff *skb) void lapb_connect_confirmation(struct lapb_cb *lapb, int reason) { if (lapb->callbacks.connect_confirmation) - lapb->callbacks.connect_confirmation(lapb->token, reason); + lapb->callbacks.connect_confirmation(lapb->dev, reason); } void lapb_connect_indication(struct lapb_cb *lapb, int reason) { if (lapb->callbacks.connect_indication) - lapb->callbacks.connect_indication(lapb->token, reason); + lapb->callbacks.connect_indication(lapb->dev, reason); } void lapb_disconnect_confirmation(struct lapb_cb *lapb, int reason) { if (lapb->callbacks.disconnect_confirmation) - lapb->callbacks.disconnect_confirmation(lapb->token, reason); + lapb->callbacks.disconnect_confirmation(lapb->dev, reason); } void lapb_disconnect_indication(struct lapb_cb *lapb, int reason) { if (lapb->callbacks.disconnect_indication) - lapb->callbacks.disconnect_indication(lapb->token, reason); + lapb->callbacks.disconnect_indication(lapb->dev, reason); } int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *skb) { if (lapb->callbacks.data_indication) - return lapb->callbacks.data_indication(lapb->token, skb); + return lapb->callbacks.data_indication(lapb->dev, skb); kfree_skb(skb); return NET_RX_CN_HIGH; /* For now; must be != NET_RX_DROP */ @@ -420,7 +416,7 @@ int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *skb) int used = 0; if (lapb->callbacks.data_transmit) { - lapb->callbacks.data_transmit(lapb->token, skb); + lapb->callbacks.data_transmit(lapb->dev, skb); used = 1; } |
