9
0
Fork 0

of: partitions: pass struct cdev as argument

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>
This commit is contained in:
Sascha Hauer 2013-04-22 09:07:34 +02:00
parent 812dc942d5
commit 66cd90abe7
2 changed files with 8 additions and 8 deletions

View File

@ -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);
}

View File

@ -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;