Message ID | 20170828071803.9406-1-hegdevasant@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | [v2,1/5] hdata: Fix vpd parse | expand |
On Mon, Aug 28, 2017 at 12:47:59PM +0530, Vasant Hegde wrote: > We detect vpd data format in vpd_parse() and set "op_platform" variable. > dt_add_vpd_node() depends on op_platform to select parser type. > > There are places where we call dt_add_vpd_node() even before calling > vpd_parse(). And in such cases it will not parse vpd data properly. > > This patch fixes above issue. > > Fixes: 694546c1 (hdata/vpd: Parse the OpenPOWER OPFR record) > CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> > Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Vasant Hegde <hegdevasant@linux.vnet.ibm.com> writes: > We detect vpd data format in vpd_parse() and set "op_platform" variable. > dt_add_vpd_node() depends on op_platform to select parser type. > > There are places where we call dt_add_vpd_node() even before calling > vpd_parse(). And in such cases it will not parse vpd data properly. > > This patch fixes above issue. > > Fixes: 694546c1 (hdata/vpd: Parse the OpenPOWER OPFR record) > CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> > Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> I've taken patches 1-3 as of c6e9156379643afc45bef776b5a69b6e46b3dad1
diff --git a/hdata/vpd.c b/hdata/vpd.c index d7d57cd..0e23e29 100644 --- a/hdata/vpd.c +++ b/hdata/vpd.c @@ -23,8 +23,6 @@ #include "hdata.h" #include <inttypes.h> -static bool op_platform; - struct card_info { const char *ccin; /* Customer card identification number */ const char *description; @@ -492,7 +490,7 @@ struct dt_node *dt_add_vpd_node(const struct HDIF_common_hdr *hdr, && !dt_find_property(node, "ibm,vpd")) { dt_add_property(node, "ibm,vpd", fruvpd, fruvpd_sz); - if (op_platform) + if (vpd_find_record(fruvpd, fruvpd_sz, "OPFR", NULL)) vpd_opfr_parse(node, fruvpd, fruvpd_sz); else vpd_vini_parse(node, fruvpd, fruvpd_sz); @@ -607,10 +605,9 @@ static void sysvpd_parse(void) } /* Look for the new OpenPower "OSYS" first */ - if (vpd_find_record(sysvpd, sysvpd_sz, "OSYS", NULL)) { - op_platform = true; + if (vpd_find_record(sysvpd, sysvpd_sz, "OSYS", NULL)) sysvpd_parse_opp(sysvpd, sysvpd_sz); - } else + else sysvpd_parse_legacy(sysvpd, sysvpd_sz); dt_add_model_name();
We detect vpd data format in vpd_parse() and set "op_platform" variable. dt_add_vpd_node() depends on op_platform to select parser type. There are places where we call dt_add_vpd_node() even before calling vpd_parse(). And in such cases it will not parse vpd data properly. This patch fixes above issue. Fixes: 694546c1 (hdata/vpd: Parse the OpenPOWER OPFR record) CC: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> --- hdata/vpd.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)