mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/6] of: partitions: pass struct cdev as argument
Date: Mon, 22 Apr 2013 09:27:22 +0200	[thread overview]
Message-ID: <1366615643-22213-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1366615643-22213-1-git-send-email-s.hauer@pengutronix.de>

pass a struct cdev instead of the cdev name to of_parse_partitions.
This is available to the caller anyway and makes it easier to use
additional stuff from the cdev (like knowing whether it's a mtd
device).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/partition.c | 9 ++++-----
 include/of.h           | 7 ++++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index 6a57a60..a78466b 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -22,8 +22,7 @@
 #include <malloc.h>
 #include <linux/mtd/mtd.h>
 
-int of_parse_partitions(const char *cdevname,
-				   struct device_node *node)
+int of_parse_partitions(struct cdev *cdev, struct device_node *node)
 {
 	struct device_node *n;
 	const char *partname;
@@ -48,14 +47,14 @@ int of_parse_partitions(const char *cdevname,
 			partname = of_get_property(n, "name", &len);
 		name = (char *)partname;
 
-		debug("add partition: %s.%s 0x%08lx 0x%08lx\n", cdevname, partname, offset, size);
+		debug("add partition: %s.%s 0x%08lx 0x%08lx\n", cdev->name, partname, offset, size);
 
 		if (of_get_property(n, "read-only", &len))
 			flags = DEVFS_PARTITION_READONLY;
 
-		filename = asprintf("%s.%s", cdevname, partname);
+		filename = asprintf("%s.%s", cdev->name, partname);
 
-		devfs_add_partition(cdevname, offset, size, flags, filename);
+		devfs_add_partition(cdev->name, offset, size, flags, filename);
 
 		free(filename);
 	}
diff --git a/include/of.h b/include/of.h
index 9349e6a..4dcf37e 100644
--- a/include/of.h
+++ b/include/of.h
@@ -170,9 +170,10 @@ struct device_node *of_create_node(struct device_node *root, const char *path);
 struct device_node *of_get_root_node(void);
 int of_set_root_node(struct device_node *);
 
+struct cdev;
+
 #ifdef CONFIG_OFTREE
-int of_parse_partitions(const char *cdevname,
-			    struct device_node *node);
+int of_parse_partitions(struct cdev *cdev, struct device_node *node);
 
 int of_alias_get_id(struct device_node *np, const char *stem);
 int of_device_is_stdout_path(struct device_d *dev);
@@ -180,7 +181,7 @@ const char *of_get_model(void);
 void *of_flatten_dtb(struct device_node *node);
 int of_add_memory(struct device_node *node, bool dump);
 #else
-static inline int of_parse_partitions(const char *cdevname,
+static inline int of_parse_partitions(struct cdev *cdev,
 					  struct device_node *node)
 {
 	return -EINVAL;
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-04-22  7:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22  7:27 [PATCH] devicetree patches Sascha Hauer
2013-04-22  7:27 ` [PATCH 1/6] of: parse phandles before probing devices Sascha Hauer
2013-04-22  7:27 ` [PATCH 2/6] of: Add of_property_read_string_index() Sascha Hauer
2013-04-22  7:27 ` [PATCH 3/6] of: Allow multiple resources in 'reg' property Sascha Hauer
2013-04-22  7:27 ` [PATCH 4/6] of: read resource names from devicetree Sascha Hauer
2013-04-22  7:27 ` Sascha Hauer [this message]
2013-04-22  7:27 ` [PATCH 6/6] of: partitions: create bb device for nand flashes Sascha Hauer

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=1366615643-22213-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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