All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Chen <wangchen@cn.fujitsu.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "Jeff Garzik" <jgarzik@pobox.com>,
	NETDEV <netdev@vger.kernel.org>,
	"Krzysztof Hałasa" <khc@pm.waw.pl>
Subject: [PATCH 11/18] netdevice cycx_x25: Convert directly reference of netdev->priv to netdev->ml_priv
Date: Fri, 05 Sep 2008 11:23:23 +0800	[thread overview]
Message-ID: <48C0A62B.10806@cn.fujitsu.com> (raw)
In-Reply-To: <48C0A219.2030004@cn.fujitsu.com>

We have some reasons to kill netdev->priv:
1. netdev->priv is equal to netdev_priv().
2. netdev_priv() wraps the calculation of netdev->priv's offset, obviously
   netdev_priv() is more flexible than netdev->priv.
But we cann't kill netdev->priv, because so many drivers reference to it
directly.

OK, becasue Dave S. Miller said, "every direct netdev->priv usage is a bug",
and I want to kill netdev->priv later, I decided to convert all the direct
reference of netdev->priv first.

Different to readonly reference of netdev->priv, in this driver, netdev->priv
was changed. I use netdev->ml_priv to replace netdev->priv.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
 drivers/net/wan/cycx_x25.c |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index d3b28b0..5309220 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -445,7 +445,7 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev,
 	/* prepare network device data space for registration */
 	strcpy(dev->name, chan->name);
 	dev->init = cycx_netdevice_init;
-	dev->priv = chan;
+	dev->ml_priv = chan;
 
 	return 0;
 }
