isdn: Kill directly reference of netdev->priv
Subsystems (2)
PATCH 1/1 isdn: Kill directly reference of netdev->priv
Simply use netdev_priv() to replace netdev->priv.
When I was making this patch, I fixed some checkpatch warning. But there are still some "line over 80 characters" warnings not fixed.
Because if I fix such warning will change the code structure.
Dave if you don't like the checkpatch warning, please tell me.
--- drivers/isdn/i4l/isdn_concap.c | 4 +- drivers/isdn/i4l/isdn_net.c | 83 ++++++++++++++++++++------------------- drivers/isdn/i4l/isdn_net.h | 7 +++- drivers/isdn/i4l/isdn_ppp.c | 20 +++++----- 4 files changed, 61 insertions(+), 53 deletions(-)
drivers/isdn/i4l/isdn_concap.c +2 -2
@@ -42,7 +42,7 @@static int isdn_concap_dl_data_req (struct concap_proto *concap,struct sk_buff *skb) {struct net_device *ndev = concap -> net_dev; -isdn_net_dev *nd = ((isdn_net_local *) ndev->priv)->netdev; +isdn_net_dev *nd = ((isdn_net_local *)netdev_priv (ndev))->netdev;isdn_net_local *lp =isdn_net_get_locked_lp (nd);IX25DEBUG ("isdn_concap_dl_data_req: %s \n" , concap->net_dev->name);
@@ -61,7 +61,7 @@ static int isdn_concap_dl_data_req(struct concap_proto *concap, struct sk_buff *static int isdn_concap_dl_connect_req (struct concap_proto *concap) {struct net_device *ndev = concap -> net_dev; -isdn_net_local *lp = (isdn_net_local *) ndev->priv; +isdn_net_local *lp = (isdn_net_local *)netdev_priv (ndev);int ret;IX25DEBUG ("isdn_concap_dl_connect_req: %s \n" , ndev -> name);
drivers/isdn/i4l/isdn_net.c +43 -40
276 lines not on this page · raw message
drivers/isdn/i4l/isdn_net.h +6 -1
@@ -56,6 +56,11 @@ extern void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb);#define ISDN_NET_MAX_QUEUE_LENGTH 2 +#define ISDN_MASTER_PRIV (lp) ((isdn_net_local *) netdev_priv(lp->master)) +#define ISDN_SLAVE_PRIV (lp) ((isdn_net_local *) netdev_priv(lp->slave)) +#define MASTER_TO_SLAVE (master) \ + (((isdn_net_local *) netdev_priv(master))->slave) +/* * is this particular channel busy? */
@@ -126,7 +131,7 @@ static __inline__ void isdn_net_rm_from_bundle(isdn_net_local *lp)unsigned long flags;if (lp->master) - master_lp = (isdn_net_local *) lp->master->priv; + master_lp =ISDN_MASTER_PRIV (lp);// printk(KERN_DEBUG "%s: lp:%s(%p) mlp:%s(%p) last(%p) next(%p) mndq(%p)\n", // __func__, lp->name, lp, master_lp->name, master_lp, lp->last, lp->next, master_lp->netdev->queue);
drivers/isdn/i4l/isdn_ppp.c +10 -10
@@ -1040,7 +1040,7 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff is = ippp_table[slot];if (lp->master) {// FIXME? - mlp = (isdn_net_local *) lp->master->priv; + mlp =ISDN_MASTER_PRIV (lp); slot = mlp->ppp_slot;if (slot <0 || slot >=ISDN_MAX_CHANNELS ) { printk(KERN_ERR "isdn_ppp_push_higher: master->ppp_slot(%d)\n",
@@ -1223,7 +1223,7 @@ isdn_ppp_xmit(struct sk_buff *skb, struct net_device *netdev)struct ippp_struct *ipt,*ipts;int slot, retval =0 ; - mlp = (isdn_net_local *) (netdev->priv); + mlp = (isdn_net_local *)netdev_priv (netdev); nd = mlp->netdev;/* get master lp */ slot = mlp->ppp_slot;
@@ -2013,7 +2013,7 @@ isdn_ppp_dev_ioctl_stats(int slot, struct ifreq *ifr, struct net_device *dev) {struct ppp_stats __user *res = ifr->ifr_data;struct ppp_stats t; -isdn_net_local *lp = (isdn_net_local *) dev->priv; +isdn_net_local *lp = (isdn_net_local *)netdev_priv (dev);if (!access_ok (VERIFY_WRITE , res,sizeof (struct ppp_stats )))return -EFAULT ;
@@ -2052,7 +2052,7 @@ isdn_ppp_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) {int error=0 ;int len; -isdn_net_local *lp = (isdn_net_local *) dev->priv; +isdn_net_local *lp = (isdn_net_local *)netdev_priv (dev);if (lp->p_encap !=ISDN_NET_ENCAP_SYNCPPP )
@@ -2119,7 +2119,7 @@ isdn_ppp_dial_slave(char *name) sdev = lp->slave;while (sdev) { -isdn_net_local *mlp = (isdn_net_local *) sdev->priv; +isdn_net_local *mlp = (isdn_net_local *)netdev_priv (sdev);if (!(mlp->flags &ISDN_NET_CONNECTED ))break ; sdev = mlp->slave;
@@ -2127,7 +2127,7 @@ isdn_ppp_dial_slave(char *name)if (!sdev)return 2 ; -isdn_net_dial_req ((isdn_net_local *) sdev->priv); +isdn_net_dial_req ((isdn_net_local *)netdev_priv (sdev));return 0 ;#else return -1 ;
@@ -2150,10 +2150,10 @@ isdn_ppp_hangup_slave(char *name) sdev = lp->slave;while (sdev) { -isdn_net_local *mlp = (isdn_net_local *) sdev->priv; +isdn_net_local *mlp = (isdn_net_local *)netdev_priv (sdev);if (mlp->slave) {/* find last connected link in chain */ -isdn_net_local *nlp = (isdn_net_local *) mlp->slave->priv; +isdn_net_local *nlp =ISDN_SLAVE_PRIV (mlp);if (!(nlp->flags &ISDN_NET_CONNECTED ))break ;
@@ -2688,7 +2688,7 @@ static void isdn_ppp_receive_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,isdn_ppp_frame_log ("ccp-rcv" , skb->data, skb->len,32 , is->unit,lp->ppp_slot);if (lp->master) { -int slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; +int slot =ISDN_MASTER_PRIV (lp)->ppp_slot;if (slot <0 || slot >=ISDN_MAX_CHANNELS ) {printk (KERN_ERR "%s: slot(%d) out of range\n" , __func__, slot);
@@ -2875,7 +2875,7 @@ static void isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp, structisdn_ppp_frame_log ("ccp-xmit" , skb->data, skb->len,32 , is->unit,lp->ppp_slot);if (lp->master) { - slot = ((isdn_net_local *) (lp->master->priv))->ppp_slot; + slot =ISDN_MASTER_PRIV (lp)->ppp_slot;if (slot <0 || slot >=ISDN_MAX_CHANNELS ) {printk (KERN_ERR "%s: slot(%d) out of range\n" , __func__, slot);
Signature · 1 line
1.5.3.4
From: Wang Chen <[email protected]>
Date: Mon, 01 Dec 2008 22:28:15 +0800
Quoted 10 lines
Simply use
netdev_priv()to replacenetdev->priv.When I was making this patch, I fixed some checkpatch warning. But there are still some "line over 80 characters" warnings not fixed.
Because if I fix such warning will change the code structure.Dave if you don't like the checkpatch warning, please tell me.
Signed-off-by Wang Chen <[email protected]>
Applied, thanks Wang.
This code is probably so full of such checkpatch issues that I don't expect you to be required to fix them up just to make this change.
So don't worry :)