diff options
Diffstat (limited to 'net/switchdev/switchdev.c')
-rw-r--r-- | net/switchdev/switchdev.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 8d40a7d31c99..25dc67ef9d37 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -571,24 +571,17 @@ int switchdev_port_obj_dump(struct net_device *dev, struct switchdev_obj *obj, | |||
571 | } | 571 | } |
572 | EXPORT_SYMBOL_GPL(switchdev_port_obj_dump); | 572 | EXPORT_SYMBOL_GPL(switchdev_port_obj_dump); |
573 | 573 | ||
574 | static RAW_NOTIFIER_HEAD(switchdev_notif_chain); | 574 | static ATOMIC_NOTIFIER_HEAD(switchdev_notif_chain); |
575 | 575 | ||
576 | /** | 576 | /** |
577 | * register_switchdev_notifier - Register notifier | 577 | * register_switchdev_notifier - Register notifier |
578 | * @nb: notifier_block | 578 | * @nb: notifier_block |
579 | * | 579 | * |
580 | * Register switch device notifier. This should be used by code | 580 | * Register switch device notifier. |
581 | * which needs to monitor events happening in particular device. | ||
582 | * Return values are same as for atomic_notifier_chain_register(). | ||
583 | */ | 581 | */ |
584 | int register_switchdev_notifier(struct notifier_block *nb) | 582 | int register_switchdev_notifier(struct notifier_block *nb) |
585 | { | 583 | { |
586 | int err; | 584 | return atomic_notifier_chain_register(&switchdev_notif_chain, nb); |
587 | |||
588 | rtnl_lock(); | ||
589 | err = raw_notifier_chain_register(&switchdev_notif_chain, nb); | ||
590 | rtnl_unlock(); | ||
591 | return err; | ||
592 | } | 585 | } |
593 | EXPORT_SYMBOL_GPL(register_switchdev_notifier); | 586 | EXPORT_SYMBOL_GPL(register_switchdev_notifier); |
594 | 587 | ||
@@ -597,16 +590,10 @@ EXPORT_SYMBOL_GPL(register_switchdev_notifier); | |||
597 | * @nb: notifier_block | 590 | * @nb: notifier_block |
598 | * | 591 | * |
599 | * Unregister switch device notifier. | 592 | * Unregister switch device notifier. |
600 | * Return values are same as for atomic_notifier_chain_unregister(). | ||
601 | */ | 593 | */ |
602 | int unregister_switchdev_notifier(struct notifier_block *nb) | 594 | int unregister_switchdev_notifier(struct notifier_block *nb) |
603 | { | 595 | { |
604 | int err; | 596 | return atomic_notifier_chain_unregister(&switchdev_notif_chain, nb); |
605 | |||
606 | rtnl_lock(); | ||
607 | err = raw_notifier_chain_unregister(&switchdev_notif_chain, nb); | ||
608 | rtnl_unlock(); | ||
609 | return err; | ||
610 | } | 597 | } |
611 | EXPORT_SYMBOL_GPL(unregister_switchdev_notifier); | 598 | EXPORT_SYMBOL_GPL(unregister_switchdev_notifier); |
612 | 599 | ||
@@ -616,18 +603,13 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_notifier); | |||
616 | * @dev: port device | 603 | * @dev: port device |
617 | * @info: notifier information data | 604 | * @info: notifier information data |
618 | * | 605 | * |
619 | * Call all network notifier blocks. This should be called by driver | 606 | * Call all network notifier blocks. |
620 | * when it needs to propagate hardware event. | ||
621 | * Return values are same as for atomic_notifier_call_chain(). | ||
622 | * rtnl_lock must be held. | ||
623 | */ | 607 | */ |
624 | int call_switchdev_notifiers(unsigned long val, struct net_device *dev, | 608 | int call_switchdev_notifiers(unsigned long val, struct net_device *dev, |
625 | struct switchdev_notifier_info *info) | 609 | struct switchdev_notifier_info *info) |
626 | { | 610 | { |
627 | ASSERT_RTNL(); | ||
628 | |||
629 | info->dev = dev; | 611 | info->dev = dev; |
630 | return raw_notifier_call_chain(&switchdev_notif_chain, val, info); | 612 | return atomic_notifier_call_chain(&switchdev_notif_chain, val, info); |
631 | } | 613 | } |
632 | EXPORT_SYMBOL_GPL(call_switchdev_notifiers); | 614 | EXPORT_SYMBOL_GPL(call_switchdev_notifiers); |
633 | 615 | ||