From: Michael Bringmann <mwb@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
Thomas Falcon <tlfalcon@linux.vnet.ibm.com>,
Juliet Kim <minkim@us.ibm.com>
Subject: [RFC 2/6] pseries/drcinfo: Fix bug parsing ibm,drc-info
Date: Fri, 14 Dec 2018 14:50:42 -0600 [thread overview]
Message-ID: <20181214205031.16435.20276.stgit@powerkvm6.aus.stglabs.ibm.com> (raw)
In-Reply-To: <20181214204914.16435.59083.stgit@powerkvm6.aus.stglabs.ibm.com>
Replace use of of_prop_next_u32() in when parsing 'ibm,drc-info'
structure to simplify and reduce parsing code.
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Fixes: 3f38000eda48 ("powerpc/firmware: Add definitions for new drc-info firmware feature" -- end of patch series applied to powerpc next)
---
arch/powerpc/platforms/pseries/of_helpers.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/of_helpers.c b/arch/powerpc/platforms/pseries/of_helpers.c
index 6df192f..0185e50 100644
--- a/arch/powerpc/platforms/pseries/of_helpers.c
+++ b/arch/powerpc/platforms/pseries/of_helpers.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+
#include <linux/string.h>
#include <linux/err.h>
#include <linux/slab.h>
@@ -6,6 +7,9 @@
#include <asm/prom.h>
#include "of_helpers.h"
+#include "pseries.h"
+
+#define MAX_DRC_NAME_LEN 64
/**
* pseries_of_derive_parent - basically like dirname(1)
@@ -65,29 +69,19 @@ int of_read_drc_info_cell(struct property **prop, const __be32 **curval,
/* Get drc-index-start:encode-int */
p2 = (const __be32 *)p;
- p2 = of_prop_next_u32(*prop, p2, &data->drc_index_start);
- if (!p2)
- return -EINVAL;
+ data->drc_index_start = of_read_number(p2++, 1);
/* Get drc-name-suffix-start:encode-int */
- p2 = of_prop_next_u32(*prop, p2, &data->drc_name_suffix_start);
- if (!p2)
- return -EINVAL;
+ data->drc_name_suffix_start = of_read_number(p2++, 1);
/* Get number-sequential-elements:encode-int */
- p2 = of_prop_next_u32(*prop, p2, &data->num_sequential_elems);
- if (!p2)
- return -EINVAL;
+ data->num_sequential_elems = of_read_number(p2++, 1);
/* Get sequential-increment:encode-int */
- p2 = of_prop_next_u32(*prop, p2, &data->sequential_inc);
- if (!p2)
- return -EINVAL;
+ data->sequential_inc = of_read_number(p2++, 1);
/* Get drc-power-domain:encode-int */
- p2 = of_prop_next_u32(*prop, p2, &data->drc_power_domain);
- if (!p2)
- return -EINVAL;
+ data->drc_power_domain = of_read_number(p2++, 1);
/* Should now know end of current entry */
(*curval) = (void *)p2;
next prev parent reply other threads:[~2018-12-14 20:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-14 20:49 [RFC 0/6] powerpc/pseries: Refactor code to centralize drcinfo parsing Michael Bringmann
2018-12-14 20:50 ` [RFC 1/6] powerpc:/drc Define interface to acquire arch-specific drc info Michael Bringmann
2019-01-25 0:04 ` Tyrel Datwyler
2019-01-25 16:09 ` Michael Bringmann
2019-01-28 18:23 ` Michael Bringmann
2019-01-29 9:25 ` Michael Ellerman
2019-01-29 9:31 ` Michael Ellerman
2019-01-29 16:21 ` Michael Bringmann
2019-01-25 0:10 ` Tyrel Datwyler
2019-01-25 16:11 ` Michael Bringmann
2018-12-14 20:50 ` Michael Bringmann [this message]
2018-12-14 20:51 ` [RFC 3/6] pseries/drcinfo: Pseries impl of arch_find_drc_info Michael Bringmann
2019-01-25 0:04 ` Tyrel Datwyler
2019-01-25 16:10 ` Michael Bringmann
2018-12-14 20:51 ` [RFC 4/6] powerpc/pseries: Use common drcinfo parsing Michael Bringmann
2018-12-14 20:51 ` [RFC 5/6] powerpc/pci/hotplug: " Michael Bringmann
2019-01-15 0:28 ` Bjorn Helgaas
2019-01-22 19:58 ` Bjorn Helgaas
2019-01-25 0:29 ` Tyrel Datwyler
2019-01-25 16:12 ` Michael Bringmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181214205031.16435.20276.stgit@powerkvm6.aus.stglabs.ibm.com \
--to=mwb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=minkim@us.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=tlfalcon@linux.vnet.ibm.com \
--cc=tyreld@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).