netdevice: safe convert to netdev_priv() #part-4
Subsystems (6)
PATCH 4/4 netdevice: safe convert to netdev_priv() #part-4
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.
This patch is a safe convert for netdev->priv to netdev_priv(netdev). Since all of the netdev->priv is only for read.
But it is too big to be sent in one mail.
I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger.
--- drivers/net/wireless/libertas/wext.c | 72 ++++++++++++++-------------- drivers/net/wireless/rndis_wlan.c | 62 ++++++++++++------------ drivers/net/wireless/wavelan.c | 88 ++++++++++++++++----------------- drivers/net/znet.c | 22 ++++---- net/appletalk/ddp.c | 2 +- net/atm/br2684.c | 2 +- net/atm/lec.c | 34 +++++++------ net/atm/mpc.c | 10 ++-- net/bluetooth/bnep/core.c | 2 +- net/bluetooth/bnep/netdev.c | 6 +- net/bridge/br_if.c | 2 +- net/bridge/br_sysfs_br.c | 2 +- net/irda/irlan/irlan_common.c | 2 +- 13 files changed, 153 insertions(+), 153 deletions(-)
drivers/net/wireless/libertas/wext.c +36 -36
@@ -163,7 +163,7 @@ static int lbs_get_name(struct net_device *dev, struct iw_request_info *info,static int lbs_get_freq (struct net_device *dev,struct iw_request_info *info,struct iw_freq *fwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct chan_freq_power *cfp;lbs_deb_enter (LBS_DEB_WEXT );
@@ -189,7 +189,7 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,static int lbs_get_wap (struct net_device *dev,struct iw_request_info *info,struct sockaddr *awrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -207,7 +207,7 @@ static int lbs_get_wap(struct net_device *dev, struct iw_request_info *info,static int lbs_set_nick (struct net_device *dev,struct iw_request_info *info,struct iw_point *dwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -231,7 +231,7 @@ static int lbs_set_nick(struct net_device *dev, struct iw_request_info *info,static int lbs_get_nick (struct net_device *dev,struct iw_request_info *info,struct iw_point *dwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -248,7 +248,7 @@ static int lbs_get_nick(struct net_device *dev, struct iw_request_info *info,static int mesh_get_nick (struct net_device *dev,struct iw_request_info *info,struct iw_point *dwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -273,7 +273,7 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);u32 val = vwrq->value;lbs_deb_enter (LBS_DEB_WEXT );
@@ -293,7 +293,7 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,static int lbs_get_rts (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);int ret =0 ;u16 val =0 ;
@@ -315,7 +315,7 @@ out:static int lbs_set_frag (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);int ret =0 ;u32 val = vwrq->value;
@@ -336,7 +336,7 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,static int lbs_get_frag (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);int ret =0 ;u16 val =0 ;
@@ -359,7 +359,7 @@ out:static int lbs_get_mode (struct net_device *dev,struct iw_request_info *info,u32 * uwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -385,7 +385,7 @@ static int lbs_get_txpow(struct net_device *dev,struct iw_request_info *info, struct iw_param *vwrq, char *extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);s16 curlevel =0 ;int ret =0 ;
@@ -418,7 +418,7 @@ out:static int lbs_set_retry (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);int ret =0 ;u16 slimit =0 , llimit =0 ;
@@ -466,7 +466,7 @@ out:static int lbs_get_retry (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);int ret =0 ;u16 val =0 ;
@@ -542,7 +542,7 @@ static int lbs_get_range(struct net_device *dev, struct iw_request_info *info, struct iw_point *dwrq, char *extra) { int i, j; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct iw_range *range = (struct iw_range *)extra;struct chan_freq_power *cfp;u8 rates[MAX_RATES +1 ];
@@ -708,7 +708,7 @@ out:static int lbs_set_power (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -758,7 +758,7 @@ static int lbs_set_power(struct net_device *dev, struct iw_request_info *info,static int lbs_get_power (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -781,7 +781,7 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)EXCELLENT =95 , PERFECT = 100 }; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);u32 rssi_qual;u32 tx_qual;u32 quality =0 ;
@@ -886,7 +886,7 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { int ret = -EINVAL; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct chan_freq_power *cfp;struct assoc_request * assoc_req;
@@ -943,7 +943,7 @@ static int lbs_mesh_set_freq(struct net_device *dev,struct iw_request_info *info, struct iw_freq *fwrq, char *extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);struct chan_freq_power *cfp;int ret = -EINVAL ;
@@ -994,7 +994,7 @@ out:static int lbs_set_rate (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);u8 new_rate =0 ;int ret = -EINVAL ;u8 rates[MAX_RATES +1 ];
@@ -1054,7 +1054,7 @@ out:static int lbs_get_rate (struct net_device *dev,struct iw_request_info *info,struct iw_param *vwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -1079,7 +1079,7 @@ static int lbs_set_mode(struct net_device *dev, struct iw_request_info *info, u32 * uwrq, char *extra) { int ret = 0; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct assoc_request * assoc_req;lbs_deb_enter (LBS_DEB_WEXT );
@@ -1124,7 +1124,7 @@ static int lbs_get_encode(struct net_device *dev,struct iw_request_info *info, struct iw_point *dwrq, u8 * extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);int index = (dwrq->flags &IW_ENCODE_INDEX ) -1 ;lbs_deb_enter (LBS_DEB_WEXT );
@@ -1319,7 +1319,7 @@ static int lbs_set_encode(struct net_device *dev, struct iw_point *dwrq, char *extra) { int ret = 0; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct assoc_request * assoc_req;u16 is_default =0 , index =0 , set_tx_key =0 ;
@@ -1395,7 +1395,7 @@ static int lbs_get_encodeext(struct net_device *dev, char *extra) {int ret = -EINVAL ; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;int index, max_key_len;
@@ -1501,7 +1501,7 @@ static int lbs_set_encodeext(struct net_device *dev, char *extra) {int ret =0 ; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;int alg = ext->alg;struct assoc_request * assoc_req;
@@ -1639,7 +1639,7 @@ static int lbs_set_genie(struct net_device *dev,struct iw_point *dwrq, char *extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);int ret =0 ;struct assoc_request * assoc_req;
@@ -1685,7 +1685,7 @@ static int lbs_get_genie(struct net_device *dev, char *extra) {int ret =0 ; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -1713,7 +1713,7 @@ static int lbs_set_auth(struct net_device *dev,struct iw_param *dwrq, char *extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);struct assoc_request * assoc_req;int ret =0 ;int updated =0 ;
@@ -1816,7 +1816,7 @@ static int lbs_get_auth(struct net_device *dev, char *extra) {int ret =0 ; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -1857,7 +1857,7 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { int ret = 0; -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);s16 dbm = (s16 ) vwrq->value;lbs_deb_enter (LBS_DEB_WEXT );
@@ -1936,7 +1936,7 @@ out:static int lbs_get_essid (struct net_device *dev,struct iw_request_info *info,struct iw_point *dwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -1971,7 +1971,7 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,static int lbs_set_essid (struct net_device *dev,struct iw_request_info *info,struct iw_point *dwrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);int ret =0 ;u8 ssid[IW_ESSID_MAX_SIZE ];u8 ssid_len =0 ;
@@ -2040,7 +2040,7 @@ static int lbs_mesh_get_essid(struct net_device *dev,struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);lbs_deb_enter (LBS_DEB_WEXT );
@@ -2058,7 +2058,7 @@ static int lbs_mesh_set_essid(struct net_device *dev,struct iw_request_info *info, struct iw_point *dwrq, char *extra) { - struct lbs_private *priv = dev->priv; + struct lbs_private *priv = netdev_priv(dev);int ret =0 ;lbs_deb_enter (LBS_DEB_WEXT );
@@ -2102,7 +2102,7 @@ static int lbs_mesh_set_essid(struct net_device *dev,static int lbs_set_wap (struct net_device *dev,struct iw_request_info *info,struct sockaddr *awrq,char *extra) { -struct lbs_private *priv = dev->priv; +struct lbs_private *priv =netdev_priv (dev);struct assoc_request * assoc_req;int ret =0 ;
drivers/net/wireless/rndis_wlan.c +31 -31
248 lines not on this page · raw message
drivers/net/wireless/wavelan.c +43 -45
346 lines not on this page · raw message
drivers/net/znet.c +11 -11
@@ -167,7 +167,7 @@ static void znet_tx_timeout (struct net_device *dev);/* Request needed resources */ static int znet_request_resources (struct net_device *dev) { -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);unsigned long flags;if (request_irq (dev->irq, &znet_interrupt,0 ,"ZNet" , dev))
@@ -201,7 +201,7 @@ static int znet_request_resources (struct net_device *dev)static void znet_release_resources (struct net_device *dev) { -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);unsigned long flags;release_region (znet->sia_base, znet->sia_size);
@@ -216,7 +216,7 @@ static void znet_release_resources (struct net_device *dev)/* Keep the magical SIA stuff in a single function... */ static void znet_transceiver_power (struct net_device *dev,int on) { -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);unsigned char v;/* Turn on/off the 82501 SIA, using zenith-specific magic. */
@@ -235,7 +235,7 @@ static void znet_transceiver_power (struct net_device *dev, int on)Also used from hardware_init. */ static void znet_set_multicast_list (struct net_device *dev) { -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);short ioaddr = dev->base_addr;struct i82593_conf_block *cfblk = &znet->i593_init;
@@ -386,7 +386,7 @@ static int __init znet_probe (void)if (!dev)return -ENOMEM ; - znet = dev->priv; + znet =netdev_priv (dev); netinfo = (struct netidblk *)p; dev->base_addr = netinfo->iobase1;
@@ -530,7 +530,7 @@ static void znet_tx_timeout (struct net_device *dev)static int znet_send_packet (struct sk_buff *skb,struct net_device *dev) {int ioaddr = dev->base_addr; -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);unsigned long flags;short length = skb->len;
@@ -600,7 +600,7 @@ static int znet_send_packet(struct sk_buff *skb, struct net_device *dev)static irqreturn_t znet_interrupt (int irq,void *dev_id) {struct net_device *dev = dev_id; -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);int ioaddr;int boguscnt =20 ;int handled =0 ;
@@ -678,7 +678,7 @@ static irqreturn_t znet_interrupt(int irq, void *dev_id)static void znet_rx (struct net_device *dev) { -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);int ioaddr = dev->base_addr;int boguscount =1 ;short next_frame_end_offset =0 ;/* Offset of next frame start. */
@@ -827,7 +827,7 @@ static void show_dma(struct net_device *dev) {short ioaddr = dev->base_addr;unsigned char stat =inb (ioaddr); -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev);unsigned long flags;short dma_port = ((znet->tx_dma&3 )<<2 ) +IO_DMA2_BASE ;unsigned addr =inb (dma_port);
@@ -850,7 +850,7 @@ static void hardware_init(struct net_device *dev) {unsigned long flags;short ioaddr = dev->base_addr; -struct znet_private *znet = dev->priv; +struct znet_private *znet =netdev_priv (dev); znet->rx_cur = znet->rx_start; znet->tx_cur = znet->tx_start;
@@ -912,7 +912,7 @@ static void update_stop_hit(short ioaddr, unsigned short rx_stop_offset) static __exit void znet_cleanup (void) {if (znet_dev) { -struct znet_private *znet = znet_dev->priv; +struct znet_private *znet =netdev_priv (znet_dev);unregister_netdev (znet_dev);kfree (znet->rx_start);
net/appletalk/ddp.c +1 -1
@@ -1284,7 +1284,7 @@ static int handle_ip_over_ddp(struct sk_buff *skb) skb->dev = dev;skb_reset_transport_header (skb); - stats = dev->priv; + stats =netdev_priv (dev); stats->rx_packets++; stats->rx_bytes += skb->len +13 ;netif_rx (skb);/* Send the SKB up to a higher place. */
net/atm/br2684.c +1 -1
@@ -101,7 +101,7 @@ static LIST_HEAD(br2684_devs);static inline struct br2684_dev *BRPRIV (const struct net_device *net_dev) { -return (struct br2684_dev *)net_dev->priv; +return (struct br2684_dev *)netdev_priv (net_dev); }static inline struct net_device *list_entry_brdev (const struct list_head *le)
net/atm/lec.c +18 -16
@@ -152,7 +152,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev) buff +=4 ; mesg->content.normal.flag = *buff &0x01 ;/* 0x01 is topology change */ - priv = (struct lec_priv *)dev->priv; + priv =netdev_priv (dev);atm_force_charge (priv->lecd, skb2->truesize); sk =sk_atm (priv->lecd);skb_queue_tail (&sk->sk_receive_queue, skb2);
@@ -218,7 +218,7 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)static int lec_open (struct net_device *dev) { -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);netif_start_queue (dev);memset (&priv->stats,0 ,sizeof (struct net_device_stats ));
@@ -252,7 +252,7 @@ static void lec_tx_timeout(struct net_device *dev)static int lec_start_xmit (struct sk_buff *skb,struct net_device *dev) {struct sk_buff *skb2; -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);struct lecdatahdr_8023 *lec_h;struct atm_vcc *vcc;struct lec_arp_table *entry;
@@ -433,14 +433,14 @@ static int lec_close(struct net_device *dev)*/ static struct net_device_stats *lec_get_stats (struct net_device *dev) { -return &((struct lec_priv *)dev->priv)->stats; +return &((struct lec_priv *)netdev_priv (dev))->stats; }static int lec_atm_send (struct atm_vcc *vcc,struct sk_buff *skb) {unsigned long flags;struct net_device *dev = (struct net_device *)vcc->proto_data; -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);struct atmlec_msg *mesg;struct lec_arp_table *entry;int i;
@@ -580,7 +580,7 @@ static void lec_atm_close(struct atm_vcc *vcc) {struct sk_buff *skb;struct net_device *dev = (struct net_device *)vcc->proto_data; -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev); priv->lecd =NULL ;/* Do something needful? */
@@ -711,7 +711,7 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb) {unsigned long flags;struct net_device *dev = (struct net_device *)vcc->proto_data; -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);#if DUMP_PACKETS >0 int i =0 ;
@@ -858,7 +858,7 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) vpriv->old_pop = vcc->pop; vcc->user_back = vpriv; vcc->pop = lec_pop; -lec_vcc_added (dev_lec[ioc_data.dev_num]->priv, +lec_vcc_added (netdev_priv (dev_lec[ioc_data.dev_num]), &ioc_data, vcc, vcc->push); vcc->proto_data = dev_lec[ioc_data.dev_num]; vcc->push = lec_push;
@@ -870,7 +870,8 @@ static int lec_mcast_attach(struct atm_vcc *vcc, int arg)if (arg <0 || arg >=MAX_LEC_ITF || !dev_lec[arg])return -EINVAL ; vcc->proto_data = dev_lec[arg]; -return (lec_mcast_make ((struct lec_priv *)dev_lec[arg]->priv, vcc)); +return lec_mcast_make ((struct lec_priv *)netdev_priv (dev_lec[arg]), + vcc); }/* Initialize device. */
@@ -912,11 +913,11 @@ static int lecd_attach(struct atm_vcc *vcc, int arg)return -EINVAL ; } - priv = dev_lec[i]->priv; + priv =netdev_priv (dev_lec[i]); priv->is_trdev = is_trdev;lec_init (dev_lec[i]); }else { - priv = dev_lec[i]->priv; + priv =netdev_priv (dev_lec[i]);if (priv->lecd)return -EADDRINUSE ; }
@@ -1077,7 +1078,8 @@ static void *lec_itf_walk(struct lec_state *state, loff_t *l)void *v; dev = state->dev ? state->dev : dev_lec[state->itf]; - v = (dev && dev->priv) ?lec_priv_walk (state, l, dev->priv) :NULL ; + v = (dev &&netdev_priv (dev)) ? +lec_priv_walk (state, l,netdev_priv (dev)) :NULL ;if (!v && dev) {dev_put (dev);/* Partial state reset for the next time we get called */
@@ -1239,7 +1241,7 @@ static void __exit lane_module_cleanup(void)for (i =0 ; i <MAX_LEC_ITF ; i++) {if (dev_lec[i] !=NULL ) { - priv = (struct lec_priv *)dev_lec[i]->priv; + priv =netdev_priv (dev_lec[i]);unregister_netdev (dev_lec[i]);free_netdev (dev_lec[i]); dev_lec[i] =NULL ;
@@ -1263,7 +1265,7 @@ static int lane2_resolve(struct net_device *dev, const u8 *dst_mac, int force, u8 **tlvs, u32 *sizeoftlvs) {unsigned long flags; -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);struct lec_arp_table *table;struct sk_buff *skb;int retval;
@@ -1310,7 +1312,7 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, {int retval;struct sk_buff *skb; -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);if (compare_ether_addr (lan_dst, dev->dev_addr))return (0 );/* not our mac address */
@@ -1347,7 +1349,7 @@ static void lane2_associate_ind(struct net_device *dev, const u8 *mac_addr,#if 0 int i =0 ;#endif -struct lec_priv *priv = (struct lec_priv *)dev->priv; +struct lec_priv *priv =netdev_priv (dev);#if 0 /* * Why have the TLVs in LE_ARP entries * since we do not use them? When you
net/atm/mpc.c +5 -5
@@ -785,7 +785,7 @@ static int atm_mpoa_mpoad_attach (struct atm_vcc *vcc, int arg) }if (mpc->dev) {/* check if the lec is LANE2 capable */ - priv = (struct lec_priv *)mpc->dev->priv; + priv =netdev_priv (mpc->dev);if (priv->lane_version <2 ) {dev_put (mpc->dev); mpc->dev =NULL ;
@@ -845,7 +845,7 @@ static void mpoad_close(struct atm_vcc *vcc) mpc->mpoad_vcc =NULL ;if (mpc->dev) { -struct lec_priv *priv = (struct lec_priv *)mpc->dev->priv; +struct lec_priv *priv =netdev_priv (mpc->dev); priv->lane2_ops->associate_indicator =NULL ;stop_mpc (mpc);dev_put (mpc->dev);
@@ -976,7 +976,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned loswitch (event) {case NETDEV_REGISTER :/* a new lec device was allocated */ - priv = (struct lec_priv *)dev->priv; + priv =netdev_priv (dev);if (priv->lane_version <2 )break ; priv->lane2_ops->associate_indicator = lane2_assoc_ind;
@@ -1324,7 +1324,7 @@ static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg, struct mpoa_client *mdprintk ("\n" );if (mpc->dev) { - priv = (struct lec_priv *)mpc->dev->priv; + priv =netdev_priv (mpc->dev); retval = priv->lane2_ops->associate_req (mpc->dev, mpc->dev->dev_addr, tlv,sizeof (tlv));if (retval ==0 )printk ("mpoa: (%s) MPOA device type TLV association failed\n" , mpc->dev->name);
@@ -1474,7 +1474,7 @@ static void __exit atm_mpoa_cleanup(void) tmp = mpc->next;if (mpc->dev !=NULL ) {stop_mpc (mpc); - priv = (struct lec_priv *)mpc->dev->priv; + priv =netdev_priv (mpc->dev);if (priv->lane2_ops !=NULL ) priv->lane2_ops->associate_indicator =NULL ; }
net/bluetooth/bnep/core.c +1 -1
@@ -565,7 +565,7 @@ int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock) goto failed; } - s = dev->priv; + s =netdev_priv (dev);/* This is rx header therefore addresses are swapped. * ie eh.h_dest is our local address. */
net/bluetooth/bnep/netdev.c +3 -3
@@ -62,14 +62,14 @@ static int bnep_net_close(struct net_device *dev)static struct net_device_stats *bnep_net_get_stats (struct net_device *dev) { -struct bnep_session *s = dev->priv; +struct bnep_session *s =netdev_priv (dev);return &s->stats; }static void bnep_net_set_mc_list (struct net_device *dev) {#ifdef CONFIG_BT_BNEP_MC_FILTER -struct bnep_session *s = dev->priv; +struct bnep_session *s =netdev_priv (dev);struct sock *sk = s->sock->sk;struct bnep_set_filter_req *r;struct sk_buff *skb;
@@ -183,7 +183,7 @@ static inline int bnep_net_proto_filter(struct sk_buff *skb, struct bnep_sessionstatic int bnep_net_xmit (struct sk_buff *skb,struct net_device *dev) { -struct bnep_session *s = dev->priv; +struct bnep_session *s =netdev_priv (dev);struct sock *sk = s->sock->sk;BT_DBG ("skb %p, dev %p" , skb, dev);
net/bridge/br_if.c +1 -1
@@ -460,7 +460,7 @@ void br_net_exit(struct net *net) restart:for_each_netdev (net, dev) {if (dev->priv_flags &IFF_EBRIDGE ) { -del_br (dev->priv); +del_br (netdev_priv (dev)); goto restart; } }
net/bridge/br_sysfs_br.c +1 -1
@@ -22,7 +22,7 @@#include "br_private.h" #define to_dev (obj) container_of(obj, struct device, kobj) -#define to_bridge (cd) ((struct net_bridge *)(to_net_dev(cd)->priv)) +#define to_bridge (cd) ((struct net_bridge *)netdev_priv(to_net_dev(cd)))/* * Common code for storing bridge parameters.
net/irda/irlan/irlan_common.c +1 -1
@@ -207,7 +207,7 @@ static struct irlan_cb *irlan_open(__u32 saddr, __u32 daddr)if (!dev)return NULL ; - self = dev->priv; + self =netdev_priv (dev); self->dev = dev;/*
Signature · 1 line
1.5.3.4
From: Wang Chen <[email protected]>
Date: Thu, 13 Nov 2008 10:43:53 +0800
Quoted 7 lines
We have some reasons to kill
netdev->priv:
1.netdev->privis equal tonetdev_priv().
2.netdev_priv()wraps the calculation of netdev->priv's offset, obviouslynetdev_priv()is more flexible thannetdev->priv.
But we cann't killnetdev->priv, because so many drivers reference to it directly.
Quoted 7 lines
This patch is a safe convert for
netdev->privtonetdev_priv(netdev). Since all of thenetdev->privis only for read.
But it is too big to be sent in one mail.
I split it to 4 parts and make every part smaller than 100,000 bytes, which is max size allowed by vger.Signed-off-by Wang Chen <[email protected]>
Applied.