diff mbox series

[v2,2/5] hdata: Make vpd data parsing function global

Message ID 20170828071803.9406-2-hegdevasant@linux.vnet.ibm.com
State Accepted
Headers show
Series [v2,1/5] hdata: Fix vpd parse | expand

Commit Message

Vasant Hegde Aug. 28, 2017, 7:18 a.m. UTC
Move VPD parsing code to separate function (vpd_data_parse())
and make it as global. So that we can call this function from
other files.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
 hdata/hdata.h |  2 ++
 hdata/vpd.c   | 14 +++++++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

Comments

Ananth N Mavinakayanahalli Aug. 28, 2017, 8:08 a.m. UTC | #1
On Mon, Aug 28, 2017 at 12:48:00PM +0530, Vasant Hegde wrote:
> Move VPD parsing code to separate function (vpd_data_parse())
> and make it as global. So that we can call this function from
> other files.
> 
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>

Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
diff mbox series

Patch

diff --git a/hdata/hdata.h b/hdata/hdata.h
index 6da9b55..cab0626 100644
--- a/hdata/hdata.h
+++ b/hdata/hdata.h
@@ -30,6 +30,8 @@  extern void io_parse(void);
 extern struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 				       int indx_fru, int indx_vpd);
 extern void vpd_parse(void);
+extern void vpd_data_parse(struct dt_node *node,
+			   const void *fruvpd, u32 fruvpd_sz);
 
 extern struct dt_node *find_xscom_for_chip(uint32_t chip_id);
 extern uint32_t pcid_to_chip_id(uint32_t proc_chip_id);
diff --git a/hdata/vpd.c b/hdata/vpd.c
index 0e23e29..836869a 100644
--- a/hdata/vpd.c
+++ b/hdata/vpd.c
@@ -413,6 +413,14 @@  static struct dt_node *dt_create_vpd_node(struct dt_node *parent,
 	return node;
 }
 
+void vpd_data_parse(struct dt_node *node, const void *fruvpd, u32 fruvpd_sz)
+{
+	if (vpd_find_record(fruvpd, fruvpd_sz, "OPFR", NULL))
+		vpd_opfr_parse(node, fruvpd, fruvpd_sz);
+	else
+		vpd_vini_parse(node, fruvpd, fruvpd_sz);
+}
+
 struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 				int indx_fru, int indx_vpd)
 {
@@ -489,11 +497,7 @@  struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr,
 	if (vpd_valid(fruvpd, fruvpd_sz)
 	    && !dt_find_property(node, "ibm,vpd")) {
 		dt_add_property(node, "ibm,vpd", fruvpd, fruvpd_sz);
-
-		if (vpd_find_record(fruvpd, fruvpd_sz, "OPFR", NULL))
-			vpd_opfr_parse(node, fruvpd, fruvpd_sz);
-		else
-			vpd_vini_parse(node, fruvpd, fruvpd_sz);
+		vpd_data_parse(node, fruvpd, fruvpd_sz);
 	}
 
 	return node;