Implement cdev_open() with the expected semantics that takes a struct cdev * argument. We already have an unimplemented prototype cdev_do_open(), remove this. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- fs/devfs-core.c | 16 +++++++++++----- include/driver.h | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/devfs-core.c b/fs/devfs-core.c index 6350c3fa8b..dd6a9585bc 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -169,6 +169,14 @@ int cdev_find_free_index(const char *basename) return -EBUSY; /* all indexes are used */ } +int cdev_open(struct cdev *cdev, unsigned long flags) +{ + if (cdev->ops->open) + return cdev->ops->open(cdev, flags); + + return 0; +} + struct cdev *cdev_open_name(const char *name, unsigned long flags) { struct cdev *cdev; @@ -178,11 +186,9 @@ struct cdev *cdev_open_name(const char *name, unsigned long flags) if (!cdev) return NULL; - if (cdev->ops->open) { - ret = cdev->ops->open(cdev, flags); - if (ret) - return NULL; - } + ret = cdev_open(cdev, flags); + if (ret) + return NULL; return cdev; } diff --git a/include/driver.h b/include/driver.h index b4fae477a6..4f97b943c8 100644 --- a/include/driver.h +++ b/include/driver.h @@ -492,7 +492,7 @@ struct cdev *cdev_by_diskuuid(const char *partuuid); 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); +int cdev_open(struct cdev *, unsigned long flags); void cdev_close(struct cdev *cdev); int cdev_flush(struct cdev *cdev); ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags); -- 2.30.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox