aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/dynamic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/of/dynamic.c')
-rw-r--r--drivers/of/dynamic.c65
1 files changed, 46 insertions, 19 deletions
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 53826b84e0ec..c647bd1b6903 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -646,6 +646,7 @@ void of_changeset_init(struct of_changeset *ocs)
646 memset(ocs, 0, sizeof(*ocs)); 646 memset(ocs, 0, sizeof(*ocs));
647 INIT_LIST_HEAD(&ocs->entries); 647 INIT_LIST_HEAD(&ocs->entries);
648} 648}
649EXPORT_SYMBOL_GPL(of_changeset_init);
649 650
650/** 651/**
651 * of_changeset_destroy - Destroy a changeset 652 * of_changeset_destroy - Destroy a changeset
@@ -662,20 +663,9 @@ void of_changeset_destroy(struct of_changeset *ocs)
662 list_for_each_entry_safe_reverse(ce, cen, &ocs->entries, node) 663 list_for_each_entry_safe_reverse(ce, cen, &ocs->entries, node)
663 __of_changeset_entry_destroy(ce); 664 __of_changeset_entry_destroy(ce);
664} 665}
666EXPORT_SYMBOL_GPL(of_changeset_destroy);
665 667
666/** 668int __of_changeset_apply(struct of_changeset *ocs)
667 * of_changeset_apply - Applies a changeset
668 *
669 * @ocs: changeset pointer
670 *
671 * Applies a changeset to the live tree.
672 * Any side-effects of live tree state changes are applied here on
673 * sucess, like creation/destruction of devices and side-effects
674 * like creation of sysfs properties and directories.
675 * Returns 0 on success, a negative error value in case of an error.
676 * On error the partially applied effects are reverted.
677 */
678int of_changeset_apply(struct of_changeset *ocs)
679{ 669{
680 struct of_changeset_entry *ce; 670 struct of_changeset_entry *ce;
681 int ret; 671 int ret;
@@ -704,17 +694,30 @@ int of_changeset_apply(struct of_changeset *ocs)
704} 694}
705 695
706/** 696/**
707 * of_changeset_revert - Reverts an applied changeset 697 * of_changeset_apply - Applies a changeset
708 * 698 *
709 * @ocs: changeset pointer 699 * @ocs: changeset pointer
710 * 700 *
711 * Reverts a changeset returning the state of the tree to what it 701 * Applies a changeset to the live tree.
712 * was before the application. 702 * Any side-effects of live tree state changes are applied here on
713 * Any side-effects like creation/destruction of devices and 703 * success, like creation/destruction of devices and side-effects
714 * removal of sysfs properties and directories are applied. 704 * like creation of sysfs properties and directories.
715 * Returns 0 on success, a negative error value in case of an error. 705 * Returns 0 on success, a negative error value in case of an error.
706 * On error the partially applied effects are reverted.
716 */ 707 */
717int of_changeset_revert(struct of_changeset *ocs) 708int of_changeset_apply(struct of_changeset *ocs)
709{
710 int ret;
711
712 mutex_lock(&of_mutex);
713 ret = __of_changeset_apply(ocs);
714 mutex_unlock(&of_mutex);
715
716 return ret;
717}
718EXPORT_SYMBOL_GPL(of_changeset_apply);
719
720int __of_changeset_revert(struct of_changeset *ocs)
718{ 721{
719 struct of_changeset_entry *ce; 722 struct of_changeset_entry *ce;
720 int ret; 723 int ret;
@@ -742,6 +745,29 @@ int of_changeset_revert(struct of_changeset *ocs)
742} 745}
743 746
744/** 747/**
748 * of_changeset_revert - Reverts an applied changeset
749 *
750 * @ocs: changeset pointer
751 *
752 * Reverts a changeset returning the state of the tree to what it
753 * was before the application.
754 * Any side-effects like creation/destruction of devices and
755 * removal of sysfs properties and directories are applied.
756 * Returns 0 on success, a negative error value in case of an error.
757 */
758int of_changeset_revert(struct of_changeset *ocs)
759{
760 int ret;
761
762 mutex_lock(&of_mutex);
763 ret = __of_changeset_revert(ocs);
764 mutex_unlock(&of_mutex);
765
766 return ret;
767}
768EXPORT_SYMBOL_GPL(of_changeset_revert);
769
770/**
745 * of_changeset_action - Perform a changeset action 771 * of_changeset_action - Perform a changeset action
746 * 772 *
747 * @ocs: changeset pointer 773 * @ocs: changeset pointer
@@ -779,3 +805,4 @@ int of_changeset_action(struct of_changeset *ocs, unsigned long action,
779 list_add_tail(&ce->node, &ocs->entries); 805 list_add_tail(&ce->node, &ocs->entries);
780 return 0; 806 return 0;
781} 807}
808EXPORT_SYMBOL_GPL(of_changeset_action);