From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>, Krzysztof Halasa <khc@pm.waw.pl>
Cc: netdev@vger.kernel.org
Subject: [PATCH 37/42] synclink: convert devices to new API (rev2)
Date: Wed, 7 Jan 2009 15:48:35 -0800 [thread overview]
Message-ID: <20090107154835.37f4de4c@extreme> (raw)
In-Reply-To: <20090107003349.468715485@vyatta.com>
Convert to net_device_ops and internal net_device_stats.
Remove unneeded last_rx update.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
drivers/char/pcmcia/synclink_cs.c | 15 +++++++++------
drivers/char/synclink.c | 15 +++++++++------
drivers/char/synclink_gt.c | 15 +++++++++------
drivers/char/synclinkmp.c | 15 +++++++++------
drivers/net/wan/hdlc.c | 21 +++++----------------
include/linux/hdlc.h | 2 ++
6 files changed, 43 insertions(+), 40 deletions(-)
--- a/drivers/char/pcmcia/synclink_cs.c 2009-01-07 15:26:51.830497659 -0800
+++ b/drivers/char/pcmcia/synclink_cs.c 2009-01-07 15:30:43.050748848 -0800
@@ -4311,10 +4311,16 @@ static void hdlcdev_rx(MGSLPC_INFO *info
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -4341,10 +4347,7 @@ static int hdlcdev_init(MGSLPC_INFO *inf
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclink.c 2009-01-07 15:26:51.810496861 -0800
+++ b/drivers/char/synclink.c 2009-01-07 15:30:43.054747103 -0800
@@ -8007,10 +8007,16 @@ static void hdlcdev_rx(struct mgsl_struc
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -8033,15 +8039,12 @@ static int hdlcdev_init(struct mgsl_stru
}
/* for network layer reporting purposes only */
+ dev->netdev_ops = &hdlcdev_ops;
dev->base_addr = info->io_base;
dev->irq = info->irq_level;
dev->dma = info->dma_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclink_gt.c 2009-01-07 15:26:51.798496911 -0800
+++ b/drivers/char/synclink_gt.c 2009-01-07 15:30:43.058746355 -0800
@@ -1766,10 +1766,16 @@ static void hdlcdev_rx(struct slgt_info
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1797,10 +1803,7 @@ static int hdlcdev_init(struct slgt_info
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/char/synclinkmp.c 2009-01-07 15:26:51.818498600 -0800
+++ b/drivers/char/synclinkmp.c 2009-01-07 15:30:43.058746355 -0800
@@ -1907,10 +1907,16 @@ static void hdlcdev_rx(SLMP_INFO *info,
dev->stats.rx_bytes += size;
netif_rx(skb);
-
- dev->last_rx = jiffies;
}
+static const struct net_device_ops hdlcdev_ops = {
+ .ndo_open = hdlcdev_open,
+ .ndo_stop = hdlcdev_close,
+ .ndo_change_mtu = hdlc_change_mtu,
+ .ndo_do_ioctl = hdlcdev_ioctl,
+ .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
/**
* called by device driver when adding device instance
* do generic HDLC initialization
@@ -1938,10 +1944,7 @@ static int hdlcdev_init(SLMP_INFO *info)
dev->irq = info->irq_level;
/* network layer callbacks and settings */
- dev->do_ioctl = hdlcdev_ioctl;
- dev->open = hdlcdev_open;
- dev->stop = hdlcdev_close;
- dev->tx_timeout = hdlcdev_tx_timeout;
+ dev->netdev_ops = &hdlcdev_ops;
dev->watchdog_timeo = 10*HZ;
dev->tx_queue_len = 50;
--- a/drivers/net/wan/hdlc.c 2009-01-07 15:26:51.782497083 -0800
+++ b/drivers/net/wan/hdlc.c 2009-01-07 15:46:08.174365761 -0800
@@ -40,26 +40,20 @@
static const char* version = "HDLC support module revision 1.22";
+static const struct header_ops hdlc_null_ops;
+
#undef DEBUG_LINK
static struct hdlc_proto *first_proto;
-static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
+int hdlc_change_mtu(struct net_device *dev, int new_mtu)
{
if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
return -EINVAL;
dev->mtu = new_mtu;
return 0;
}
-
-
-
-static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
-{
- return &dev->stats;
-}
-
-
+EXPORT_SYMBOL(hdlc_change_mtu);
static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *p, struct net_device *orig_dev)
@@ -106,7 +100,7 @@ static int hdlc_device_event(struct noti
if (dev_net(dev) != &init_net)
return NOTIFY_DONE;
- if (dev->get_stats != hdlc_get_stats)
+ if (dev->header_ops != &hdlc_null_ops)
return NOTIFY_DONE; /* not an HDLC device */
if (event != NETDEV_CHANGE)
@@ -226,22 +220,17 @@ int hdlc_ioctl(struct net_device *dev, s
return -EINVAL;
}
-static const struct header_ops hdlc_null_ops;
-
static void hdlc_setup_dev(struct net_device *dev)
{
/* Re-init all variables changed by HDLC protocol drivers,
* including ether_setup() called from hdlc_raw_eth.c.
*/
- dev->get_stats = hdlc_get_stats;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->mtu = HDLC_MAX_MTU;
dev->type = ARPHRD_RAWHDLC;
dev->hard_header_len = 16;
dev->addr_len = 0;
dev->header_ops = &hdlc_null_ops;
-
- dev->change_mtu = hdlc_change_mtu;
}
static void hdlc_setup(struct net_device *dev)
--- a/include/linux/hdlc.h 2009-01-07 15:26:51.842497178 -0800
+++ b/include/linux/hdlc.h 2009-01-07 15:30:43.062746598 -0800
@@ -103,6 +103,8 @@ int hdlc_open(struct net_device *dev);
/* Must be called by hardware driver when HDLC device is being closed */
void hdlc_close(struct net_device *dev);
+int hdlc_change_mtu(struct net_device *dev, int new_mtu);
+
int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
size_t size);
/* May be used by hardware driver to gain control over HDLC device */
next prev parent reply other threads:[~2009-01-07 23:48 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 0:33 [PATCH 00/42] Still more net_device API updates Stephen Hemminger
2009-01-07 0:33 ` [PATCH 01/42] appletalk: convert aarp to net_device_ops Stephen Hemminger
2009-01-08 1:21 ` David Miller
2009-01-08 3:09 ` Joe Perches
2009-01-08 4:39 ` David Miller
2009-01-07 0:33 ` [PATCH 02/42] appletalk: convert ipddp " Stephen Hemminger
2009-01-08 1:22 ` David Miller
2009-01-07 0:33 ` [PATCH 03/42] bluetooth: driver API update Stephen Hemminger
[not found] ` <20090107003345.753201945-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2009-01-07 1:53 ` Marcel Holtmann
2009-01-08 1:23 ` David Miller
2009-01-07 0:33 ` [PATCH 05/42] cassini: update to net_device_ops Stephen Hemminger
2009-01-08 1:25 ` David Miller
2009-01-07 0:33 ` [PATCH 06/42] ipg: " Stephen Hemminger
2009-01-07 7:59 ` Pekka Enberg
2009-01-08 1:26 ` David Miller
2009-01-07 0:33 ` [PATCH 07/42] plip: " Stephen Hemminger
2009-01-08 1:26 ` David Miller
2009-01-07 0:33 ` [PATCH 08/42] tlan: " Stephen Hemminger
2009-01-08 1:27 ` David Miller
2009-01-07 0:33 ` [PATCH 09/42] epic100: " Stephen Hemminger
2009-01-08 1:27 ` David Miller
2009-01-07 0:33 ` [PATCH 10/42] sunhme: " Stephen Hemminger
2009-01-08 1:28 ` David Miller
2009-01-07 0:33 ` [PATCH 11/42] sungem: " Stephen Hemminger
2009-01-08 1:29 ` David Miller
2009-01-07 0:33 ` [PATCH 12/42] pcnet32: " Stephen Hemminger
2009-01-08 1:29 ` David Miller
2009-01-07 0:33 ` [PATCH 13/42] typhoon: " Stephen Hemminger
2009-01-08 1:29 ` David Miller
2009-01-07 0:33 ` [PATCH 14/42] enc28j60: " Stephen Hemminger
2009-01-08 1:30 ` David Miller
2009-01-07 0:33 ` [PATCH 16/42] de600: " Stephen Hemminger
2009-01-08 1:35 ` David Miller
2009-01-08 1:48 ` [PATCH 15/42] hp100: " Stephen Hemminger
2009-01-08 2:13 ` David Miller
2009-01-07 0:33 ` [PATCH 17/42] sis190: " Stephen Hemminger
2009-01-08 1:35 ` David Miller
2009-01-07 0:33 ` [PATCH 18/42] ns83820: fix net_device_ops support Stephen Hemminger
2009-01-08 1:36 ` David Miller
2009-01-07 0:33 ` [PATCH 19/42] sb1000: update to net_device_ops Stephen Hemminger
2009-01-08 1:57 ` David Miller
2009-01-07 0:33 ` [PATCH 20/42] natsemi: " Stephen Hemminger
2009-01-08 1:57 ` David Miller
2009-01-07 0:33 ` [PATCH 21/42] fealnx: " Stephen Hemminger
2009-01-08 1:57 ` David Miller
2009-01-07 0:33 ` [PATCH 22/42] starfire: " Stephen Hemminger
2009-01-08 1:58 ` David Miller
2009-01-07 0:33 ` [PATCH 23/42] sundance: " Stephen Hemminger
2009-01-08 1:58 ` David Miller
2009-01-07 0:33 ` [PATCH 24/42] tulip: convert devices to new API Stephen Hemminger
2009-01-07 7:49 ` Grant Grundler
2009-01-08 1:59 ` David Miller
2009-01-07 0:33 ` [PATCH 25/42] de2104x: convert to net_device_ops Stephen Hemminger
2009-01-07 7:50 ` Grant Grundler
2009-01-08 1:59 ` David Miller
2009-01-07 0:33 ` [PATCH 26/42] de4x5: " Stephen Hemminger
2009-01-08 2:00 ` David Miller
2009-01-07 0:33 ` [PATCH 27/42] xircom: convert devices to new API Stephen Hemminger
2009-01-08 2:01 ` David Miller
2009-01-07 0:33 ` [PATCH 28/42] dmfe: convert " Stephen Hemminger
2009-01-08 21:16 ` Grant Grundler
2009-01-08 21:32 ` David Miller
2009-01-07 0:33 ` [PATCH 29/42] uli526x: convert devices " Stephen Hemminger
2009-01-08 2:01 ` David Miller
2009-01-07 0:33 ` [PATCH 30/42] windbond: " Stephen Hemminger
2009-01-08 2:02 ` David Miller
2009-01-07 0:33 ` [PATCH 31/42] dvb: update network device to current API Stephen Hemminger
2009-01-08 2:02 ` David Miller
2009-01-07 0:33 ` [PATCH 32/42] hysdn: convert to net_device_ops and other updates Stephen Hemminger
2009-01-08 2:03 ` David Miller
2009-01-07 0:33 ` [PATCH 33/42] I4l: convert to net_device_ops Stephen Hemminger
2009-01-07 0:33 ` [PATCH 34/42] fusion: convert devices to new API Stephen Hemminger
2009-01-08 2:04 ` David Miller
2009-01-07 0:33 ` [PATCH 35/42] xpnet: " Stephen Hemminger
2009-01-08 2:05 ` David Miller
2009-01-07 0:33 ` [PATCH 36/42] gadget: " Stephen Hemminger
2009-01-08 2:05 ` David Miller
2009-01-07 0:33 ` [PATCH 37/42] synclink: " Stephen Hemminger
2009-01-07 23:48 ` Stephen Hemminger [this message]
2009-01-08 2:08 ` [PATCH 37/42] synclink: convert devices to new API (rev2) David Miller
2009-01-08 22:49 ` Krzysztof Halasa
2009-01-08 22:55 ` Krzysztof Halasa
2009-01-13 0:18 ` David Miller
2009-01-07 0:33 ` [PATCH 38/42] uwb: convert devices to net_device_ops Stephen Hemminger
2009-01-07 10:38 ` David Vrabel
2009-01-08 2:09 ` David Miller
2009-01-07 0:33 ` [PATCH 39/42] slip: convert " Stephen Hemminger
2009-01-08 2:09 ` David Miller
2009-01-07 0:33 ` [PATCH 40/42] amd8111e: " Stephen Hemminger
2009-01-08 2:10 ` David Miller
2009-01-07 0:33 ` [PATCH 41/42] atp: " Stephen Hemminger
2009-01-08 2:10 ` David Miller
2009-01-07 0:33 ` [PATCH 42/42] b44: " Stephen Hemminger
2009-01-08 2:10 ` David Miller
[not found] ` <20090107003345.872219054@vyatta.com>
2009-01-08 1:25 ` [PATCH 04/42] phonet: update " David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090107154835.37f4de4c@extreme \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=khc@pm.waw.pl \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).