[PATCH 3/8] rename cdev_open() -> cdev_open_name()

Sascha Hauer s.hauer at pengutronix.de
Mon Feb 7 01:49:48 PST 2022


The cdev_* functions normally take a struct cdev * argument, with the
exception of cdev_open(). Rename cdev_open() to cdev_open_name() to
be able to implement cdev_open() with the expected semantics in the next
step.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/mach-mxs/ocotp.c  | 2 +-
 arch/arm/mach-omap/xload.c | 4 ++--
 common/filetype.c          | 2 +-
 fs/devfs-core.c            | 2 +-
 fs/fs.c                    | 4 ++--
 include/driver.h           | 2 +-
 lib/bootstrap/devfs.c      | 4 ++--
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-mxs/ocotp.c b/arch/arm/mach-mxs/ocotp.c
index 5f78d9d773..466f8886cd 100644
--- a/arch/arm/mach-mxs/ocotp.c
+++ b/arch/arm/mach-mxs/ocotp.c
@@ -229,7 +229,7 @@ int mxs_ocotp_read(void *buf, int count, int offset)
 	struct cdev *cdev;
 	int ret;
 
-	cdev = cdev_open(DRIVERNAME, O_RDONLY);
+	cdev = cdev_open_name(DRIVERNAME, O_RDONLY);
 	if (!cdev)
 		return -ENODEV;
 
diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
index 0fe78883d1..edb094f36f 100644
--- a/arch/arm/mach-omap/xload.c
+++ b/arch/arm/mach-omap/xload.c
@@ -38,7 +38,7 @@ static void *read_image_head(const char *name)
 	struct cdev *cdev;
 	int ret;
 
-	cdev = cdev_open(name, O_RDONLY);
+	cdev = cdev_open_name(name, O_RDONLY);
 	if (!cdev) {
 		printf("failed to open %s\n", name);
 		return NULL;
@@ -86,7 +86,7 @@ static void *read_mtd_barebox(const char *partition)
 
 	to = xmalloc(size);
 
-	cdev = cdev_open(partition, O_RDONLY);
+	cdev = cdev_open_name(partition, O_RDONLY);
 	if (!cdev) {
 		printf("failed to open partition\n");
 		return NULL;
diff --git a/common/filetype.c b/common/filetype.c
index 8ffcd6adcd..a955d88bc3 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -438,7 +438,7 @@ enum filetype cdev_detect_type(const char *name)
 	struct cdev *cdev;
 	void *buf;
 
-	cdev = cdev_open(name, O_RDONLY);
+	cdev = cdev_open_name(name, O_RDONLY);
 	if (!cdev)
 		return type;
 
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 2475ab959a..6350c3fa8b 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -169,7 +169,7 @@ int cdev_find_free_index(const char *basename)
 	return -EBUSY;	/* all indexes are used */
 }
 
-struct cdev *cdev_open(const char *name, unsigned long flags)
+struct cdev *cdev_open_name(const char *name, unsigned long flags)
 {
 	struct cdev *cdev;
 	int ret;
diff --git a/fs/fs.c b/fs/fs.c
index 968e77b808..20362c3889 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -800,7 +800,7 @@ int fsdev_open_cdev(struct fs_device_d *fsdev)
 
 		fsdev->cdev = cdev_create_loop(fsdev->backingstore, O_RDWR, offset);
 	} else {
-		fsdev->cdev = cdev_open(fsdev->backingstore, O_RDWR);
+		fsdev->cdev = cdev_open_name(fsdev->backingstore, O_RDWR);
 	}
 	if (!fsdev->cdev) {
 		path_put(&path);
@@ -3048,7 +3048,7 @@ int umount(const char *pathname)
 	path_put(&path);
 
 	if (!fsdev) {
-		struct cdev *cdev = cdev_open(pathname, O_RDWR);
+		struct cdev *cdev = cdev_open_name(pathname, O_RDWR);
 
 		if (cdev) {
 			cdev_close(cdev);
diff --git a/include/driver.h b/include/driver.h
index 3ef8bfb8a3..b4fae477a6 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -489,7 +489,7 @@ struct cdev *cdev_readlink(struct cdev *cdev);
 struct cdev *cdev_by_device_node(struct device_node *node);
 struct cdev *cdev_by_partuuid(const char *partuuid);
 struct cdev *cdev_by_diskuuid(const char *partuuid);
-struct cdev *cdev_open(const char *name, unsigned long flags);
+struct cdev *cdev_open_name(const char *name, unsigned long flags);
 struct cdev *cdev_create_loop(const char *path, ulong flags, loff_t offset);
 void cdev_remove_loop(struct cdev *cdev);
 int cdev_do_open(struct cdev *, unsigned long flags);
diff --git a/lib/bootstrap/devfs.c b/lib/bootstrap/devfs.c
index 6d28b1cb4d..e26a3d831d 100644
--- a/lib/bootstrap/devfs.c
+++ b/lib/bootstrap/devfs.c
@@ -32,7 +32,7 @@ static void *read_image_head(const char *name)
 	struct cdev *cdev;
 	int ret;
 
-	cdev = cdev_open(name, O_RDONLY);
+	cdev = cdev_open_name(name, O_RDONLY);
 	if (!cdev) {
 		bootstrap_err("failed to open partition\n");
 		goto free_header;
@@ -124,7 +124,7 @@ void* bootstrap_read_devfs(char *devname, bool use_bb, int offset,
 
 	to = xmalloc(size);
 
-	cdev = cdev_open(partname, O_RDONLY);
+	cdev = cdev_open_name(partname, O_RDONLY);
 	if (!cdev) {
 		bootstrap_err("%s: failed to open %s\n", devname, partname);
 		goto free_memory;
-- 
2.30.2




More information about the barebox mailing list