diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-01-07 21:09:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-07 21:09:07 -0500 |
commit | c4a80d7e67b1a084e061853d39a1ba6f500027fd (patch) | |
tree | 5a36f7dbb3c9e466114e1e2948e258da3b5a1ef8 /drivers/uwb | |
parent | 5ec38f3023217fc164763d2a5505dee806d84223 (diff) |
uwb: convert devices to net_device_ops
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/uwb')
-rw-r--r-- | drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h | 2 | ||||
-rw-r--r-- | drivers/uwb/i1480/i1480u-wlp/lc.c | 17 | ||||
-rw-r--r-- | drivers/uwb/i1480/i1480u-wlp/netdev.c | 9 | ||||
-rw-r--r-- | drivers/uwb/i1480/i1480u-wlp/rx.c | 8 | ||||
-rw-r--r-- | drivers/uwb/i1480/i1480u-wlp/tx.c | 6 |
5 files changed, 16 insertions, 26 deletions
diff --git a/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h b/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h index 5f1b2951bb83..3421d3339d7d 100644 --- a/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h +++ b/drivers/uwb/i1480/i1480u-wlp/i1480u-wlp.h | |||
@@ -221,7 +221,6 @@ struct i1480u { | |||
221 | struct net_device *net_dev; | 221 | struct net_device *net_dev; |
222 | 222 | ||
223 | spinlock_t lock; | 223 | spinlock_t lock; |
224 | struct net_device_stats stats; | ||
225 | 224 | ||
226 | /* RX context handling */ | 225 | /* RX context handling */ |
227 | struct sk_buff *rx_skb; | 226 | struct sk_buff *rx_skb; |
@@ -271,7 +270,6 @@ extern int i1480u_stop(struct net_device *); | |||
271 | extern int i1480u_hard_start_xmit(struct sk_buff *, struct net_device *); | 270 | extern int i1480u_hard_start_xmit(struct sk_buff *, struct net_device *); |
272 | extern void i1480u_tx_timeout(struct net_device *); | 271 | extern void i1480u_tx_timeout(struct net_device *); |
273 | extern int i1480u_set_config(struct net_device *, struct ifmap *); | 272 | extern int i1480u_set_config(struct net_device *, struct ifmap *); |
274 | extern struct net_device_stats *i1480u_get_stats(struct net_device *); | ||
275 | extern int i1480u_change_mtu(struct net_device *, int); | 273 | extern int i1480u_change_mtu(struct net_device *, int); |
276 | extern void i1480u_uwb_notifs_cb(void *, struct uwb_dev *, enum uwb_notifs); | 274 | extern void i1480u_uwb_notifs_cb(void *, struct uwb_dev *, enum uwb_notifs); |
277 | 275 | ||
diff --git a/drivers/uwb/i1480/i1480u-wlp/lc.c b/drivers/uwb/i1480/i1480u-wlp/lc.c index 049c05d4cc6a..f272dfe54d49 100644 --- a/drivers/uwb/i1480/i1480u-wlp/lc.c +++ b/drivers/uwb/i1480/i1480u-wlp/lc.c | |||
@@ -181,6 +181,15 @@ error: | |||
181 | } | 181 | } |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | static const struct net_device_ops i1480u_netdev_ops = { | ||
185 | .ndo_open = i1480u_open, | ||
186 | .ndo_stop = i1480u_stop, | ||
187 | .ndo_start_xmit = i1480u_hard_start_xmit, | ||
188 | .ndo_tx_timeout = i1480u_tx_timeout, | ||
189 | .ndo_set_config = i1480u_set_config, | ||
190 | .ndo_change_mtu = i1480u_change_mtu, | ||
191 | }; | ||
192 | |||
184 | static | 193 | static |
185 | int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface) | 194 | int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface) |
186 | { | 195 | { |
@@ -235,13 +244,7 @@ int i1480u_add(struct i1480u *i1480u, struct usb_interface *iface) | |||
235 | net_dev->features |= NETIF_F_HIGHDMA; | 244 | net_dev->features |= NETIF_F_HIGHDMA; |
236 | net_dev->watchdog_timeo = 5*HZ; /* FIXME: a better default? */ | 245 | net_dev->watchdog_timeo = 5*HZ; /* FIXME: a better default? */ |
237 | 246 | ||
238 | net_dev->open = i1480u_open; | 247 | net_dev->netdev_ops = &i1480u_netdev_ops; |
239 | net_dev->stop = i1480u_stop; | ||
240 | net_dev->hard_start_xmit = i1480u_hard_start_xmit; | ||
241 | net_dev->tx_timeout = i1480u_tx_timeout; | ||
242 | net_dev->get_stats = i1480u_get_stats; | ||
243 | net_dev->set_config = i1480u_set_config; | ||
244 | net_dev->change_mtu = i1480u_change_mtu; | ||
245 | 248 | ||
246 | #ifdef i1480u_FLOW_CONTROL | 249 | #ifdef i1480u_FLOW_CONTROL |
247 | /* Notification endpoint setup (submitted when we open the device) */ | 250 | /* Notification endpoint setup (submitted when we open the device) */ |
diff --git a/drivers/uwb/i1480/i1480u-wlp/netdev.c b/drivers/uwb/i1480/i1480u-wlp/netdev.c index e3873ffb942c..73055530e60f 100644 --- a/drivers/uwb/i1480/i1480u-wlp/netdev.c +++ b/drivers/uwb/i1480/i1480u-wlp/netdev.c | |||
@@ -262,15 +262,6 @@ int i1480u_stop(struct net_device *net_dev) | |||
262 | return 0; | 262 | return 0; |
263 | } | 263 | } |
264 | 264 | ||
265 | |||
266 | /** Report statistics */ | ||
267 | struct net_device_stats *i1480u_get_stats(struct net_device *net_dev) | ||
268 | { | ||
269 | struct i1480u *i1480u = netdev_priv(net_dev); | ||
270 | return &i1480u->stats; | ||
271 | } | ||
272 | |||
273 | |||
274 | /** | 265 | /** |
275 | * | 266 | * |
276 | * Change the interface config--we probably don't have to do anything. | 267 | * Change the interface config--we probably don't have to do anything. |
diff --git a/drivers/uwb/i1480/i1480u-wlp/rx.c b/drivers/uwb/i1480/i1480u-wlp/rx.c index 34f4cf9a7d34..25a2758beb61 100644 --- a/drivers/uwb/i1480/i1480u-wlp/rx.c +++ b/drivers/uwb/i1480/i1480u-wlp/rx.c | |||
@@ -167,7 +167,7 @@ do { \ | |||
167 | do { \ | 167 | do { \ |
168 | if (printk_ratelimit()) \ | 168 | if (printk_ratelimit()) \ |
169 | dev_err(&i1480u->usb_iface->dev, msg); \ | 169 | dev_err(&i1480u->usb_iface->dev, msg); \ |
170 | i1480u->stats.rx_dropped++; \ | 170 | i1480u->net_dev->stats.rx_dropped++; \ |
171 | } while (0) | 171 | } while (0) |
172 | 172 | ||
173 | 173 | ||
@@ -193,10 +193,8 @@ void i1480u_skb_deliver(struct i1480u *i1480u) | |||
193 | if (!should_parse) | 193 | if (!should_parse) |
194 | goto out; | 194 | goto out; |
195 | i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev); | 195 | i1480u->rx_skb->protocol = eth_type_trans(i1480u->rx_skb, net_dev); |
196 | i1480u->stats.rx_packets++; | 196 | net_dev->stats.rx_packets++; |
197 | i1480u->stats.rx_bytes += i1480u->rx_untd_pkt_size; | 197 | net_dev->stats.rx_bytes += i1480u->rx_untd_pkt_size; |
198 | net_dev->last_rx = jiffies; | ||
199 | /* FIXME: flow control: check netif_rx() retval */ | ||
200 | 198 | ||
201 | netif_rx(i1480u->rx_skb); /* deliver */ | 199 | netif_rx(i1480u->rx_skb); /* deliver */ |
202 | out: | 200 | out: |
diff --git a/drivers/uwb/i1480/i1480u-wlp/tx.c b/drivers/uwb/i1480/i1480u-wlp/tx.c index 39032cc3503e..26bacc009c65 100644 --- a/drivers/uwb/i1480/i1480u-wlp/tx.c +++ b/drivers/uwb/i1480/i1480u-wlp/tx.c | |||
@@ -117,8 +117,8 @@ void i1480u_tx_cb(struct urb *urb) | |||
117 | switch (urb->status) { | 117 | switch (urb->status) { |
118 | case 0: | 118 | case 0: |
119 | spin_lock_irqsave(&i1480u->lock, flags); | 119 | spin_lock_irqsave(&i1480u->lock, flags); |
120 | i1480u->stats.tx_packets++; | 120 | net_dev->stats.tx_packets++; |
121 | i1480u->stats.tx_bytes += urb->actual_length; | 121 | net_dev->stats.tx_bytes += urb->actual_length; |
122 | spin_unlock_irqrestore(&i1480u->lock, flags); | 122 | spin_unlock_irqrestore(&i1480u->lock, flags); |
123 | break; | 123 | break; |
124 | case -ECONNRESET: /* Not an error, but a controlled situation; */ | 124 | case -ECONNRESET: /* Not an error, but a controlled situation; */ |
@@ -530,7 +530,7 @@ int i1480u_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev) | |||
530 | return NETDEV_TX_OK; | 530 | return NETDEV_TX_OK; |
531 | error: | 531 | error: |
532 | dev_kfree_skb_any(skb); | 532 | dev_kfree_skb_any(skb); |
533 | i1480u->stats.tx_dropped++; | 533 | net_dev->stats.tx_dropped++; |
534 | out: | 534 | out: |
535 | return NETDEV_TX_OK; | 535 | return NETDEV_TX_OK; |
536 | } | 536 | } |