[PATCH 17/18] cdev: constify cdev_readlink argument

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Apr 13 23:31:51 PDT 2025


For use in functions that accept a const cdev, have cdev_readlink take a
const cdev as well.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 fs/devfs-core.c  | 4 ++--
 include/driver.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index eb6691b5252b..d1e4e1f0f6b5 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -50,7 +50,7 @@ int devfs_partition_complete(struct string_list *sl, char *instr)
 }
 #endif
 
-struct cdev *cdev_readlink(struct cdev *cdev)
+struct cdev *cdev_readlink(const struct cdev *cdev)
 {
 	if (!cdev)
 		return NULL;
@@ -61,7 +61,7 @@ struct cdev *cdev_readlink(struct cdev *cdev)
 	/* links to links are not allowed */
 	BUG_ON(cdev->link);
 
-	return cdev;
+	return (void *)cdev;
 }
 
 struct cdev *lcdev_by_name(const char *filename)
diff --git a/include/driver.h b/include/driver.h
index ca002c5164c2..d73c33a42a81 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -506,7 +506,7 @@ int cdev_find_free_index(const char *);
 struct cdev *cdev_find_partition(struct cdev *cdevm, const char *name);
 struct cdev *device_find_partition(struct device *dev, const char *name);
 struct cdev *lcdev_by_name(const char *filename);
-struct cdev *cdev_readlink(struct cdev *cdev);
+struct cdev *cdev_readlink(const 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);
-- 
2.39.5




More information about the barebox mailing list