aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l/isdn_net.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2008-12-03 18:49:46 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-03 18:49:46 -0500
commit838361fe7828a3ad1aae8dee87620474931dac5e (patch)
treef13348e539f193b46c45365587df155abb56b582 /drivers/isdn/i4l/isdn_net.c
parent25dd7e6aedff054736f9edfd05bb585d810d8543 (diff)
isdn: Kill directly reference of netdev->priv
Simply use netdev_priv() to replace netdev->priv. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/i4l/isdn_net.c')
-rw-r--r--drivers/isdn/i4l/isdn_net.c83
1 files changed, 43 insertions, 40 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 4da81c132589..023ea11d2f9e 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -120,7 +120,7 @@ static __inline__ int isdn_net_device_busy(isdn_net_local *lp)
120 return 0; 120 return 0;
121 121
122 if (lp->master) 122 if (lp->master)
123 nd = ((isdn_net_local *) lp->master->priv)->netdev; 123 nd = ISDN_MASTER_PRIV(lp)->netdev;
124 else 124 else
125 nd = lp->netdev; 125 nd = lp->netdev;
126 126
@@ -213,9 +213,9 @@ isdn_net_reset(struct net_device *dev)
213{ 213{
214#ifdef CONFIG_ISDN_X25 214#ifdef CONFIG_ISDN_X25
215 struct concap_device_ops * dops = 215 struct concap_device_ops * dops =
216 ( (isdn_net_local *) dev->priv ) -> dops; 216 ((isdn_net_local *) netdev_priv(dev))->dops;
217 struct concap_proto * cprot = 217 struct concap_proto * cprot =
218 ( (isdn_net_local *) dev->priv ) -> netdev -> cprot; 218 ((isdn_net_local *) netdev_priv(dev))->netdev->cprot;
219#endif 219#endif
220#ifdef CONFIG_ISDN_X25 220#ifdef CONFIG_ISDN_X25
221 if( cprot && cprot -> pops && dops ) 221 if( cprot && cprot -> pops && dops )
@@ -250,11 +250,11 @@ isdn_net_open(struct net_device *dev)
250 } 250 }
251 251
252 /* If this interface has slaves, start them also */ 252 /* If this interface has slaves, start them also */
253 253 p = MASTER_TO_SLAVE(dev);
254 if ((p = (((isdn_net_local *) dev->priv)->slave))) { 254 if (p) {
255 while (p) { 255 while (p) {
256 isdn_net_reset(p); 256 isdn_net_reset(p);
257 p = (((isdn_net_local *) p->priv)->slave); 257 p = MASTER_TO_SLAVE(p);
258 } 258 }
259 } 259 }
260 isdn_lock_drivers(); 260 isdn_lock_drivers();
@@ -483,7 +483,7 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
483 isdn_net_ciscohdlck_connected(lp); 483 isdn_net_ciscohdlck_connected(lp);
484 if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) { 484 if (lp->p_encap != ISDN_NET_ENCAP_SYNCPPP) {
485 if (lp->master) { /* is lp a slave? */ 485 if (lp->master) { /* is lp a slave? */
486 isdn_net_dev *nd = ((isdn_net_local *)lp->master->priv)->netdev; 486 isdn_net_dev *nd = ISDN_MASTER_PRIV(lp)->netdev;
487 isdn_net_add_to_bundle(nd, lp); 487 isdn_net_add_to_bundle(nd, lp);
488 } 488 }
489 } 489 }
@@ -823,7 +823,7 @@ isdn_net_dial(void)
823void 823void
824isdn_net_hangup(struct net_device *d) 824isdn_net_hangup(struct net_device *d)
825{ 825{
826 isdn_net_local *lp = (isdn_net_local *) d->priv; 826 isdn_net_local *lp = (isdn_net_local *) netdev_priv(d);
827 isdn_ctrl cmd; 827 isdn_ctrl cmd;
828#ifdef CONFIG_ISDN_X25 828#ifdef CONFIG_ISDN_X25
829 struct concap_proto *cprot = lp->netdev->cprot; 829 struct concap_proto *cprot = lp->netdev->cprot;
@@ -832,7 +832,7 @@ isdn_net_hangup(struct net_device *d)
832 832
833 if (lp->flags & ISDN_NET_CONNECTED) { 833 if (lp->flags & ISDN_NET_CONNECTED) {
834 if (lp->slave != NULL) { 834 if (lp->slave != NULL) {
835 isdn_net_local *slp = (isdn_net_local *)lp->slave->priv; 835 isdn_net_local *slp = ISDN_SLAVE_PRIV(lp);
836 if (slp->flags & ISDN_NET_CONNECTED) { 836 if (slp->flags & ISDN_NET_CONNECTED) {
837 printk(KERN_INFO 837 printk(KERN_INFO
838 "isdn_net: hang up slave %s before %s\n", 838 "isdn_net: hang up slave %s before %s\n",
@@ -1048,10 +1048,10 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
1048{ 1048{
1049 isdn_net_dev *nd; 1049 isdn_net_dev *nd;
1050 isdn_net_local *slp; 1050 isdn_net_local *slp;
1051 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 1051 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
1052 int retv = 0; 1052 int retv = 0;
1053 1053
1054 if (((isdn_net_local *) (ndev->priv))->master) { 1054 if (((isdn_net_local *) netdev_priv(ndev))->master) {
1055 printk("isdn BUG at %s:%d!\n", __FILE__, __LINE__); 1055 printk("isdn BUG at %s:%d!\n", __FILE__, __LINE__);
1056 dev_kfree_skb(skb); 1056 dev_kfree_skb(skb);
1057 return 0; 1057 return 0;
@@ -1063,7 +1063,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
1063 return isdn_ppp_xmit(skb, ndev); 1063 return isdn_ppp_xmit(skb, ndev);
1064 } 1064 }
1065#endif 1065#endif
1066 nd = ((isdn_net_local *) ndev->priv)->netdev; 1066 nd = ((isdn_net_local *) netdev_priv(ndev))->netdev;
1067 lp = isdn_net_get_locked_lp(nd); 1067 lp = isdn_net_get_locked_lp(nd);
1068 if (!lp) { 1068 if (!lp) {
1069 printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name); 1069 printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name);
@@ -1090,9 +1090,9 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
1090 } else { 1090 } else {
1091 /* subsequent overload: if slavedelay exceeded, start dialing */ 1091 /* subsequent overload: if slavedelay exceeded, start dialing */
1092 if (time_after(jiffies, lp->sqfull_stamp + lp->slavedelay)) { 1092 if (time_after(jiffies, lp->sqfull_stamp + lp->slavedelay)) {
1093 slp = lp->slave->priv; 1093 slp = ISDN_SLAVE_PRIV(lp);
1094 if (!(slp->flags & ISDN_NET_CONNECTED)) { 1094 if (!(slp->flags & ISDN_NET_CONNECTED)) {
1095 isdn_net_force_dial_lp((isdn_net_local *) lp->slave->priv); 1095 isdn_net_force_dial_lp(ISDN_SLAVE_PRIV(lp));
1096 } 1096 }
1097 } 1097 }
1098 } 1098 }
@@ -1112,7 +1112,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
1112static void 1112static void
1113isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) 1113isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
1114{ 1114{
1115 isdn_net_local *lp = (isdn_net_local *) dev->priv; 1115 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev);
1116 if (!skb) 1116 if (!skb)
1117 return; 1117 return;
1118 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { 1118 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) {
@@ -1127,7 +1127,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev)
1127 1127
1128static void isdn_net_tx_timeout(struct net_device * ndev) 1128static void isdn_net_tx_timeout(struct net_device * ndev)
1129{ 1129{
1130 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 1130 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
1131 1131
1132 printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate); 1132 printk(KERN_WARNING "isdn_tx_timeout dev %s dialstate %d\n", ndev->name, lp->dialstate);
1133 if (!lp->dialstate){ 1133 if (!lp->dialstate){
@@ -1161,7 +1161,7 @@ static void isdn_net_tx_timeout(struct net_device * ndev)
1161static int 1161static int
1162isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev) 1162isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1163{ 1163{
1164 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 1164 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
1165#ifdef CONFIG_ISDN_X25 1165#ifdef CONFIG_ISDN_X25
1166 struct concap_proto * cprot = lp -> netdev -> cprot; 1166 struct concap_proto * cprot = lp -> netdev -> cprot;
1167/* At this point hard_start_xmit() passes control to the encapsulation 1167/* At this point hard_start_xmit() passes control to the encapsulation
@@ -1310,7 +1310,7 @@ isdn_net_close(struct net_device *dev)
1310 struct net_device *p; 1310 struct net_device *p;
1311#ifdef CONFIG_ISDN_X25 1311#ifdef CONFIG_ISDN_X25
1312 struct concap_proto * cprot = 1312 struct concap_proto * cprot =
1313 ( (isdn_net_local *) dev->priv ) -> netdev -> cprot; 1313 ((isdn_net_local *) netdev_priv(dev))->netdev->cprot;
1314 /* printk(KERN_DEBUG "isdn_net_close %s\n" , dev-> name ); */ 1314 /* printk(KERN_DEBUG "isdn_net_close %s\n" , dev-> name ); */
1315#endif 1315#endif
1316 1316
@@ -1318,17 +1318,18 @@ isdn_net_close(struct net_device *dev)
1318 if( cprot && cprot -> pops ) cprot -> pops -> close( cprot ); 1318 if( cprot && cprot -> pops ) cprot -> pops -> close( cprot );
1319#endif 1319#endif
1320 netif_stop_queue(dev); 1320 netif_stop_queue(dev);
1321 if ((p = (((isdn_net_local *) dev->priv)->slave))) { 1321 p = MASTER_TO_SLAVE(dev);
1322 if (p) {
1322 /* If this interface has slaves, stop them also */ 1323 /* If this interface has slaves, stop them also */
1323 while (p) { 1324 while (p) {
1324#ifdef CONFIG_ISDN_X25 1325#ifdef CONFIG_ISDN_X25
1325 cprot = ( (isdn_net_local *) p->priv ) 1326 cprot = ((isdn_net_local *) netdev_priv(p))
1326 -> netdev -> cprot; 1327 -> netdev -> cprot;
1327 if( cprot && cprot -> pops ) 1328 if( cprot && cprot -> pops )
1328 cprot -> pops -> close( cprot ); 1329 cprot -> pops -> close( cprot );
1329#endif 1330#endif
1330 isdn_net_hangup(p); 1331 isdn_net_hangup(p);
1331 p = (((isdn_net_local *) p->priv)->slave); 1332 p = MASTER_TO_SLAVE(p);
1332 } 1333 }
1333 } 1334 }
1334 isdn_net_hangup(dev); 1335 isdn_net_hangup(dev);
@@ -1342,7 +1343,7 @@ isdn_net_close(struct net_device *dev)
1342static struct net_device_stats * 1343static struct net_device_stats *
1343isdn_net_get_stats(struct net_device *dev) 1344isdn_net_get_stats(struct net_device *dev)
1344{ 1345{
1345 isdn_net_local *lp = (isdn_net_local *) dev->priv; 1346 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev);
1346 return &lp->stats; 1347 return &lp->stats;
1347} 1348}
1348 1349
@@ -1421,7 +1422,7 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
1421static int 1422static int
1422isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 1423isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1423{ 1424{
1424 isdn_net_local *lp = (isdn_net_local *) dev->priv; 1425 isdn_net_local *lp = (isdn_net_local *) netdev_priv(dev);
1425 unsigned long len = 0; 1426 unsigned long len = 0;
1426 unsigned long expires = 0; 1427 unsigned long expires = 0;
1427 int tmp = 0; 1428 int tmp = 0;
@@ -1763,7 +1764,7 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
1763static void 1764static void
1764isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) 1765isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
1765{ 1766{
1766 isdn_net_local *lp = (isdn_net_local *) ndev->priv; 1767 isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
1767 isdn_net_local *olp = lp; /* original 'lp' */ 1768 isdn_net_local *olp = lp; /* original 'lp' */
1768#ifdef CONFIG_ISDN_X25 1769#ifdef CONFIG_ISDN_X25
1769 struct concap_proto *cprot = lp -> netdev -> cprot; 1770 struct concap_proto *cprot = lp -> netdev -> cprot;
@@ -1777,7 +1778,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
1777 * handle master's statistics and hangup-timeout 1778 * handle master's statistics and hangup-timeout
1778 */ 1779 */
1779 ndev = lp->master; 1780 ndev = lp->master;
1780 lp = (isdn_net_local *) ndev->priv; 1781 lp = (isdn_net_local *) netdev_priv(ndev);
1781 lp->stats.rx_packets++; 1782 lp->stats.rx_packets++;
1782 lp->stats.rx_bytes += skb->len; 1783 lp->stats.rx_bytes += skb->len;
1783 } 1784 }
@@ -1878,7 +1879,7 @@ static int isdn_net_header(struct sk_buff *skb, struct net_device *dev,
1878 unsigned short type, 1879 unsigned short type,
1879 const void *daddr, const void *saddr, unsigned plen) 1880 const void *daddr, const void *saddr, unsigned plen)
1880{ 1881{
1881 isdn_net_local *lp = dev->priv; 1882 isdn_net_local *lp = netdev_priv(dev);
1882 unsigned char *p; 1883 unsigned char *p;
1883 ushort len = 0; 1884 ushort len = 0;
1884 1885
@@ -1935,7 +1936,7 @@ static int
1935isdn_net_rebuild_header(struct sk_buff *skb) 1936isdn_net_rebuild_header(struct sk_buff *skb)
1936{ 1937{
1937 struct net_device *dev = skb->dev; 1938 struct net_device *dev = skb->dev;
1938 isdn_net_local *lp = dev->priv; 1939 isdn_net_local *lp = netdev_priv(dev);
1939 int ret = 0; 1940 int ret = 0;
1940 1941
1941 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { 1942 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) {
@@ -1965,7 +1966,7 @@ isdn_net_rebuild_header(struct sk_buff *skb)
1965static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh) 1966static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
1966{ 1967{
1967 const struct net_device *dev = neigh->dev; 1968 const struct net_device *dev = neigh->dev;
1968 isdn_net_local *lp = dev->priv; 1969 isdn_net_local *lp = netdev_priv(dev);
1969 1970
1970 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) 1971 if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
1971 return eth_header_cache(neigh, hh); 1972 return eth_header_cache(neigh, hh);
@@ -1976,7 +1977,7 @@ static void isdn_header_cache_update(struct hh_cache *hh,
1976 const struct net_device *dev, 1977 const struct net_device *dev,
1977 const unsigned char *haddr) 1978 const unsigned char *haddr)
1978{ 1979{
1979 isdn_net_local *lp = dev->priv; 1980 isdn_net_local *lp = netdev_priv(dev);
1980 if (lp->p_encap == ISDN_NET_ENCAP_ETHER) 1981 if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
1981 eth_header_cache_update(hh, dev, haddr); 1982 eth_header_cache_update(hh, dev, haddr);
1982} 1983}
@@ -2291,16 +2292,16 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2291 * it's master and parent slave is online. If not, reject the call. 2292 * it's master and parent slave is online. If not, reject the call.
2292 */ 2293 */
2293 if (lp->master) { 2294 if (lp->master) {
2294 isdn_net_local *mlp = (isdn_net_local *) lp->master->priv; 2295 isdn_net_local *mlp = ISDN_MASTER_PRIV(lp);
2295 printk(KERN_DEBUG "ICALLslv: %s\n", p->dev->name); 2296 printk(KERN_DEBUG "ICALLslv: %s\n", p->dev->name);
2296 printk(KERN_DEBUG "master=%s\n", lp->master->name); 2297 printk(KERN_DEBUG "master=%s\n", lp->master->name);
2297 if (mlp->flags & ISDN_NET_CONNECTED) { 2298 if (mlp->flags & ISDN_NET_CONNECTED) {
2298 printk(KERN_DEBUG "master online\n"); 2299 printk(KERN_DEBUG "master online\n");
2299 /* Master is online, find parent-slave (master if first slave) */ 2300 /* Master is online, find parent-slave (master if first slave) */
2300 while (mlp->slave) { 2301 while (mlp->slave) {
2301 if ((isdn_net_local *) mlp->slave->priv == lp) 2302 if (ISDN_SLAVE_PRIV(mlp) == lp)
2302 break; 2303 break;
2303 mlp = (isdn_net_local *) mlp->slave->priv; 2304 mlp = ISDN_SLAVE_PRIV(mlp);
2304 } 2305 }
2305 } else 2306 } else
2306 printk(KERN_DEBUG "master offline\n"); 2307 printk(KERN_DEBUG "master offline\n");
@@ -2512,7 +2513,7 @@ isdn_net_force_dial(char *name)
2512 */ 2513 */
2513static void _isdn_setup(struct net_device *dev) 2514static void _isdn_setup(struct net_device *dev)
2514{ 2515{
2515 isdn_net_local *lp = dev->priv; 2516 isdn_net_local *lp = netdev_priv(dev);
2516 2517
2517 dev->flags = IFF_NOARP | IFF_POINTOPOINT; 2518 dev->flags = IFF_NOARP | IFF_POINTOPOINT;
2518 lp->p_encap = ISDN_NET_ENCAP_RAWIP; 2519 lp->p_encap = ISDN_NET_ENCAP_RAWIP;
@@ -2568,20 +2569,20 @@ isdn_net_new(char *name, struct net_device *master)
2568 kfree(netdev); 2569 kfree(netdev);
2569 return NULL; 2570 return NULL;
2570 } 2571 }
2571 netdev->local = netdev->dev->priv; 2572 netdev->local = netdev_priv(netdev->dev);
2572 netdev->dev->init = isdn_net_init; 2573 netdev->dev->init = isdn_net_init;
2573 if (master) { 2574 if (master) {
2574 /* Device shall be a slave */ 2575 /* Device shall be a slave */
2575 struct net_device *p = (((isdn_net_local *) master->priv)->slave); 2576 struct net_device *p = MASTER_TO_SLAVE(master);
2576 struct net_device *q = master; 2577 struct net_device *q = master;
2577 2578
2578 netdev->local->master = master; 2579 netdev->local->master = master;
2579 /* Put device at end of slave-chain */ 2580 /* Put device at end of slave-chain */
2580 while (p) { 2581 while (p) {
2581 q = p; 2582 q = p;
2582 p = (((isdn_net_local *) p->priv)->slave); 2583 p = MASTER_TO_SLAVE(p);
2583 } 2584 }
2584 ((isdn_net_local *) q->priv)->slave = netdev->dev; 2585 MASTER_TO_SLAVE(q) = netdev->dev;
2585 } else { 2586 } else {
2586 /* Device shall be a master */ 2587 /* Device shall be a master */
2587 /* 2588 /*
@@ -3079,7 +3080,7 @@ isdn_net_force_hangup(char *name)
3079 /* If this interface has slaves, do a hangup for them also. */ 3080 /* If this interface has slaves, do a hangup for them also. */
3080 while (q) { 3081 while (q) {
3081 isdn_net_hangup(q); 3082 isdn_net_hangup(q);
3082 q = (((isdn_net_local *) q->priv)->slave); 3083 q = MASTER_TO_SLAVE(q);
3083 } 3084 }
3084 isdn_net_hangup(p->dev); 3085 isdn_net_hangup(p->dev);
3085 return 0; 3086 return 0;
@@ -3109,8 +3110,10 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
3109 isdn_unexclusive_channel(p->local->pre_device, p->local->pre_channel); 3110 isdn_unexclusive_channel(p->local->pre_device, p->local->pre_channel);
3110 if (p->local->master) { 3111 if (p->local->master) {
3111 /* It's a slave-device, so update master's slave-pointer if necessary */ 3112 /* It's a slave-device, so update master's slave-pointer if necessary */
3112 if (((isdn_net_local *) (p->local->master->priv))->slave == p->dev) 3113 if (((isdn_net_local *) ISDN_MASTER_PRIV(p->local))->slave ==
3113 ((isdn_net_local *) (p->local->master->priv))->slave = p->local->slave; 3114 p->dev)
3115 ((isdn_net_local *)ISDN_MASTER_PRIV(p->local))->slave =
3116 p->local->slave;
3114 } else { 3117 } else {
3115 /* Unregister only if it's a master-device */ 3118 /* Unregister only if it's a master-device */
3116 unregister_netdev(p->dev); 3119 unregister_netdev(p->dev);