diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2009-11-23 22:16:45 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2009-11-23 22:16:45 -0500 |
commit | 02af11b03fce3ddb264d7873d7a2e295e697938c (patch) | |
tree | 5118d53f2c28d128d23fbf1b2d79d9ec15e5b6ab /arch/microblaze/kernel | |
parent | 41f880091c15b039ffcc8b3d831656b81517a6d3 (diff) |
of: merge prom_{add,remove,modify}_property
Merge common code between PowerPC and MicroBlaze
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Tested-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/kernel')
-rw-r--r-- | arch/microblaze/kernel/prom.c | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c index 901d538c15ef..a38e3733a09c 100644 --- a/arch/microblaze/kernel/prom.c +++ b/arch/microblaze/kernel/prom.c | |||
@@ -606,119 +606,6 @@ out_unlock: | |||
606 | write_unlock_irqrestore(&devtree_lock, flags); | 606 | write_unlock_irqrestore(&devtree_lock, flags); |
607 | } | 607 | } |
608 | 608 | ||
609 | /* | ||
610 | * Add a property to a node | ||
611 | */ | ||
612 | int prom_add_property(struct device_node *np, struct property *prop) | ||
613 | { | ||
614 | struct property **next; | ||
615 | unsigned long flags; | ||
616 | |||
617 | prop->next = NULL; | ||
618 | write_lock_irqsave(&devtree_lock, flags); | ||
619 | next = &np->properties; | ||
620 | while (*next) { | ||
621 | if (strcmp(prop->name, (*next)->name) == 0) { | ||
622 | /* duplicate ! don't insert it */ | ||
623 | write_unlock_irqrestore(&devtree_lock, flags); | ||
624 | return -1; | ||
625 | } | ||
626 | next = &(*next)->next; | ||
627 | } | ||
628 | *next = prop; | ||
629 | write_unlock_irqrestore(&devtree_lock, flags); | ||
630 | |||
631 | #ifdef CONFIG_PROC_DEVICETREE | ||
632 | /* try to add to proc as well if it was initialized */ | ||
633 | if (np->pde) | ||
634 | proc_device_tree_add_prop(np->pde, prop); | ||
635 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
636 | |||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | /* | ||
641 | * Remove a property from a node. Note that we don't actually | ||
642 | * remove it, since we have given out who-knows-how-many pointers | ||
643 | * to the data using get-property. Instead we just move the property | ||
644 | * to the "dead properties" list, so it won't be found any more. | ||
645 | */ | ||
646 | int prom_remove_property(struct device_node *np, struct property *prop) | ||
647 | { | ||
648 | struct property **next; | ||
649 | unsigned long flags; | ||
650 | int found = 0; | ||
651 | |||
652 | write_lock_irqsave(&devtree_lock, flags); | ||
653 | next = &np->properties; | ||
654 | while (*next) { | ||
655 | if (*next == prop) { | ||
656 | /* found the node */ | ||
657 | *next = prop->next; | ||
658 | prop->next = np->deadprops; | ||
659 | np->deadprops = prop; | ||
660 | found = 1; | ||
661 | break; | ||
662 | } | ||
663 | next = &(*next)->next; | ||
664 | } | ||
665 | write_unlock_irqrestore(&devtree_lock, flags); | ||
666 | |||
667 | if (!found) | ||
668 | return -ENODEV; | ||
669 | |||
670 | #ifdef CONFIG_PROC_DEVICETREE | ||
671 | /* try to remove the proc node as well */ | ||
672 | if (np->pde) | ||
673 | proc_device_tree_remove_prop(np->pde, prop); | ||
674 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
675 | |||
676 | return 0; | ||
677 | } | ||
678 | |||
679 | /* | ||
680 | * Update a property in a node. Note that we don't actually | ||
681 | * remove it, since we have given out who-knows-how-many pointers | ||
682 | * to the data using get-property. Instead we just move the property | ||
683 | * to the "dead properties" list, and add the new property to the | ||
684 | * property list | ||
685 | */ | ||
686 | int prom_update_property(struct device_node *np, | ||
687 | struct property *newprop, | ||
688 | struct property *oldprop) | ||
689 | { | ||
690 | struct property **next; | ||
691 | unsigned long flags; | ||
692 | int found = 0; | ||
693 | |||
694 | write_lock_irqsave(&devtree_lock, flags); | ||
695 | next = &np->properties; | ||
696 | while (*next) { | ||
697 | if (*next == oldprop) { | ||
698 | /* found the node */ | ||
699 | newprop->next = oldprop->next; | ||
700 | *next = newprop; | ||
701 | oldprop->next = np->deadprops; | ||
702 | np->deadprops = oldprop; | ||
703 | found = 1; | ||
704 | break; | ||
705 | } | ||
706 | next = &(*next)->next; | ||
707 | } | ||
708 | write_unlock_irqrestore(&devtree_lock, flags); | ||
709 | |||
710 | if (!found) | ||
711 | return -ENODEV; | ||
712 | |||
713 | #ifdef CONFIG_PROC_DEVICETREE | ||
714 | /* try to add to proc as well if it was initialized */ | ||
715 | if (np->pde) | ||
716 | proc_device_tree_update_prop(np->pde, newprop, oldprop); | ||
717 | #endif /* CONFIG_PROC_DEVICETREE */ | ||
718 | |||
719 | return 0; | ||
720 | } | ||
721 | |||
722 | #if defined(CONFIG_DEBUG_FS) && defined(DEBUG) | 609 | #if defined(CONFIG_DEBUG_FS) && defined(DEBUG) |
723 | static struct debugfs_blob_wrapper flat_dt_blob; | 610 | static struct debugfs_blob_wrapper flat_dt_blob; |
724 | 611 | ||