@@ -130,8 +130,8 @@ struct ipip_net {
130
130
struct net_device * fb_tunnel_dev ;
131
131
};
132
132
133
- static int ipip_fb_tunnel_init (struct net_device * dev );
134
- static int ipip_tunnel_init (struct net_device * dev );
133
+ static void ipip_fb_tunnel_init (struct net_device * dev );
134
+ static void ipip_tunnel_init (struct net_device * dev );
135
135
static void ipip_tunnel_setup (struct net_device * dev );
136
136
137
137
static DEFINE_RWLOCK (ipip_lock );
@@ -245,9 +245,10 @@ static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
245
245
}
246
246
247
247
nt = netdev_priv (dev );
248
- dev -> init = ipip_tunnel_init ;
249
248
nt -> parms = * parms ;
250
249
250
+ ipip_tunnel_init (dev );
251
+
251
252
if (register_netdevice (dev ) < 0 )
252
253
goto failed_free ;
253
254
@@ -691,12 +692,17 @@ static int ipip_tunnel_change_mtu(struct net_device *dev, int new_mtu)
691
692
return 0 ;
692
693
}
693
694
695
+ static const struct net_device_ops ipip_netdev_ops = {
696
+ .ndo_uninit = ipip_tunnel_uninit ,
697
+ .ndo_start_xmit = ipip_tunnel_xmit ,
698
+ .ndo_do_ioctl = ipip_tunnel_ioctl ,
699
+ .ndo_change_mtu = ipip_tunnel_change_mtu ,
700
+
701
+ };
702
+
694
703
static void ipip_tunnel_setup (struct net_device * dev )
695
704
{
696
- dev -> uninit = ipip_tunnel_uninit ;
697
- dev -> hard_start_xmit = ipip_tunnel_xmit ;
698
- dev -> do_ioctl = ipip_tunnel_ioctl ;
699
- dev -> change_mtu = ipip_tunnel_change_mtu ;
705
+ dev -> netdev_ops = & ipip_netdev_ops ;
700
706
dev -> destructor = free_netdev ;
701
707
702
708
dev -> type = ARPHRD_TUNNEL ;
@@ -708,11 +714,9 @@ static void ipip_tunnel_setup(struct net_device *dev)
708
714
dev -> features |= NETIF_F_NETNS_LOCAL ;
709
715
}
710
716
711
- static int ipip_tunnel_init (struct net_device * dev )
717
+ static void ipip_tunnel_init (struct net_device * dev )
712
718
{
713
- struct ip_tunnel * tunnel ;
714
-
715
- tunnel = netdev_priv (dev );
719
+ struct ip_tunnel * tunnel = netdev_priv (dev );
716
720
717
721
tunnel -> dev = dev ;
718
722
strcpy (tunnel -> parms .name , dev -> name );
@@ -721,11 +725,9 @@ static int ipip_tunnel_init(struct net_device *dev)
721
725
memcpy (dev -> broadcast , & tunnel -> parms .iph .daddr , 4 );
722
726
723
727
ipip_tunnel_bind_dev (dev );
724
-
725
- return 0 ;
726
728
}
727
729
728
- static int ipip_fb_tunnel_init (struct net_device * dev )
730
+ static void ipip_fb_tunnel_init (struct net_device * dev )
729
731
{
730
732
struct ip_tunnel * tunnel = netdev_priv (dev );
731
733
struct iphdr * iph = & tunnel -> parms .iph ;
@@ -740,7 +742,6 @@ static int ipip_fb_tunnel_init(struct net_device *dev)
740
742
741
743
dev_hold (dev );
742
744
ipn -> tunnels_wc [0 ] = tunnel ;
743
- return 0 ;
744
745
}
745
746
746
747
static struct xfrm_tunnel ipip_handler = {
@@ -793,7 +794,7 @@ static int ipip_init_net(struct net *net)
793
794
goto err_alloc_dev ;
794
795
}
795
796
796
- ipn -> fb_tunnel_dev -> init = ipip_fb_tunnel_init ;
797
+ ipip_fb_tunnel_init ( ipn -> fb_tunnel_dev ) ;
797
798
dev_net_set (ipn -> fb_tunnel_dev , net );
798
799
799
800
if ((err = register_netdev (ipn -> fb_tunnel_dev )))
0 commit comments