@@ -453,8 +453,8 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev,
 /* Delete logical channel. */
 static int cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev)
 {
-	if (dev->priv) {
-		struct cycx_x25_channel *chan = dev->priv;
+	if (dev->ml_priv) {
+		struct cycx_x25_channel *chan = dev->ml_priv;
 
 		if (chan->svc) {
 			kfree(chan->local_addr);
@@ -463,7 +463,7 @@ static int cycx_wan_del_if(struct wan_device *wandev, struct net_device *dev)
 		}
 
 		kfree(chan);
-		dev->priv = NULL;
+		dev->ml_priv = NULL;
 	}
 
 	return 0;
@@ -484,7 +484,7 @@ static const struct header_ops cycx_header_ops = {
  * registration. */
 static int cycx_netdevice_init(struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 	struct cycx_device *card = chan->card;
 	struct wan_device *wandev = &card->wandev;
 
@@ -542,7 +542,7 @@ static int cycx_netdevice_open(struct net_device *dev)
  * o if there's no more open channels then disconnect physical link. */
 static int cycx_netdevice_stop(struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 
 	netif_stop_queue(dev);
 
@@ -596,7 +596,7 @@ static int cycx_netdevice_rebuild_header(struct sk_buff *skb)
 static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
 					  struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 	struct cycx_device *card = chan->card;
 
 	if (!chan->svc)
@@ -670,7 +670,7 @@ free_packet:
  * Return a pointer to struct net_device_stats */
 static struct net_device_stats *cycx_netdevice_get_stats(struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 
 	return chan ? &chan->ifstats : NULL;
 }
@@ -783,7 +783,7 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd)
 		return;
 	}
 
-	chan = dev->priv;
+	chan = dev->ml_priv;
 	reset_timer(dev);
 
 	if (chan->drop_sequence) {
@@ -884,7 +884,7 @@ static void cycx_x25_irq_connect(struct cycx_device *card,
 		return;
 	}
 
-	chan = dev->priv;
+	chan = dev->ml_priv;
 	chan->lcn = lcn;
 	cycx_x25_connect_response(card, chan);
 	cycx_x25_set_chan_state(dev, WAN_CONNECTED);
@@ -914,7 +914,7 @@ static void cycx_x25_irq_connect_confirm(struct cycx_device *card,
 	}
 
 	clear_bit(--key, (void*)&card->u.x.connection_keys);
-	chan = dev->priv;
+	chan = dev->ml_priv;
 	chan->lcn = lcn;
 	cycx_x25_set_chan_state(dev, WAN_CONNECTED);
 }
@@ -954,7 +954,7 @@ static void cycx_x25_irq_disconnect(struct cycx_device *card,
 
 	dev = cycx_x25_get_dev_by_lcn(wandev, lcn);
 	if (dev) {
-		struct cycx_x25_channel *chan = dev->priv;
+		struct cycx_x25_channel *chan = dev->ml_priv;
 
 		cycx_x25_disconnect_response(card, chan->link, lcn);
 		cycx_x25_set_chan_state(dev, WAN_DISCONNECTED);
@@ -1302,7 +1302,7 @@ static struct net_device *cycx_x25_get_dev_by_lcn(struct wan_device *wandev,
 	struct cycx_x25_channel *chan;
 
 	while (dev) {
-		chan = (struct cycx_x25_channel*)dev->priv;
+		chan = (struct cycx_x25_channel *)dev->ml_priv;
 
 		if (chan->lcn == lcn)
 			break;
@@ -1319,7 +1319,7 @@ static struct net_device *
 	struct cycx_x25_channel *chan;
 
 	while (dev) {
-		chan = (struct cycx_x25_channel*)dev->priv;
+		chan = (struct cycx_x25_channel *)dev->ml_priv;
 
 		if (!strcmp(chan->addr, dte))
 			break;
@@ -1337,7 +1337,7 @@ static struct net_device *
  *		<0	failure */
 static int cycx_x25_chan_connect(struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 	struct cycx_device *card = chan->card;
 
 	if (chan->svc) {
@@ -1362,7 +1362,7 @@ static int cycx_x25_chan_connect(struct net_device *dev)
  * o if SVC then clear X.25 call */
 static void cycx_x25_chan_disconnect(struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 
 	if (chan->svc) {
 		x25_clear_call(chan->card, chan->link, chan->lcn, 0, 0);
@@ -1375,7 +1375,7 @@ static void cycx_x25_chan_disconnect(struct net_device *dev)
 static void cycx_x25_chan_timer(unsigned long d)
 {
 	struct net_device *dev = (struct net_device *)d;
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 
 	if (chan->state == WAN_CONNECTED)
 		cycx_x25_chan_disconnect(dev);
@@ -1387,7 +1387,7 @@ static void cycx_x25_chan_timer(unsigned long d)
 /* Set logical channel state. */
 static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 	struct cycx_device *card = chan->card;
 	unsigned long flags;
 	char *string_state = NULL;
@@ -1453,7 +1453,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
  *    to the router.  */
 static int cycx_x25_chan_send(struct net_device *dev, struct sk_buff *skb)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 	struct cycx_device *card = chan->card;
 	int bitm = 0;		/* final packet */
 	unsigned len = skb->len;
@@ -1547,7 +1547,7 @@ static unsigned dec_to_uint(u8 *str, int len)
 
 static void reset_timer(struct net_device *dev)
 {
-	struct cycx_x25_channel *chan = dev->priv;
+	struct cycx_x25_channel *chan = dev->ml_priv;
 
 	if (chan->svc)
 		mod_timer(&chan->timer, jiffies+chan->idle_tmout*HZ);
@@ -1600,7 +1600,7 @@ static void cycx_x25_dump_devs(struct wan_device *wandev)
 	printk(KERN_INFO "---------------------------------------\n");
 
 	while(dev) {
-		struct cycx_x25_channel *chan = dev->priv;
+		struct cycx_x25_channel *chan = dev->ml_priv;
 
 		printk(KERN_INFO "%-5.5s %-15.15s   %d     ETH_P_%s\n",
 				 chan->name, chan->addr, netif_queue_stopped(dev),
-- 
1.5.3.4



  parent reply	other threads:[~2008-09-05  3:25 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-05  3:06 [V#2 PATCH 0/18] netdevice: Fix directly reference of netdev->priv Wang Chen
2008-09-05  3:09 ` [PATCH 01/18] netdevice: safe convert to netdev_priv() #part-1 Wang Chen
2008-09-05  3:10 ` [PATCH 02/18] netdevice: safe convert to netdev_priv() #part-2 Wang Chen
2008-09-05  3:11 ` [PATCH 03/18] netdevice: safe convert to netdev_priv() #part-3 Wang Chen
2008-09-05 13:58   ` David Dillow
2008-09-05  3:11 ` [PATCH 04/18] netdevice: safe convert to netdev_priv() #part-4 Wang Chen
2008-09-05  3:14 ` [PATCH 05/18] netdevice 82596: Convert directly reference of netdev->priv to netdev->ml_priv Wang Chen
2008-09-05  3:15 ` [PATCH 06/18] netdevice chelsio: " Wang Chen
2008-09-05  3:17 ` [PATCH 07/18] netdevice hamradio: " Wang Chen
2008-09-05  3:19 ` [PATCH 08/18] netdevice lance: " Wang Chen
2008-09-05  3:20 ` [PATCH 09/18] netdevice ni65: " Wang Chen
2008-09-05  3:21 ` [PATCH 10/18] netdevice ppp: " Wang Chen
2008-09-05  3:23 ` Wang Chen [this message]
2008-09-05  3:24 ` [PATCH 12/18] netdevice hdlc: " Wang Chen
2008-09-05 16:38   ` Krzysztof Halasa
2008-09-05  3:25 ` [PATCH 13/18] netdevice wanrouter: " Wang Chen
2008-09-05  3:27 ` [PATCH 14/18] netdevice airo: " Wang Chen
2008-09-05 12:50   ` John W. Linville
2008-09-05 17:06     ` Dan Williams
2008-09-05 17:06       ` Dan Williams
2008-09-06  9:37       ` Wang Chen
2008-09-06  9:37         ` Wang Chen
2008-09-26  8:37         ` Wang Chen
2008-09-26  8:37           ` Wang Chen
2008-09-05  3:28 ` [PATCH 15/18] netdevice libertas: Fix directly reference of netdev->priv Wang Chen
2008-09-05  3:28   ` Wang Chen
2008-09-05 17:07   ` Dan Williams
2008-09-05 17:07     ` Dan Williams
2008-10-31 19:17     ` John W. Linville
2008-10-31 19:17       ` John W. Linville
2008-09-05  3:29 ` [PATCH 16/18] netdevice zd1201: Convert directly reference of netdev->priv to netdev->ml_priv Wang Chen
2008-09-05  3:29   ` Wang Chen
2008-09-05 12:56   ` John W. Linville
2008-10-31 18:22   ` John W. Linville
2008-10-31 18:22     ` John W. Linville
2008-10-31 18:48     ` [PATCH] netdevice zd1201: Convert directly reference of netdev->priv to netdev_priv() John W. Linville
2008-10-31 18:48       ` John W. Linville
2008-10-31 19:00       ` Stephen Hemminger
2008-10-31 19:00         ` Stephen Hemminger
2008-11-03  2:06       ` Wang Chen
2008-11-03  2:06         ` Wang Chen
2008-12-18  6:53       ` [PATCH -next] netdevice zd1201: Use after free Wang Chen
2008-12-18 13:58         ` John W. Linville
2008-12-19  3:37         ` David Miller
2008-12-19  3:37           ` David Miller
2008-09-05  3:30 ` [PATCH 17/18] netdevice pc300: Convert directly reference of netdev->priv to netdev->ml_priv Wang Chen
2008-09-09 13:23   ` Krzysztof Halasa
2008-09-05  3:31 ` [PATCH 18/18] netdevice sbni: Convert directly reference of netdev->priv to netdev_priv() Wang Chen
2008-09-05  3:42 ` [V#2 PATCH 0/18] netdevice: Fix directly reference of netdev->priv Wang Chen
2008-09-20  8:17 ` Wang Chen
2008-09-20 10:37   ` David Miller
2008-09-22  7:04     ` Wang Chen

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=48C0A62B.10806@cn.fujitsu.com \
    --to=wangchen@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.