diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-05-27 21:30:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-28 16:11:01 -0400 |
commit | 351638e7deeed2ec8ce451b53d33921b3da68f83 (patch) | |
tree | 175dfff289b5e3baecffbc7e97d1884e9a18345c | |
parent | b1098bbe1b24d5d90cff92fbd716d2ef4bed2cff (diff) |
net: pass info struct via netdevice notifier
So far, only net_device * could be passed along with netdevice notifier
event. This patch provides a possibility to pass custom structure
able to provide info that event listener needs to know.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
v2->v3: fix typo on simeth
shortened dev_getter
shortened notifier_info struct name
v1->v2: fix notifier_call parameter in call_netdevice_notifier()
Signed-off-by: David S. Miller <davem@davemloft.net>
80 files changed, 172 insertions, 127 deletions
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index c13064e422df..d1b04c4c95e3 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c | |||
@@ -268,7 +268,7 @@ static __inline__ int dev_is_ethdev(struct net_device *dev) | |||
268 | static int | 268 | static int |
269 | simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) | 269 | simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) |
270 | { | 270 | { |
271 | struct net_device *dev = ptr; | 271 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
272 | struct simeth_local *local; | 272 | struct simeth_local *local; |
273 | struct in_device *in_dev; | 273 | struct in_device *in_dev; |
274 | struct in_ifaddr **ifap = NULL; | 274 | struct in_ifaddr **ifap = NULL; |
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c index 729a50991780..b7eccbd17bf7 100644 --- a/arch/mips/txx9/generic/setup_tx4939.c +++ b/arch/mips/txx9/generic/setup_tx4939.c | |||
@@ -331,7 +331,8 @@ static int tx4939_netdev_event(struct notifier_block *this, | |||
331 | unsigned long event, | 331 | unsigned long event, |
332 | void *ptr) | 332 | void *ptr) |
333 | { | 333 | { |
334 | struct net_device *dev = ptr; | 334 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
335 | |||
335 | if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) { | 336 | if (event == NETDEV_CHANGE && netif_carrier_ok(dev)) { |
336 | __u64 bit = 0; | 337 | __u64 bit = 0; |
337 | if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0)) | 338 | if (dev->irq == TXX9_IRQ_BASE + TX4939_IR_ETH(0)) |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 71c2c7116802..34fbc2f60a09 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -3269,9 +3269,9 @@ static int cma_netdev_change(struct net_device *ndev, struct rdma_id_private *id | |||
3269 | } | 3269 | } |
3270 | 3270 | ||
3271 | static int cma_netdev_callback(struct notifier_block *self, unsigned long event, | 3271 | static int cma_netdev_callback(struct notifier_block *self, unsigned long event, |
3272 | void *ctx) | 3272 | void *ptr) |
3273 | { | 3273 | { |
3274 | struct net_device *ndev = (struct net_device *)ctx; | 3274 | struct net_device *ndev = netdev_notifier_info_to_dev(ptr); |
3275 | struct cma_device *cma_dev; | 3275 | struct cma_device *cma_dev; |
3276 | struct rdma_id_private *id_priv; | 3276 | struct rdma_id_private *id_priv; |
3277 | int ret = NOTIFY_DONE; | 3277 | int ret = NOTIFY_DONE; |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 23d734349d8e..a188d3178559 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1161,7 +1161,7 @@ static void netdev_removed(struct mlx4_ib_dev *dev, int port) | |||
1161 | static int mlx4_ib_netdev_event(struct notifier_block *this, unsigned long event, | 1161 | static int mlx4_ib_netdev_event(struct notifier_block *this, unsigned long event, |
1162 | void *ptr) | 1162 | void *ptr) |
1163 | { | 1163 | { |
1164 | struct net_device *dev = ptr; | 1164 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1165 | struct mlx4_ib_dev *ibdev; | 1165 | struct mlx4_ib_dev *ibdev; |
1166 | struct net_device *oldnd; | 1166 | struct net_device *oldnd; |
1167 | struct mlx4_ib_iboe *iboe; | 1167 | struct mlx4_ib_iboe *iboe; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 29b846cbfb48..f4489d65bf33 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3277,7 +3277,7 @@ static int bond_slave_netdev_event(unsigned long event, | |||
3277 | static int bond_netdev_event(struct notifier_block *this, | 3277 | static int bond_netdev_event(struct notifier_block *this, |
3278 | unsigned long event, void *ptr) | 3278 | unsigned long event, void *ptr) |
3279 | { | 3279 | { |
3280 | struct net_device *event_dev = (struct net_device *)ptr; | 3280 | struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); |
3281 | 3281 | ||
3282 | pr_debug("event_dev: %s, event: %lx\n", | 3282 | pr_debug("event_dev: %s, event: %lx\n", |
3283 | event_dev ? event_dev->name : "None", | 3283 | event_dev ? event_dev->name : "None", |
diff --git a/drivers/net/can/led.c b/drivers/net/can/led.c index f27fca65dc4a..a3d99a8fd2d1 100644 --- a/drivers/net/can/led.c +++ b/drivers/net/can/led.c | |||
@@ -88,9 +88,9 @@ EXPORT_SYMBOL_GPL(devm_can_led_init); | |||
88 | 88 | ||
89 | /* NETDEV rename notifier to rename the associated led triggers too */ | 89 | /* NETDEV rename notifier to rename the associated led triggers too */ |
90 | static int can_led_notifier(struct notifier_block *nb, unsigned long msg, | 90 | static int can_led_notifier(struct notifier_block *nb, unsigned long msg, |
91 | void *data) | 91 | void *ptr) |
92 | { | 92 | { |
93 | struct net_device *netdev = data; | 93 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
94 | struct can_priv *priv = safe_candev_priv(netdev); | 94 | struct can_priv *priv = safe_candev_priv(netdev); |
95 | char name[CAN_LED_NAME_SZ]; | 95 | char name[CAN_LED_NAME_SZ]; |
96 | 96 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 6b0dc131b20e..d78d4cf140ed 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -5622,7 +5622,7 @@ static void cnic_rcv_netevent(struct cnic_local *cp, unsigned long event, | |||
5622 | static int cnic_netdev_event(struct notifier_block *this, unsigned long event, | 5622 | static int cnic_netdev_event(struct notifier_block *this, unsigned long event, |
5623 | void *ptr) | 5623 | void *ptr) |
5624 | { | 5624 | { |
5625 | struct net_device *netdev = ptr; | 5625 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
5626 | struct cnic_dev *dev; | 5626 | struct cnic_dev *dev; |
5627 | int new_dev = 0; | 5627 | int new_dev = 0; |
5628 | 5628 | ||
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index 171f4b3dda07..c896079728e1 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
@@ -3706,7 +3706,7 @@ static const struct file_operations skge_debug_fops = { | |||
3706 | static int skge_device_event(struct notifier_block *unused, | 3706 | static int skge_device_event(struct notifier_block *unused, |
3707 | unsigned long event, void *ptr) | 3707 | unsigned long event, void *ptr) |
3708 | { | 3708 | { |
3709 | struct net_device *dev = ptr; | 3709 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
3710 | struct skge_port *skge; | 3710 | struct skge_port *skge; |
3711 | struct dentry *d; | 3711 | struct dentry *d; |
3712 | 3712 | ||
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index d175bbd3ffd3..e09a8c6f8536 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -4642,7 +4642,7 @@ static const struct file_operations sky2_debug_fops = { | |||
4642 | static int sky2_device_event(struct notifier_block *unused, | 4642 | static int sky2_device_event(struct notifier_block *unused, |
4643 | unsigned long event, void *ptr) | 4643 | unsigned long event, void *ptr) |
4644 | { | 4644 | { |
4645 | struct net_device *dev = ptr; | 4645 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
4646 | struct sky2_port *sky2 = netdev_priv(dev); | 4646 | struct sky2_port *sky2 = netdev_priv(dev); |
4647 | 4647 | ||
4648 | if (dev->netdev_ops->ndo_open != sky2_open || !sky2_debug) | 4648 | if (dev->netdev_ops->ndo_open != sky2_open || !sky2_debug) |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index af951f343ff6..51e13d92761e 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -3311,7 +3311,7 @@ static int netxen_netdev_event(struct notifier_block *this, | |||
3311 | unsigned long event, void *ptr) | 3311 | unsigned long event, void *ptr) |
3312 | { | 3312 | { |
3313 | struct netxen_adapter *adapter; | 3313 | struct netxen_adapter *adapter; |
3314 | struct net_device *dev = (struct net_device *)ptr; | 3314 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
3315 | struct net_device *orig_dev = dev; | 3315 | struct net_device *orig_dev = dev; |
3316 | struct net_device *slave; | 3316 | struct net_device *slave; |
3317 | 3317 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index da82f2eb73b4..6bb56d43614b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -3530,7 +3530,7 @@ static int qlcnic_netdev_event(struct notifier_block *this, | |||
3530 | unsigned long event, void *ptr) | 3530 | unsigned long event, void *ptr) |
3531 | { | 3531 | { |
3532 | struct qlcnic_adapter *adapter; | 3532 | struct qlcnic_adapter *adapter; |
3533 | struct net_device *dev = (struct net_device *)ptr; | 3533 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
3534 | 3534 | ||
3535 | recheck: | 3535 | recheck: |
3536 | if (dev == NULL) | 3536 | if (dev == NULL) |
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c index 39e4cb39de29..46cc11d5e205 100644 --- a/drivers/net/ethernet/sfc/efx.c +++ b/drivers/net/ethernet/sfc/efx.c | |||
@@ -2120,7 +2120,7 @@ static void efx_update_name(struct efx_nic *efx) | |||
2120 | static int efx_netdev_event(struct notifier_block *this, | 2120 | static int efx_netdev_event(struct notifier_block *this, |
2121 | unsigned long event, void *ptr) | 2121 | unsigned long event, void *ptr) |
2122 | { | 2122 | { |
2123 | struct net_device *net_dev = ptr; | 2123 | struct net_device *net_dev = netdev_notifier_info_to_dev(ptr); |
2124 | 2124 | ||
2125 | if (net_dev->netdev_ops == &efx_netdev_ops && | 2125 | if (net_dev->netdev_ops == &efx_netdev_ops && |
2126 | event == NETDEV_CHANGENAME) | 2126 | event == NETDEV_CHANGENAME) |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 02de6c891670..f91bf0ddf031 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -103,7 +103,7 @@ static struct packet_type bpq_packet_type __read_mostly = { | |||
103 | }; | 103 | }; |
104 | 104 | ||
105 | static struct notifier_block bpq_dev_notifier = { | 105 | static struct notifier_block bpq_dev_notifier = { |
106 | .notifier_call =bpq_device_event, | 106 | .notifier_call = bpq_device_event, |
107 | }; | 107 | }; |
108 | 108 | ||
109 | 109 | ||
@@ -544,9 +544,10 @@ static void bpq_free_device(struct net_device *ndev) | |||
544 | /* | 544 | /* |
545 | * Handle device status changes. | 545 | * Handle device status changes. |
546 | */ | 546 | */ |
547 | static int bpq_device_event(struct notifier_block *this,unsigned long event, void *ptr) | 547 | static int bpq_device_event(struct notifier_block *this, |
548 | unsigned long event, void *ptr) | ||
548 | { | 549 | { |
549 | struct net_device *dev = (struct net_device *)ptr; | 550 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
550 | 551 | ||
551 | if (!net_eq(dev_net(dev), &init_net)) | 552 | if (!net_eq(dev_net(dev), &init_net)) |
552 | return NOTIFY_DONE; | 553 | return NOTIFY_DONE; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 1c502bb0c916..edfddc5f61b4 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -921,7 +921,7 @@ static struct rtnl_link_ops macvlan_link_ops = { | |||
921 | static int macvlan_device_event(struct notifier_block *unused, | 921 | static int macvlan_device_event(struct notifier_block *unused, |
922 | unsigned long event, void *ptr) | 922 | unsigned long event, void *ptr) |
923 | { | 923 | { |
924 | struct net_device *dev = ptr; | 924 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
925 | struct macvlan_dev *vlan, *next; | 925 | struct macvlan_dev *vlan, *next; |
926 | struct macvlan_port *port; | 926 | struct macvlan_port *port; |
927 | LIST_HEAD(list_kill); | 927 | LIST_HEAD(list_kill); |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 59e9605de316..68efb91a5633 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -1053,7 +1053,7 @@ EXPORT_SYMBOL_GPL(macvtap_get_socket); | |||
1053 | static int macvtap_device_event(struct notifier_block *unused, | 1053 | static int macvtap_device_event(struct notifier_block *unused, |
1054 | unsigned long event, void *ptr) | 1054 | unsigned long event, void *ptr) |
1055 | { | 1055 | { |
1056 | struct net_device *dev = ptr; | 1056 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1057 | struct macvlan_dev *vlan; | 1057 | struct macvlan_dev *vlan; |
1058 | struct device *classdev; | 1058 | struct device *classdev; |
1059 | dev_t devt; | 1059 | dev_t devt; |
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 59ac143dec25..1d1d0a12765c 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -653,12 +653,11 @@ static struct configfs_subsystem netconsole_subsys = { | |||
653 | 653 | ||
654 | /* Handle network interface device notifications */ | 654 | /* Handle network interface device notifications */ |
655 | static int netconsole_netdev_event(struct notifier_block *this, | 655 | static int netconsole_netdev_event(struct notifier_block *this, |
656 | unsigned long event, | 656 | unsigned long event, void *ptr) |
657 | void *ptr) | ||
658 | { | 657 | { |
659 | unsigned long flags; | 658 | unsigned long flags; |
660 | struct netconsole_target *nt; | 659 | struct netconsole_target *nt; |
661 | struct net_device *dev = ptr; | 660 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
662 | bool stopped = false; | 661 | bool stopped = false; |
663 | 662 | ||
664 | if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER || | 663 | if (!(event == NETDEV_CHANGENAME || event == NETDEV_UNREGISTER || |
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index bb07ba94c3aa..5f66e30d9823 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
@@ -338,7 +338,7 @@ static void pppoe_flush_dev(struct net_device *dev) | |||
338 | static int pppoe_device_event(struct notifier_block *this, | 338 | static int pppoe_device_event(struct notifier_block *this, |
339 | unsigned long event, void *ptr) | 339 | unsigned long event, void *ptr) |
340 | { | 340 | { |
341 | struct net_device *dev = (struct net_device *)ptr; | 341 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
342 | 342 | ||
343 | /* Only look at sockets that are using this specific device. */ | 343 | /* Only look at sockets that are using this specific device. */ |
344 | switch (event) { | 344 | switch (event) { |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 7c43261975bd..9273f48a512b 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -2647,7 +2647,7 @@ static void team_port_change_check(struct team_port *port, bool linkup) | |||
2647 | static int team_device_event(struct notifier_block *unused, | 2647 | static int team_device_event(struct notifier_block *unused, |
2648 | unsigned long event, void *ptr) | 2648 | unsigned long event, void *ptr) |
2649 | { | 2649 | { |
2650 | struct net_device *dev = (struct net_device *) ptr; | 2650 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2651 | struct team_port *port; | 2651 | struct team_port *port; |
2652 | 2652 | ||
2653 | port = team_port_get_rtnl(dev); | 2653 | port = team_port_get_rtnl(dev); |
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 147614ed86aa..70ac59929f80 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -477,7 +477,7 @@ static void dlci_setup(struct net_device *dev) | |||
477 | static int dlci_dev_event(struct notifier_block *unused, | 477 | static int dlci_dev_event(struct notifier_block *unused, |
478 | unsigned long event, void *ptr) | 478 | unsigned long event, void *ptr) |
479 | { | 479 | { |
480 | struct net_device *dev = (struct net_device *) ptr; | 480 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
481 | 481 | ||
482 | if (dev_net(dev) != &init_net) | 482 | if (dev_net(dev) != &init_net) |
483 | return NOTIFY_DONE; | 483 | return NOTIFY_DONE; |
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index a0a932c63d0a..9c33ca918e19 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -99,7 +99,7 @@ static inline void hdlc_proto_stop(struct net_device *dev) | |||
99 | static int hdlc_device_event(struct notifier_block *this, unsigned long event, | 99 | static int hdlc_device_event(struct notifier_block *this, unsigned long event, |
100 | void *ptr) | 100 | void *ptr) |
101 | { | 101 | { |
102 | struct net_device *dev = ptr; | 102 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
103 | hdlc_device *hdlc; | 103 | hdlc_device *hdlc; |
104 | unsigned long flags; | 104 | unsigned long flags; |
105 | int on; | 105 | int on; |
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index a73b49eb87e3..a33a46fa88dd 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c | |||
@@ -370,7 +370,7 @@ static int lapbeth_device_event(struct notifier_block *this, | |||
370 | unsigned long event, void *ptr) | 370 | unsigned long event, void *ptr) |
371 | { | 371 | { |
372 | struct lapbethdev *lapbeth; | 372 | struct lapbethdev *lapbeth; |
373 | struct net_device *dev = ptr; | 373 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
374 | 374 | ||
375 | if (dev_net(dev) != &init_net) | 375 | if (dev_net(dev) != &init_net) |
376 | return NOTIFY_DONE; | 376 | return NOTIFY_DONE; |
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 292b24f9bf93..ee721b6cbcdf 100644 --- a/drivers/scsi/fcoe/fcoe.c +++ b/drivers/scsi/fcoe/fcoe.c | |||
@@ -1975,7 +1975,7 @@ static int fcoe_device_notification(struct notifier_block *notifier, | |||
1975 | { | 1975 | { |
1976 | struct fcoe_ctlr_device *cdev; | 1976 | struct fcoe_ctlr_device *cdev; |
1977 | struct fc_lport *lport = NULL; | 1977 | struct fc_lport *lport = NULL; |
1978 | struct net_device *netdev = ptr; | 1978 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
1979 | struct fcoe_ctlr *ctlr; | 1979 | struct fcoe_ctlr *ctlr; |
1980 | struct fcoe_interface *fcoe; | 1980 | struct fcoe_interface *fcoe; |
1981 | struct fcoe_port *port; | 1981 | struct fcoe_port *port; |
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c index f3a5a53e8631..01adbe0ec53b 100644 --- a/drivers/scsi/fcoe/fcoe_transport.c +++ b/drivers/scsi/fcoe/fcoe_transport.c | |||
@@ -704,7 +704,7 @@ static struct net_device *fcoe_if_to_netdev(const char *buffer) | |||
704 | static int libfcoe_device_notification(struct notifier_block *notifier, | 704 | static int libfcoe_device_notification(struct notifier_block *notifier, |
705 | ulong event, void *ptr) | 705 | ulong event, void *ptr) |
706 | { | 706 | { |
707 | struct net_device *netdev = ptr; | 707 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
708 | 708 | ||
709 | switch (event) { | 709 | switch (event) { |
710 | case NETDEV_UNREGISTER: | 710 | case NETDEV_UNREGISTER: |
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c index a0177d998978..d49cdf84a496 100644 --- a/drivers/staging/csr/netdev.c +++ b/drivers/staging/csr/netdev.c | |||
@@ -2891,7 +2891,7 @@ void uf_net_get_name(struct net_device *dev, char *name, int len) | |||
2891 | */ | 2891 | */ |
2892 | static int | 2892 | static int |
2893 | uf_netdev_event(struct notifier_block *notif, unsigned long event, void* ptr) { | 2893 | uf_netdev_event(struct notifier_block *notif, unsigned long event, void* ptr) { |
2894 | struct net_device *netdev = ptr; | 2894 | struct net_device *netdev = netdev_notifier_info_to_dev(ptr); |
2895 | netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(netdev); | 2895 | netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(netdev); |
2896 | unifi_priv_t *priv = NULL; | 2896 | unifi_priv_t *priv = NULL; |
2897 | static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; | 2897 | static const CsrWifiMacAddress broadcast_address = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; |
diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index 94e426e4d98b..b2330f1df7e7 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c | |||
@@ -164,7 +164,7 @@ static const struct file_operations ft1000_proc_fops = { | |||
164 | static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, | 164 | static int ft1000NotifyProc(struct notifier_block *this, unsigned long event, |
165 | void *ptr) | 165 | void *ptr) |
166 | { | 166 | { |
167 | struct net_device *dev = ptr; | 167 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
168 | struct ft1000_info *info; | 168 | struct ft1000_info *info; |
169 | 169 | ||
170 | info = netdev_priv(dev); | 170 | info = netdev_priv(dev); |
diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c index eca6f0292b4b..5ead942be680 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_proc.c | |||
@@ -166,7 +166,7 @@ static const struct file_operations ft1000_proc_fops = { | |||
166 | static int | 166 | static int |
167 | ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) | 167 | ft1000NotifyProc(struct notifier_block *this, unsigned long event, void *ptr) |
168 | { | 168 | { |
169 | struct net_device *dev = ptr; | 169 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
170 | struct ft1000_info *info; | 170 | struct ft1000_info *info; |
171 | struct proc_dir_entry *ft1000_proc_file; | 171 | struct proc_dir_entry *ft1000_proc_file; |
172 | 172 | ||
diff --git a/drivers/staging/silicom/bpctl_mod.c b/drivers/staging/silicom/bpctl_mod.c index b7e570ccb759..c8ddb99e8526 100644 --- a/drivers/staging/silicom/bpctl_mod.c +++ b/drivers/staging/silicom/bpctl_mod.c | |||
@@ -133,7 +133,7 @@ static unsigned long str_to_hex(char *p); | |||
133 | static int bp_device_event(struct notifier_block *unused, | 133 | static int bp_device_event(struct notifier_block *unused, |
134 | unsigned long event, void *ptr) | 134 | unsigned long event, void *ptr) |
135 | { | 135 | { |
136 | struct net_device *dev = ptr; | 136 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
137 | static bpctl_dev_t *pbpctl_dev = NULL, *pbpctl_dev_m = NULL; | 137 | static bpctl_dev_t *pbpctl_dev = NULL, *pbpctl_dev_m = NULL; |
138 | int dev_num = 0, ret = 0, ret_d = 0, time_left = 0; | 138 | int dev_num = 0, ret = 0, ret_d = 0, time_left = 0; |
139 | /* printk("BP_PROC_SUPPORT event =%d %s %d\n", event,dev->name, dev->ifindex ); */ | 139 | /* printk("BP_PROC_SUPPORT event =%d %s %d\n", event,dev->name, dev->ifindex ); */ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6b2bb460d1d7..13a34848b5e1 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1599,6 +1599,19 @@ struct packet_offload { | |||
1599 | 1599 | ||
1600 | extern int register_netdevice_notifier(struct notifier_block *nb); | 1600 | extern int register_netdevice_notifier(struct notifier_block *nb); |
1601 | extern int unregister_netdevice_notifier(struct notifier_block *nb); | 1601 | extern int unregister_netdevice_notifier(struct notifier_block *nb); |
1602 | |||
1603 | struct netdev_notifier_info { | ||
1604 | struct net_device *dev; | ||
1605 | }; | ||
1606 | |||
1607 | static inline struct net_device * | ||
1608 | netdev_notifier_info_to_dev(const struct netdev_notifier_info *info) | ||
1609 | { | ||
1610 | return info->dev; | ||
1611 | } | ||
1612 | |||
1613 | extern int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, | ||
1614 | struct netdev_notifier_info *info); | ||
1602 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); | 1615 | extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev); |
1603 | 1616 | ||
1604 | 1617 | ||
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 9424f3718ea7..2fb2d88e8c2e 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -341,7 +341,7 @@ static void __vlan_device_event(struct net_device *dev, unsigned long event) | |||
341 | static int vlan_device_event(struct notifier_block *unused, unsigned long event, | 341 | static int vlan_device_event(struct notifier_block *unused, unsigned long event, |
342 | void *ptr) | 342 | void *ptr) |
343 | { | 343 | { |
344 | struct net_device *dev = ptr; | 344 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
345 | struct vlan_group *grp; | 345 | struct vlan_group *grp; |
346 | struct vlan_info *vlan_info; | 346 | struct vlan_info *vlan_info; |
347 | int i, flgs; | 347 | int i, flgs; |
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 173a2e82f486..690356fa52b9 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c | |||
@@ -332,7 +332,7 @@ static void aarp_expire_timeout(unsigned long unused) | |||
332 | static int aarp_device_event(struct notifier_block *this, unsigned long event, | 332 | static int aarp_device_event(struct notifier_block *this, unsigned long event, |
333 | void *ptr) | 333 | void *ptr) |
334 | { | 334 | { |
335 | struct net_device *dev = ptr; | 335 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
336 | int ct; | 336 | int ct; |
337 | 337 | ||
338 | if (!net_eq(dev_net(dev), &init_net)) | 338 | if (!net_eq(dev_net(dev), &init_net)) |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index ef12839a7cfe..7fee50d637f9 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -644,7 +644,7 @@ static inline void atalk_dev_down(struct net_device *dev) | |||
644 | static int ddp_device_event(struct notifier_block *this, unsigned long event, | 644 | static int ddp_device_event(struct notifier_block *this, unsigned long event, |
645 | void *ptr) | 645 | void *ptr) |
646 | { | 646 | { |
647 | struct net_device *dev = ptr; | 647 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
648 | 648 | ||
649 | if (!net_eq(dev_net(dev), &init_net)) | 649 | if (!net_eq(dev_net(dev), &init_net)) |
650 | return NOTIFY_DONE; | 650 | return NOTIFY_DONE; |
diff --git a/net/atm/clip.c b/net/atm/clip.c index 8ae3a7879335..cce241eb01d9 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -539,9 +539,9 @@ static int clip_create(int number) | |||
539 | } | 539 | } |
540 | 540 | ||
541 | static int clip_device_event(struct notifier_block *this, unsigned long event, | 541 | static int clip_device_event(struct notifier_block *this, unsigned long event, |
542 | void *arg) | 542 | void *ptr) |
543 | { | 543 | { |
544 | struct net_device *dev = arg; | 544 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
545 | 545 | ||
546 | if (!net_eq(dev_net(dev), &init_net)) | 546 | if (!net_eq(dev_net(dev), &init_net)) |
547 | return NOTIFY_DONE; | 547 | return NOTIFY_DONE; |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index d4cc1be5c364..3af12755cd04 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -998,14 +998,12 @@ int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc) | |||
998 | } | 998 | } |
999 | 999 | ||
1000 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, | 1000 | static int mpoa_event_listener(struct notifier_block *mpoa_notifier, |
1001 | unsigned long event, void *dev_ptr) | 1001 | unsigned long event, void *ptr) |
1002 | { | 1002 | { |
1003 | struct net_device *dev; | 1003 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1004 | struct mpoa_client *mpc; | 1004 | struct mpoa_client *mpc; |
1005 | struct lec_priv *priv; | 1005 | struct lec_priv *priv; |
1006 | 1006 | ||
1007 | dev = dev_ptr; | ||
1008 | |||
1009 | if (!net_eq(dev_net(dev), &init_net)) | 1007 | if (!net_eq(dev_net(dev), &init_net)) |
1010 | return NOTIFY_DONE; | 1008 | return NOTIFY_DONE; |
1011 | 1009 | ||
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index e277e38f736b..4b4d2b779ec1 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -111,9 +111,9 @@ again: | |||
111 | * Handle device status changes. | 111 | * Handle device status changes. |
112 | */ | 112 | */ |
113 | static int ax25_device_event(struct notifier_block *this, unsigned long event, | 113 | static int ax25_device_event(struct notifier_block *this, unsigned long event, |
114 | void *ptr) | 114 | void *ptr) |
115 | { | 115 | { |
116 | struct net_device *dev = (struct net_device *)ptr; | 116 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
117 | 117 | ||
118 | if (!net_eq(dev_net(dev), &init_net)) | 118 | if (!net_eq(dev_net(dev), &init_net)) |
119 | return NOTIFY_DONE; | 119 | return NOTIFY_DONE; |
@@ -1974,7 +1974,7 @@ static struct packet_type ax25_packet_type __read_mostly = { | |||
1974 | }; | 1974 | }; |
1975 | 1975 | ||
1976 | static struct notifier_block ax25_dev_notifier = { | 1976 | static struct notifier_block ax25_dev_notifier = { |
1977 | .notifier_call =ax25_device_event, | 1977 | .notifier_call = ax25_device_event, |
1978 | }; | 1978 | }; |
1979 | 1979 | ||
1980 | static int __init ax25_init(void) | 1980 | static int __init ax25_init(void) |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 522243aff2f3..b6504eac0ed8 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -595,7 +595,7 @@ void batadv_hardif_remove_interfaces(void) | |||
595 | static int batadv_hard_if_event(struct notifier_block *this, | 595 | static int batadv_hard_if_event(struct notifier_block *this, |
596 | unsigned long event, void *ptr) | 596 | unsigned long event, void *ptr) |
597 | { | 597 | { |
598 | struct net_device *net_dev = ptr; | 598 | struct net_device *net_dev = netdev_notifier_info_to_dev(ptr); |
599 | struct batadv_hard_iface *hard_iface; | 599 | struct batadv_hard_iface *hard_iface; |
600 | struct batadv_hard_iface *primary_if = NULL; | 600 | struct batadv_hard_iface *primary_if = NULL; |
601 | struct batadv_priv *bat_priv; | 601 | struct batadv_priv *bat_priv; |
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c index 1644b3e1f947..3a3f371b2841 100644 --- a/net/bridge/br_notify.c +++ b/net/bridge/br_notify.c | |||
@@ -31,7 +31,7 @@ struct notifier_block br_device_notifier = { | |||
31 | */ | 31 | */ |
32 | static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr) | 32 | static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr) |
33 | { | 33 | { |
34 | struct net_device *dev = ptr; | 34 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
35 | struct net_bridge_port *p; | 35 | struct net_bridge_port *p; |
36 | struct net_bridge *br; | 36 | struct net_bridge *br; |
37 | bool changed_addr; | 37 | bool changed_addr; |
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 1f9ece1a9c34..4dca159435cf 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -352,9 +352,9 @@ EXPORT_SYMBOL(caif_enroll_dev); | |||
352 | 352 | ||
353 | /* notify Caif of device events */ | 353 | /* notify Caif of device events */ |
354 | static int caif_device_notify(struct notifier_block *me, unsigned long what, | 354 | static int caif_device_notify(struct notifier_block *me, unsigned long what, |
355 | void *arg) | 355 | void *ptr) |
356 | { | 356 | { |
357 | struct net_device *dev = arg; | 357 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
358 | struct caif_device_entry *caifd = NULL; | 358 | struct caif_device_entry *caifd = NULL; |
359 | struct caif_dev_common *caifdev; | 359 | struct caif_dev_common *caifdev; |
360 | struct cfcnfg *cfg; | 360 | struct cfcnfg *cfg; |
diff --git a/net/caif/caif_usb.c b/net/caif/caif_usb.c index 942e00a425fd..75ed04b78fa4 100644 --- a/net/caif/caif_usb.c +++ b/net/caif/caif_usb.c | |||
@@ -121,9 +121,9 @@ static struct packet_type caif_usb_type __read_mostly = { | |||
121 | }; | 121 | }; |
122 | 122 | ||
123 | static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, | 123 | static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, |
124 | void *arg) | 124 | void *ptr) |
125 | { | 125 | { |
126 | struct net_device *dev = arg; | 126 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
127 | struct caif_dev_common common; | 127 | struct caif_dev_common common; |
128 | struct cflayer *layer, *link_support; | 128 | struct cflayer *layer, *link_support; |
129 | struct usbnet *usbnet; | 129 | struct usbnet *usbnet; |
diff --git a/net/can/af_can.c b/net/can/af_can.c index c4e50852c9f4..3ab8dd2e1282 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -794,9 +794,9 @@ EXPORT_SYMBOL(can_proto_unregister); | |||
794 | * af_can notifier to create/remove CAN netdevice specific structs | 794 | * af_can notifier to create/remove CAN netdevice specific structs |
795 | */ | 795 | */ |
796 | static int can_notifier(struct notifier_block *nb, unsigned long msg, | 796 | static int can_notifier(struct notifier_block *nb, unsigned long msg, |
797 | void *data) | 797 | void *ptr) |
798 | { | 798 | { |
799 | struct net_device *dev = (struct net_device *)data; | 799 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
800 | struct dev_rcv_lists *d; | 800 | struct dev_rcv_lists *d; |
801 | 801 | ||
802 | if (!net_eq(dev_net(dev), &init_net)) | 802 | if (!net_eq(dev_net(dev), &init_net)) |
diff --git a/net/can/bcm.c b/net/can/bcm.c index 8f113e6ff327..46f20bfafc0e 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -1350,9 +1350,9 @@ static int bcm_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1350 | * notification handler for netdevice status changes | 1350 | * notification handler for netdevice status changes |
1351 | */ | 1351 | */ |
1352 | static int bcm_notifier(struct notifier_block *nb, unsigned long msg, | 1352 | static int bcm_notifier(struct notifier_block *nb, unsigned long msg, |
1353 | void *data) | 1353 | void *ptr) |
1354 | { | 1354 | { |
1355 | struct net_device *dev = (struct net_device *)data; | 1355 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1356 | struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier); | 1356 | struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier); |
1357 | struct sock *sk = &bo->sk; | 1357 | struct sock *sk = &bo->sk; |
1358 | struct bcm_op *op; | 1358 | struct bcm_op *op; |
diff --git a/net/can/gw.c b/net/can/gw.c index 3ee690e8c7d3..2f291f961a17 100644 --- a/net/can/gw.c +++ b/net/can/gw.c | |||
@@ -445,9 +445,9 @@ static inline void cgw_unregister_filter(struct cgw_job *gwj) | |||
445 | } | 445 | } |
446 | 446 | ||
447 | static int cgw_notifier(struct notifier_block *nb, | 447 | static int cgw_notifier(struct notifier_block *nb, |
448 | unsigned long msg, void *data) | 448 | unsigned long msg, void *ptr) |
449 | { | 449 | { |
450 | struct net_device *dev = (struct net_device *)data; | 450 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
451 | 451 | ||
452 | if (!net_eq(dev_net(dev), &init_net)) | 452 | if (!net_eq(dev_net(dev), &init_net)) |
453 | return NOTIFY_DONE; | 453 | return NOTIFY_DONE; |
diff --git a/net/can/raw.c b/net/can/raw.c index 1085e65f848e..641e1c895123 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -239,9 +239,9 @@ static int raw_enable_allfilters(struct net_device *dev, struct sock *sk) | |||
239 | } | 239 | } |
240 | 240 | ||
241 | static int raw_notifier(struct notifier_block *nb, | 241 | static int raw_notifier(struct notifier_block *nb, |
242 | unsigned long msg, void *data) | 242 | unsigned long msg, void *ptr) |
243 | { | 243 | { |
244 | struct net_device *dev = (struct net_device *)data; | 244 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
245 | struct raw_sock *ro = container_of(nb, struct raw_sock, notifier); | 245 | struct raw_sock *ro = container_of(nb, struct raw_sock, notifier); |
246 | struct sock *sk = &ro->sk; | 246 | struct sock *sk = &ro->sk; |
247 | 247 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index 5f747974ac58..54fce6006a83 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1391,6 +1391,20 @@ void dev_disable_lro(struct net_device *dev) | |||
1391 | } | 1391 | } |
1392 | EXPORT_SYMBOL(dev_disable_lro); | 1392 | EXPORT_SYMBOL(dev_disable_lro); |
1393 | 1393 | ||
1394 | static void netdev_notifier_info_init(struct netdev_notifier_info *info, | ||
1395 | struct net_device *dev) | ||
1396 | { | ||
1397 | info->dev = dev; | ||
1398 | } | ||
1399 | |||
1400 | static int call_netdevice_notifier(struct notifier_block *nb, unsigned long val, | ||
1401 | struct net_device *dev) | ||
1402 | { | ||
1403 | struct netdev_notifier_info info; | ||
1404 | |||
1405 | netdev_notifier_info_init(&info, dev); | ||
1406 | return nb->notifier_call(nb, val, &info); | ||
1407 | } | ||
1394 | 1408 | ||
1395 | static int dev_boot_phase = 1; | 1409 | static int dev_boot_phase = 1; |
1396 | 1410 | ||
@@ -1423,7 +1437,7 @@ int register_netdevice_notifier(struct notifier_block *nb) | |||
1423 | goto unlock; | 1437 | goto unlock; |
1424 | for_each_net(net) { | 1438 | for_each_net(net) { |
1425 | for_each_netdev(net, dev) { | 1439 | for_each_netdev(net, dev) { |
1426 | err = nb->notifier_call(nb, NETDEV_REGISTER, dev); | 1440 | err = call_netdevice_notifier(nb, NETDEV_REGISTER, dev); |
1427 | err = notifier_to_errno(err); | 1441 | err = notifier_to_errno(err); |
1428 | if (err) | 1442 | if (err) |
1429 | goto rollback; | 1443 | goto rollback; |
@@ -1431,7 +1445,7 @@ int register_netdevice_notifier(struct notifier_block *nb) | |||
1431 | if (!(dev->flags & IFF_UP)) | 1445 | if (!(dev->flags & IFF_UP)) |
1432 | continue; | 1446 | continue; |
1433 | 1447 | ||
1434 | nb->notifier_call(nb, NETDEV_UP, dev); | 1448 | call_netdevice_notifier(nb, NETDEV_UP, dev); |
1435 | } | 1449 | } |
1436 | } | 1450 | } |
1437 | 1451 | ||
@@ -1447,10 +1461,11 @@ rollback: | |||
1447 | goto outroll; | 1461 | goto outroll; |
1448 | 1462 | ||
1449 | if (dev->flags & IFF_UP) { | 1463 | if (dev->flags & IFF_UP) { |
1450 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | 1464 | call_netdevice_notifier(nb, NETDEV_GOING_DOWN, |
1451 | nb->notifier_call(nb, NETDEV_DOWN, dev); | 1465 | dev); |
1466 | call_netdevice_notifier(nb, NETDEV_DOWN, dev); | ||
1452 | } | 1467 | } |
1453 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | 1468 | call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev); |
1454 | } | 1469 | } |
1455 | } | 1470 | } |
1456 | 1471 | ||
@@ -1488,10 +1503,11 @@ int unregister_netdevice_notifier(struct notifier_block *nb) | |||
1488 | for_each_net(net) { | 1503 | for_each_net(net) { |
1489 | for_each_netdev(net, dev) { | 1504 | for_each_netdev(net, dev) { |
1490 | if (dev->flags & IFF_UP) { | 1505 | if (dev->flags & IFF_UP) { |
1491 | nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); | 1506 | call_netdevice_notifier(nb, NETDEV_GOING_DOWN, |
1492 | nb->notifier_call(nb, NETDEV_DOWN, dev); | 1507 | dev); |
1508 | call_netdevice_notifier(nb, NETDEV_DOWN, dev); | ||
1493 | } | 1509 | } |
1494 | nb->notifier_call(nb, NETDEV_UNREGISTER, dev); | 1510 | call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev); |
1495 | } | 1511 | } |
1496 | } | 1512 | } |
1497 | unlock: | 1513 | unlock: |
@@ -1501,6 +1517,25 @@ unlock: | |||
1501 | EXPORT_SYMBOL(unregister_netdevice_notifier); | 1517 | EXPORT_SYMBOL(unregister_netdevice_notifier); |
1502 | 1518 | ||
1503 | /** | 1519 | /** |
1520 | * call_netdevice_notifiers_info - call all network notifier blocks | ||
1521 | * @val: value passed unmodified to notifier function | ||
1522 | * @dev: net_device pointer passed unmodified to notifier function | ||
1523 | * @info: notifier information data | ||
1524 | * | ||
1525 | * Call all network notifier blocks. Parameters and return value | ||
1526 | * are as for raw_notifier_call_chain(). | ||
1527 | */ | ||
1528 | |||
1529 | int call_netdevice_notifiers_info(unsigned long val, struct net_device *dev, | ||
1530 | struct netdev_notifier_info *info) | ||
1531 | { | ||
1532 | ASSERT_RTNL(); | ||
1533 | netdev_notifier_info_init(info, dev); | ||
1534 | return raw_notifier_call_chain(&netdev_chain, val, info); | ||
1535 | } | ||
1536 | EXPORT_SYMBOL(call_netdevice_notifiers_info); | ||
1537 | |||
1538 | /** | ||
1504 | * call_netdevice_notifiers - call all network notifier blocks | 1539 | * call_netdevice_notifiers - call all network notifier blocks |
1505 | * @val: value passed unmodified to notifier function | 1540 | * @val: value passed unmodified to notifier function |
1506 | * @dev: net_device pointer passed unmodified to notifier function | 1541 | * @dev: net_device pointer passed unmodified to notifier function |
@@ -1511,8 +1546,9 @@ EXPORT_SYMBOL(unregister_netdevice_notifier); | |||
1511 | 1546 | ||
1512 | int call_netdevice_notifiers(unsigned long val, struct net_device *dev) | 1547 | int call_netdevice_notifiers(unsigned long val, struct net_device *dev) |
1513 | { | 1548 | { |
1514 | ASSERT_RTNL(); | 1549 | struct netdev_notifier_info info; |
1515 | return raw_notifier_call_chain(&netdev_chain, val, dev); | 1550 | |
1551 | return call_netdevice_notifiers_info(val, dev, &info); | ||
1516 | } | 1552 | } |
1517 | EXPORT_SYMBOL(call_netdevice_notifiers); | 1553 | EXPORT_SYMBOL(call_netdevice_notifiers); |
1518 | 1554 | ||
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index d23b6682f4e9..5e78d44333b9 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -295,9 +295,9 @@ static int net_dm_cmd_trace(struct sk_buff *skb, | |||
295 | } | 295 | } |
296 | 296 | ||
297 | static int dropmon_net_event(struct notifier_block *ev_block, | 297 | static int dropmon_net_event(struct notifier_block *ev_block, |
298 | unsigned long event, void *ptr) | 298 | unsigned long event, void *ptr) |
299 | { | 299 | { |
300 | struct net_device *dev = ptr; | 300 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
301 | struct dm_hw_stat_delta *new_stat = NULL; | 301 | struct dm_hw_stat_delta *new_stat = NULL; |
302 | struct dm_hw_stat_delta *tmp; | 302 | struct dm_hw_stat_delta *tmp; |
303 | 303 | ||
diff --git a/net/core/dst.c b/net/core/dst.c index df9cc810ec8e..ca4231ec7347 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -372,7 +372,7 @@ static void dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
372 | static int dst_dev_event(struct notifier_block *this, unsigned long event, | 372 | static int dst_dev_event(struct notifier_block *this, unsigned long event, |
373 | void *ptr) | 373 | void *ptr) |
374 | { | 374 | { |
375 | struct net_device *dev = ptr; | 375 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
376 | struct dst_entry *dst, *last = NULL; | 376 | struct dst_entry *dst, *last = NULL; |
377 | 377 | ||
378 | switch (event) { | 378 | switch (event) { |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index d5a9f8ead0d8..21735440c44a 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -705,9 +705,9 @@ static void detach_rules(struct list_head *rules, struct net_device *dev) | |||
705 | 705 | ||
706 | 706 | ||
707 | static int fib_rules_event(struct notifier_block *this, unsigned long event, | 707 | static int fib_rules_event(struct notifier_block *this, unsigned long event, |
708 | void *ptr) | 708 | void *ptr) |
709 | { | 709 | { |
710 | struct net_device *dev = ptr; | 710 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
711 | struct net *net = dev_net(dev); | 711 | struct net *net = dev_net(dev); |
712 | struct fib_rules_ops *ops; | 712 | struct fib_rules_ops *ops; |
713 | 713 | ||
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 0777d0aa18c3..e533259dce3c 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -261,7 +261,7 @@ struct cgroup_subsys net_prio_subsys = { | |||
261 | static int netprio_device_event(struct notifier_block *unused, | 261 | static int netprio_device_event(struct notifier_block *unused, |
262 | unsigned long event, void *ptr) | 262 | unsigned long event, void *ptr) |
263 | { | 263 | { |
264 | struct net_device *dev = ptr; | 264 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
265 | struct netprio_map *old; | 265 | struct netprio_map *old; |
266 | 266 | ||
267 | /* | 267 | /* |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 11f2704c3810..795498fd4587 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1921,7 +1921,7 @@ static void pktgen_change_name(const struct pktgen_net *pn, struct net_device *d | |||
1921 | static int pktgen_device_event(struct notifier_block *unused, | 1921 | static int pktgen_device_event(struct notifier_block *unused, |
1922 | unsigned long event, void *ptr) | 1922 | unsigned long event, void *ptr) |
1923 | { | 1923 | { |
1924 | struct net_device *dev = ptr; | 1924 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1925 | struct pktgen_net *pn = net_generic(dev_net(dev), pg_net_id); | 1925 | struct pktgen_net *pn = net_generic(dev_net(dev), pg_net_id); |
1926 | 1926 | ||
1927 | if (pn->pktgen_exiting) | 1927 | if (pn->pktgen_exiting) |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index a08bd2b7fe3f..49c14451d8ab 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2667,7 +2667,7 @@ static void rtnetlink_rcv(struct sk_buff *skb) | |||
2667 | 2667 | ||
2668 | static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr) | 2668 | static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr) |
2669 | { | 2669 | { |
2670 | struct net_device *dev = ptr; | 2670 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2671 | 2671 | ||
2672 | switch (event) { | 2672 | switch (event) { |
2673 | case NETDEV_UP: | 2673 | case NETDEV_UP: |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index c21f200eed93..dd4d506ef923 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -2078,9 +2078,9 @@ out_err: | |||
2078 | } | 2078 | } |
2079 | 2079 | ||
2080 | static int dn_device_event(struct notifier_block *this, unsigned long event, | 2080 | static int dn_device_event(struct notifier_block *this, unsigned long event, |
2081 | void *ptr) | 2081 | void *ptr) |
2082 | { | 2082 | { |
2083 | struct net_device *dev = (struct net_device *)ptr; | 2083 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2084 | 2084 | ||
2085 | if (!net_eq(dev_net(dev), &init_net)) | 2085 | if (!net_eq(dev_net(dev), &init_net)) |
2086 | return NOTIFY_DONE; | 2086 | return NOTIFY_DONE; |
diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c index 55e1fd5b3e56..3b9d5f20bd1c 100644 --- a/net/ieee802154/6lowpan.c +++ b/net/ieee802154/6lowpan.c | |||
@@ -1352,10 +1352,9 @@ static inline void lowpan_netlink_fini(void) | |||
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | static int lowpan_device_event(struct notifier_block *unused, | 1354 | static int lowpan_device_event(struct notifier_block *unused, |
1355 | unsigned long event, | 1355 | unsigned long event, void *ptr) |
1356 | void *ptr) | ||
1357 | { | 1356 | { |
1358 | struct net_device *dev = ptr; | 1357 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1359 | LIST_HEAD(del_list); | 1358 | LIST_HEAD(del_list); |
1360 | struct lowpan_dev_record *entry, *tmp; | 1359 | struct lowpan_dev_record *entry, *tmp; |
1361 | 1360 | ||
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 247ec1951c35..bf574029a183 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -1234,7 +1234,7 @@ out: | |||
1234 | static int arp_netdev_event(struct notifier_block *this, unsigned long event, | 1234 | static int arp_netdev_event(struct notifier_block *this, unsigned long event, |
1235 | void *ptr) | 1235 | void *ptr) |
1236 | { | 1236 | { |
1237 | struct net_device *dev = ptr; | 1237 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1238 | 1238 | ||
1239 | switch (event) { | 1239 | switch (event) { |
1240 | case NETDEV_CHANGEADDR: | 1240 | case NETDEV_CHANGEADDR: |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index dfc39d4d48b7..b047e2d8a614 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1333,7 +1333,7 @@ static void inetdev_send_gratuitous_arp(struct net_device *dev, | |||
1333 | static int inetdev_event(struct notifier_block *this, unsigned long event, | 1333 | static int inetdev_event(struct notifier_block *this, unsigned long event, |
1334 | void *ptr) | 1334 | void *ptr) |
1335 | { | 1335 | { |
1336 | struct net_device *dev = ptr; | 1336 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1337 | struct in_device *in_dev = __in_dev_get_rtnl(dev); | 1337 | struct in_device *in_dev = __in_dev_get_rtnl(dev); |
1338 | 1338 | ||
1339 | ASSERT_RTNL(); | 1339 | ASSERT_RTNL(); |
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index c7629a209f9d..05a4888dede9 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -1038,7 +1038,7 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
1038 | 1038 | ||
1039 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1039 | static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
1040 | { | 1040 | { |
1041 | struct net_device *dev = ptr; | 1041 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1042 | struct in_device *in_dev; | 1042 | struct in_device *in_dev; |
1043 | struct net *net = dev_net(dev); | 1043 | struct net *net = dev_net(dev); |
1044 | 1044 | ||
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 9d9610ae7855..f975399f3522 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1609,7 +1609,7 @@ int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) | |||
1609 | 1609 | ||
1610 | static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr) | 1610 | static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr) |
1611 | { | 1611 | { |
1612 | struct net_device *dev = ptr; | 1612 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1613 | struct net *net = dev_net(dev); | 1613 | struct net *net = dev_net(dev); |
1614 | struct mr_table *mrt; | 1614 | struct mr_table *mrt; |
1615 | struct vif_device *v; | 1615 | struct vif_device *v; |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index 5d5d4d1be9c2..dd5508bde799 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -108,7 +108,7 @@ static int masq_device_event(struct notifier_block *this, | |||
108 | unsigned long event, | 108 | unsigned long event, |
109 | void *ptr) | 109 | void *ptr) |
110 | { | 110 | { |
111 | const struct net_device *dev = ptr; | 111 | const struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
112 | struct net *net = dev_net(dev); | 112 | struct net *net = dev_net(dev); |
113 | 113 | ||
114 | if (event == NETDEV_DOWN) { | 114 | if (event == NETDEV_DOWN) { |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 432e084b6b62..bce073b4bbd4 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -2826,9 +2826,9 @@ static void addrconf_ip6_tnl_config(struct net_device *dev) | |||
2826 | } | 2826 | } |
2827 | 2827 | ||
2828 | static int addrconf_notify(struct notifier_block *this, unsigned long event, | 2828 | static int addrconf_notify(struct notifier_block *this, unsigned long event, |
2829 | void *data) | 2829 | void *ptr) |
2830 | { | 2830 | { |
2831 | struct net_device *dev = (struct net_device *) data; | 2831 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2832 | struct inet6_dev *idev = __in6_dev_get(dev); | 2832 | struct inet6_dev *idev = __in6_dev_get(dev); |
2833 | int run_pending = 0; | 2833 | int run_pending = 0; |
2834 | int err; | 2834 | int err; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 241fb8ad9fcf..583e8d435f9a 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1319,7 +1319,7 @@ static int ip6mr_mfc_delete(struct mr6_table *mrt, struct mf6cctl *mfc, | |||
1319 | static int ip6mr_device_event(struct notifier_block *this, | 1319 | static int ip6mr_device_event(struct notifier_block *this, |
1320 | unsigned long event, void *ptr) | 1320 | unsigned long event, void *ptr) |
1321 | { | 1321 | { |
1322 | struct net_device *dev = ptr; | 1322 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1323 | struct net *net = dev_net(dev); | 1323 | struct net *net = dev_net(dev); |
1324 | struct mr6_table *mrt; | 1324 | struct mr6_table *mrt; |
1325 | struct mif_device *v; | 1325 | struct mif_device *v; |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 2712ab22a174..a0962697a257 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1568,7 +1568,7 @@ int ndisc_rcv(struct sk_buff *skb) | |||
1568 | 1568 | ||
1569 | static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1569 | static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
1570 | { | 1570 | { |
1571 | struct net_device *dev = ptr; | 1571 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1572 | struct net *net = dev_net(dev); | 1572 | struct net *net = dev_net(dev); |
1573 | struct inet6_dev *idev; | 1573 | struct inet6_dev *idev; |
1574 | 1574 | ||
diff --git a/net/ipv6/netfilter/ip6t_MASQUERADE.c b/net/ipv6/netfilter/ip6t_MASQUERADE.c index 60e9053bab05..b76257cd7e1e 100644 --- a/net/ipv6/netfilter/ip6t_MASQUERADE.c +++ b/net/ipv6/netfilter/ip6t_MASQUERADE.c | |||
@@ -71,7 +71,7 @@ static int device_cmp(struct nf_conn *ct, void *ifindex) | |||
71 | static int masq_device_event(struct notifier_block *this, | 71 | static int masq_device_event(struct notifier_block *this, |
72 | unsigned long event, void *ptr) | 72 | unsigned long event, void *ptr) |
73 | { | 73 | { |
74 | const struct net_device *dev = ptr; | 74 | const struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
75 | struct net *net = dev_net(dev); | 75 | struct net *net = dev_net(dev); |
76 | 76 | ||
77 | if (event == NETDEV_DOWN) | 77 | if (event == NETDEV_DOWN) |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index ad0aa6b0b86a..194c3cde1536 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2681,9 +2681,9 @@ errout: | |||
2681 | } | 2681 | } |
2682 | 2682 | ||
2683 | static int ip6_route_dev_notify(struct notifier_block *this, | 2683 | static int ip6_route_dev_notify(struct notifier_block *this, |
2684 | unsigned long event, void *data) | 2684 | unsigned long event, void *ptr) |
2685 | { | 2685 | { |
2686 | struct net_device *dev = (struct net_device *)data; | 2686 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2687 | struct net *net = dev_net(dev); | 2687 | struct net *net = dev_net(dev); |
2688 | 2688 | ||
2689 | if (event == NETDEV_REGISTER && (dev->flags & IFF_LOOPBACK)) { | 2689 | if (event == NETDEV_REGISTER && (dev->flags & IFF_LOOPBACK)) { |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index f547a47d381c..7a1e0fc1bd4d 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -330,7 +330,7 @@ static __inline__ void __ipxitf_put(struct ipx_interface *intrfc) | |||
330 | static int ipxitf_device_event(struct notifier_block *notifier, | 330 | static int ipxitf_device_event(struct notifier_block *notifier, |
331 | unsigned long event, void *ptr) | 331 | unsigned long event, void *ptr) |
332 | { | 332 | { |
333 | struct net_device *dev = ptr; | 333 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
334 | struct ipx_interface *i, *tmp; | 334 | struct ipx_interface *i, *tmp; |
335 | 335 | ||
336 | if (!net_eq(dev_net(dev), &init_net)) | 336 | if (!net_eq(dev_net(dev), &init_net)) |
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index ae691651b721..168aff5e60de 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -2293,7 +2293,7 @@ out_unlock: | |||
2293 | static int afiucv_netdev_event(struct notifier_block *this, | 2293 | static int afiucv_netdev_event(struct notifier_block *this, |
2294 | unsigned long event, void *ptr) | 2294 | unsigned long event, void *ptr) |
2295 | { | 2295 | { |
2296 | struct net_device *event_dev = (struct net_device *)ptr; | 2296 | struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); |
2297 | struct sock *sk; | 2297 | struct sock *sk; |
2298 | struct iucv_sock *iucv; | 2298 | struct iucv_sock *iucv; |
2299 | 2299 | ||
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 60f1ce5e5e52..d2c3fd178dbe 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1717,10 +1717,9 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1717 | } | 1717 | } |
1718 | 1718 | ||
1719 | static int netdev_notify(struct notifier_block *nb, | 1719 | static int netdev_notify(struct notifier_block *nb, |
1720 | unsigned long state, | 1720 | unsigned long state, void *ptr) |
1721 | void *ndev) | ||
1722 | { | 1721 | { |
1723 | struct net_device *dev = ndev; | 1722 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1724 | struct ieee80211_sub_if_data *sdata; | 1723 | struct ieee80211_sub_if_data *sdata; |
1725 | 1724 | ||
1726 | if (state != NETDEV_CHANGENAME) | 1725 | if (state != NETDEV_CHANGENAME) |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 5b142fb16480..7c3ed429789e 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -1487,9 +1487,9 @@ ip_vs_forget_dev(struct ip_vs_dest *dest, struct net_device *dev) | |||
1487 | * Currently only NETDEV_DOWN is handled to release refs to cached dsts | 1487 | * Currently only NETDEV_DOWN is handled to release refs to cached dsts |
1488 | */ | 1488 | */ |
1489 | static int ip_vs_dst_event(struct notifier_block *this, unsigned long event, | 1489 | static int ip_vs_dst_event(struct notifier_block *this, unsigned long event, |
1490 | void *ptr) | 1490 | void *ptr) |
1491 | { | 1491 | { |
1492 | struct net_device *dev = ptr; | 1492 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
1493 | struct net *net = dev_net(dev); | 1493 | struct net *net = dev_net(dev); |
1494 | struct netns_ipvs *ipvs = net_ipvs(net); | 1494 | struct netns_ipvs *ipvs = net_ipvs(net); |
1495 | struct ip_vs_service *svc; | 1495 | struct ip_vs_service *svc; |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 4e27fa035814..0f2ac8f2e7b7 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -800,7 +800,7 @@ static int | |||
800 | nfqnl_rcv_dev_event(struct notifier_block *this, | 800 | nfqnl_rcv_dev_event(struct notifier_block *this, |
801 | unsigned long event, void *ptr) | 801 | unsigned long event, void *ptr) |
802 | { | 802 | { |
803 | struct net_device *dev = ptr; | 803 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
804 | 804 | ||
805 | /* Drop any packets associated with the downed device */ | 805 | /* Drop any packets associated with the downed device */ |
806 | if (event == NETDEV_DOWN) | 806 | if (event == NETDEV_DOWN) |
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c index bd93e51d30ac..292934d23482 100644 --- a/net/netfilter/xt_TEE.c +++ b/net/netfilter/xt_TEE.c | |||
@@ -200,7 +200,7 @@ tee_tg6(struct sk_buff *skb, const struct xt_action_param *par) | |||
200 | static int tee_netdev_event(struct notifier_block *this, unsigned long event, | 200 | static int tee_netdev_event(struct notifier_block *this, unsigned long event, |
201 | void *ptr) | 201 | void *ptr) |
202 | { | 202 | { |
203 | struct net_device *dev = ptr; | 203 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
204 | struct xt_tee_priv *priv; | 204 | struct xt_tee_priv *priv; |
205 | 205 | ||
206 | priv = container_of(this, struct xt_tee_priv, notifier); | 206 | priv = container_of(this, struct xt_tee_priv, notifier); |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 8a6c6ea466d8..af3531926ee0 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -708,7 +708,7 @@ unlhsh_remove_return: | |||
708 | * netlbl_unlhsh_netdev_handler - Network device notification handler | 708 | * netlbl_unlhsh_netdev_handler - Network device notification handler |
709 | * @this: notifier block | 709 | * @this: notifier block |
710 | * @event: the event | 710 | * @event: the event |
711 | * @ptr: the network device (cast to void) | 711 | * @ptr: the netdevice notifier info (cast to void) |
712 | * | 712 | * |
713 | * Description: | 713 | * Description: |
714 | * Handle network device events, although at present all we care about is a | 714 | * Handle network device events, although at present all we care about is a |
@@ -717,10 +717,9 @@ unlhsh_remove_return: | |||
717 | * | 717 | * |
718 | */ | 718 | */ |
719 | static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, | 719 | static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, |
720 | unsigned long event, | 720 | unsigned long event, void *ptr) |
721 | void *ptr) | ||
722 | { | 721 | { |
723 | struct net_device *dev = ptr; | 722 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
724 | struct netlbl_unlhsh_iface *iface = NULL; | 723 | struct netlbl_unlhsh_iface *iface = NULL; |
725 | 724 | ||
726 | if (!net_eq(dev_net(dev), &init_net)) | 725 | if (!net_eq(dev_net(dev), &init_net)) |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index ec0c80fde69f..698814bfa7ad 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -117,7 +117,7 @@ static void nr_kill_by_device(struct net_device *dev) | |||
117 | */ | 117 | */ |
118 | static int nr_device_event(struct notifier_block *this, unsigned long event, void *ptr) | 118 | static int nr_device_event(struct notifier_block *this, unsigned long event, void *ptr) |
119 | { | 119 | { |
120 | struct net_device *dev = (struct net_device *)ptr; | 120 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
121 | 121 | ||
122 | if (!net_eq(dev_net(dev), &init_net)) | 122 | if (!net_eq(dev_net(dev), &init_net)) |
123 | return NOTIFY_DONE; | 123 | return NOTIFY_DONE; |
diff --git a/net/openvswitch/dp_notify.c b/net/openvswitch/dp_notify.c index ef4feec6cd84..c3235675f359 100644 --- a/net/openvswitch/dp_notify.c +++ b/net/openvswitch/dp_notify.c | |||
@@ -78,7 +78,7 @@ static int dp_device_event(struct notifier_block *unused, unsigned long event, | |||
78 | void *ptr) | 78 | void *ptr) |
79 | { | 79 | { |
80 | struct ovs_net *ovs_net; | 80 | struct ovs_net *ovs_net; |
81 | struct net_device *dev = ptr; | 81 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
82 | struct vport *vport = NULL; | 82 | struct vport *vport = NULL; |
83 | 83 | ||
84 | if (!ovs_is_internal_dev(dev)) | 84 | if (!ovs_is_internal_dev(dev)) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8ec1bca7f859..79fe63246b27 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -3331,10 +3331,11 @@ static int packet_getsockopt(struct socket *sock, int level, int optname, | |||
3331 | } | 3331 | } |
3332 | 3332 | ||
3333 | 3333 | ||
3334 | static int packet_notifier(struct notifier_block *this, unsigned long msg, void *data) | 3334 | static int packet_notifier(struct notifier_block *this, |
3335 | unsigned long msg, void *ptr) | ||
3335 | { | 3336 | { |
3336 | struct sock *sk; | 3337 | struct sock *sk; |
3337 | struct net_device *dev = data; | 3338 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
3338 | struct net *net = dev_net(dev); | 3339 | struct net *net = dev_net(dev); |
3339 | 3340 | ||
3340 | rcu_read_lock(); | 3341 | rcu_read_lock(); |
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 45a7df6575de..56a6146ac94b 100644 --- a/net/phonet/pn_dev.c +++ b/net/phonet/pn_dev.c | |||
@@ -292,9 +292,9 @@ static void phonet_route_autodel(struct net_device *dev) | |||
292 | 292 | ||
293 | /* notify Phonet of device events */ | 293 | /* notify Phonet of device events */ |
294 | static int phonet_device_notify(struct notifier_block *me, unsigned long what, | 294 | static int phonet_device_notify(struct notifier_block *me, unsigned long what, |
295 | void *arg) | 295 | void *ptr) |
296 | { | 296 | { |
297 | struct net_device *dev = arg; | 297 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
298 | 298 | ||
299 | switch (what) { | 299 | switch (what) { |
300 | case NETDEV_REGISTER: | 300 | case NETDEV_REGISTER: |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 9c8347451597..e98fcfbe6007 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -202,10 +202,10 @@ static void rose_kill_by_device(struct net_device *dev) | |||
202 | /* | 202 | /* |
203 | * Handle device status changes. | 203 | * Handle device status changes. |
204 | */ | 204 | */ |
205 | static int rose_device_event(struct notifier_block *this, unsigned long event, | 205 | static int rose_device_event(struct notifier_block *this, |
206 | void *ptr) | 206 | unsigned long event, void *ptr) |
207 | { | 207 | { |
208 | struct net_device *dev = (struct net_device *)ptr; | 208 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
209 | 209 | ||
210 | if (!net_eq(dev_net(dev), &init_net)) | 210 | if (!net_eq(dev_net(dev), &init_net)) |
211 | return NOTIFY_DONE; | 211 | return NOTIFY_DONE; |
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 5d676edc22a6..977c10e0631b 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c | |||
@@ -243,7 +243,7 @@ nla_put_failure: | |||
243 | static int mirred_device_event(struct notifier_block *unused, | 243 | static int mirred_device_event(struct notifier_block *unused, |
244 | unsigned long event, void *ptr) | 244 | unsigned long event, void *ptr) |
245 | { | 245 | { |
246 | struct net_device *dev = ptr; | 246 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
247 | struct tcf_mirred *m; | 247 | struct tcf_mirred *m; |
248 | 248 | ||
249 | if (event == NETDEV_UNREGISTER) | 249 | if (event == NETDEV_UNREGISTER) |
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 120a676a3360..fc60bea63169 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
@@ -251,9 +251,9 @@ static void disable_bearer(struct tipc_bearer *tb_ptr) | |||
251 | * specified device. | 251 | * specified device. |
252 | */ | 252 | */ |
253 | static int recv_notification(struct notifier_block *nb, unsigned long evt, | 253 | static int recv_notification(struct notifier_block *nb, unsigned long evt, |
254 | void *dv) | 254 | void *ptr) |
255 | { | 255 | { |
256 | struct net_device *dev = (struct net_device *)dv; | 256 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
257 | struct eth_bearer *eb_ptr = ð_bearers[0]; | 257 | struct eth_bearer *eb_ptr = ð_bearers[0]; |
258 | struct eth_bearer *stop = ð_bearers[MAX_ETH_BEARERS]; | 258 | struct eth_bearer *stop = ð_bearers[MAX_ETH_BEARERS]; |
259 | 259 | ||
diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c index 2a2864c25e15..baa9df4327d9 100644 --- a/net/tipc/ib_media.c +++ b/net/tipc/ib_media.c | |||
@@ -244,9 +244,9 @@ static void disable_bearer(struct tipc_bearer *tb_ptr) | |||
244 | * specified device. | 244 | * specified device. |
245 | */ | 245 | */ |
246 | static int recv_notification(struct notifier_block *nb, unsigned long evt, | 246 | static int recv_notification(struct notifier_block *nb, unsigned long evt, |
247 | void *dv) | 247 | void *ptr) |
248 | { | 248 | { |
249 | struct net_device *dev = (struct net_device *)dv; | 249 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
250 | struct ib_bearer *ib_ptr = &ib_bearers[0]; | 250 | struct ib_bearer *ib_ptr = &ib_bearers[0]; |
251 | struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; | 251 | struct ib_bearer *stop = &ib_bearers[MAX_IB_BEARERS]; |
252 | 252 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index 73405e00c800..01e41191f1bf 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -886,10 +886,9 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev, | |||
886 | } | 886 | } |
887 | 887 | ||
888 | static int cfg80211_netdev_notifier_call(struct notifier_block *nb, | 888 | static int cfg80211_netdev_notifier_call(struct notifier_block *nb, |
889 | unsigned long state, | 889 | unsigned long state, void *ptr) |
890 | void *ndev) | ||
891 | { | 890 | { |
892 | struct net_device *dev = ndev; | 891 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
893 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 892 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
894 | struct cfg80211_registered_device *rdev; | 893 | struct cfg80211_registered_device *rdev; |
895 | int ret; | 894 | int ret; |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 37ca9694aabe..1d964e23853f 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -224,7 +224,7 @@ static void x25_kill_by_device(struct net_device *dev) | |||
224 | static int x25_device_event(struct notifier_block *this, unsigned long event, | 224 | static int x25_device_event(struct notifier_block *this, unsigned long event, |
225 | void *ptr) | 225 | void *ptr) |
226 | { | 226 | { |
227 | struct net_device *dev = ptr; | 227 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
228 | struct x25_neigh *nb; | 228 | struct x25_neigh *nb; |
229 | 229 | ||
230 | if (!net_eq(dev_net(dev), &init_net)) | 230 | if (!net_eq(dev_net(dev), &init_net)) |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 23cea0f74336..536ccc95de89 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2784,7 +2784,7 @@ static void __net_init xfrm_dst_ops_init(struct net *net) | |||
2784 | 2784 | ||
2785 | static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) | 2785 | static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr) |
2786 | { | 2786 | { |
2787 | struct net_device *dev = ptr; | 2787 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
2788 | 2788 | ||
2789 | switch (event) { | 2789 | switch (event) { |
2790 | case NETDEV_DOWN: | 2790 | case NETDEV_DOWN: |
diff --git a/security/selinux/netif.c b/security/selinux/netif.c index 47a49d1a6f6a..694e9e43855f 100644 --- a/security/selinux/netif.c +++ b/security/selinux/netif.c | |||
@@ -264,7 +264,7 @@ static int sel_netif_avc_callback(u32 event) | |||
264 | static int sel_netif_netdev_notifier_handler(struct notifier_block *this, | 264 | static int sel_netif_netdev_notifier_handler(struct notifier_block *this, |
265 | unsigned long event, void *ptr) | 265 | unsigned long event, void *ptr) |
266 | { | 266 | { |
267 | struct net_device *dev = ptr; | 267 | struct net_device *dev = netdev_notifier_info_to_dev(ptr); |
268 | 268 | ||
269 | if (dev_net(dev) != &init_net) | 269 | if (dev_net(dev) != &init_net) |
270 | return NOTIFY_DONE; | 270 | return NOTIFY_DONE; |