linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3 v2] powerpc/powernv: Merge common platform device initialisation
@ 2015-05-20  3:23 Jeremy Kerr
  2015-05-20  3:23 ` [PATCH 3/3 v2] powerpc/powernv: Add opal-prd channel Jeremy Kerr
  2015-05-20  3:23 ` [PATCH 2/3 v2] powerpc/powernv: Expose OPAL APIs required by PRD interface Jeremy Kerr
  0 siblings, 2 replies; 8+ messages in thread
From: Jeremy Kerr @ 2015-05-20  3:23 UTC (permalink / raw)
  To: linuxppc-dev

opal_ipmi_init and opal_flash_init are equivalent, except for the
compatbile string. Merge these two into a common opal_pdev_init
function.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

---
 arch/powerpc/platforms/powernv/opal.c |   21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 2241565..b03ac9e 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -693,21 +693,13 @@ static void __init opal_dump_region_init(void)
 			"rc = %d\n", rc);
 }
 
-static void opal_flash_init(struct device_node *opal_node)
+static void opal_pdev_init(struct device_node *opal_node,
+		const char *compatible)
 {
 	struct device_node *np;
 
 	for_each_child_of_node(opal_node, np)
-		if (of_device_is_compatible(np, "ibm,opal-flash"))
-			of_platform_device_create(np, NULL, NULL);
-}
-
-static void opal_ipmi_init(struct device_node *opal_node)
-{
-	struct device_node *np;
-
-	for_each_child_of_node(opal_node, np)
-		if (of_device_is_compatible(np, "ibm,opal-ipmi"))
+		if (of_device_is_compatible(np, compatible))
 			of_platform_device_create(np, NULL, NULL);
 }
 
@@ -835,10 +827,9 @@ static int __init opal_init(void)
 		opal_msglog_init();
 	}
 
-	/* Initialize OPAL IPMI backend */
-	opal_ipmi_init(opal_node);
-
-	opal_flash_init(opal_node);
+	/* Initialize platform devices: IPMI backend & flash interface */
+	opal_pdev_init(opal_node, "ibm,opal-ipmi");
+	opal_pdev_init(opal_node, "ibm,opal-flash");
 
 	return 0;
 }

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-04 14:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20  3:23 [PATCH 1/3 v2] powerpc/powernv: Merge common platform device initialisation Jeremy Kerr
2015-05-20  3:23 ` [PATCH 3/3 v2] powerpc/powernv: Add opal-prd channel Jeremy Kerr
2015-05-22  2:18   ` Stewart Smith
2015-05-29  3:55   ` [PATCH 3/3 v3] " Jeremy Kerr
2015-06-04 11:31     ` [3/3,v3] " Michael Ellerman
2015-06-04 14:04       ` Jeremy Kerr
2015-06-04 13:51     ` [PATCH 3/3 v4] " Jeremy Kerr
2015-05-20  3:23 ` [PATCH 2/3 v2] powerpc/powernv: Expose OPAL APIs required by PRD interface Jeremy Kerr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).