devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Walle <michael@walle.cc>
To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Michael Walle <michael@walle.cc>
Subject: [PATCH 2/3] of: property: use unsigned index for of_link_property()
Date: Thu, 13 Jan 2022 09:52:07 +0100	[thread overview]
Message-ID: <20220113085208.2636517-3-michael@walle.cc> (raw)
In-Reply-To: <20220113085208.2636517-1-michael@walle.cc>

Now that of_parse_handle() and its variants take an unsigned int,
convert the index used in of_link_property() and its called functions
to unsigned too.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 drivers/of/property.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/of/property.c b/drivers/of/property.c
index 8e90071de6ed..e77fb6cda0b7 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1173,7 +1173,8 @@ static int of_link_to_phandle(struct device_node *con_np,
  * - NULL if no phandle found at index
  */
 static struct device_node *parse_prop_cells(struct device_node *np,
-					    const char *prop_name, int index,
+					    const char *prop_name,
+					    unsigned int index,
 					    const char *list_name,
 					    const char *cells_name)
 {
@@ -1191,7 +1192,8 @@ static struct device_node *parse_prop_cells(struct device_node *np,
 
 #define DEFINE_SIMPLE_PROP(fname, name, cells)				  \
 static struct device_node *parse_##fname(struct device_node *np,	  \
-					const char *prop_name, int index) \
+					 const char *prop_name,		  \
+					 unsigned int index)		  \
 {									  \
 	return parse_prop_cells(np, prop_name, index, name, cells);	  \
 }
@@ -1227,7 +1229,8 @@ static int strcmp_suffix(const char *str, const char *suffix)
  * - NULL if no phandle found at index
  */
 static struct device_node *parse_suffix_prop_cells(struct device_node *np,
-					    const char *prop_name, int index,
+					    const char *prop_name,
+					    unsigned int index,
 					    const char *suffix,
 					    const char *cells_name)
 {
@@ -1245,7 +1248,8 @@ static struct device_node *parse_suffix_prop_cells(struct device_node *np,
 
 #define DEFINE_SUFFIX_PROP(fname, suffix, cells)			     \
 static struct device_node *parse_##fname(struct device_node *np,	     \
-					const char *prop_name, int index)    \
+					 const char *prop_name,		     \
+					 unsigned int index)		     \
 {									     \
 	return parse_suffix_prop_cells(np, prop_name, index, suffix, cells); \
 }
@@ -1272,7 +1276,8 @@ static struct device_node *parse_##fname(struct device_node *np,	     \
  */
 struct supplier_bindings {
 	struct device_node *(*parse_prop)(struct device_node *np,
-					  const char *prop_name, int index);
+					  const char *prop_name,
+					  unsigned int index);
 	bool optional;
 	bool node_not_dev;
 };
@@ -1308,7 +1313,8 @@ DEFINE_SUFFIX_PROP(regulators, "-supply", NULL)
 DEFINE_SUFFIX_PROP(gpio, "-gpio", "#gpio-cells")
 
 static struct device_node *parse_gpios(struct device_node *np,
-				       const char *prop_name, int index)
+				       const char *prop_name,
+				       unsigned int index)
 {
 	if (!strcmp_suffix(prop_name, ",nr-gpios"))
 		return NULL;
@@ -1318,7 +1324,8 @@ static struct device_node *parse_gpios(struct device_node *np,
 }
 
 static struct device_node *parse_iommu_maps(struct device_node *np,
-					    const char *prop_name, int index)
+					    const char *prop_name,
+					    unsigned int index)
 {
 	if (strcmp(prop_name, "iommu-map"))
 		return NULL;
@@ -1327,7 +1334,8 @@ static struct device_node *parse_iommu_maps(struct device_node *np,
 }
 
 static struct device_node *parse_gpio_compat(struct device_node *np,
-					     const char *prop_name, int index)
+					     const char *prop_name,
+					     unsigned int index)
 {
 	struct of_phandle_args sup_args;
 
@@ -1349,7 +1357,8 @@ static struct device_node *parse_gpio_compat(struct device_node *np,
 }
 
 static struct device_node *parse_interrupts(struct device_node *np,
-					    const char *prop_name, int index)
+					    const char *prop_name,
+					    unsigned int index)
 {
 	struct of_phandle_args sup_args;
 
-- 
2.30.2


  parent reply	other threads:[~2022-01-13  8:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  8:52 [PATCH 0/3] of: base: of_parse_phandle() fixes and new variant Michael Walle
2022-01-13  8:52 ` [PATCH 1/3] of: base: convert index to unsigned for of_parse_phandle() Michael Walle
2022-01-14  2:29   ` Rob Herring
2022-01-13  8:52 ` Michael Walle [this message]
2022-01-13  8:52 ` [PATCH 3/3] of: base: add of_parse_phandle_with_optional_args() Michael Walle
2022-01-13 12:22 ` [PATCH 0/3] of: base: of_parse_phandle() fixes and new variant Michael Walle
2022-01-14  2:30   ` Rob Herring

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=20220113085208.2636517-3-michael@walle.cc \
    --to=michael@walle.cc \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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).