On Wed, Jan 03, 2024 at 11:16:26AM +0100, Ahmad Fatoum wrote: > __devfs_add_partition was added, so it can internally be used by > functions that already have a cdev and don't require looking it up first > by file path. This is useful elsewhere as well, so give it a less > internal-sounding name and start exporting it. > > Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> > --- > fs/devfs-core.c | 6 +++--- > include/driver.h | 3 +++ > 2 files changed, 6 insertions(+), 3 deletions(-) > > diff --git a/fs/devfs-core.c b/fs/devfs-core.c > index 6abf5eacc8dd..912bfeede8dc 100644 > --- a/fs/devfs-core.c > +++ b/fs/devfs-core.c > @@ -474,7 +474,7 @@ static struct cdev *check_overlap(struct cdev *cdev, > const char *name, loff_t of > return ret ? ERR_PTR(ret) : cpart; > } > > -static struct cdev *__devfs_add_partition(struct cdev *cdev, > +struct cdev *cdevfs_add_partition(struct cdev *cdev, > const struct devfs_partition *partinfo, loff_t *end)
Now that this function is exported the @end deserves a comment that tells what it's good for. Alternatively, as the new users doesn't seem to make use of this parameter, you could keep __devfs_add_partition static call it from an exported wrapper function that passes NULL as @end. Sascha > { > loff_t offset, size; > @@ -572,7 +572,7 @@ struct cdev *devfs_add_partition(const char *devname, > loff_t offset, > if (!cdev) > return ERR_PTR(-ENOENT); > > - return __devfs_add_partition(cdev, &partinfo, NULL); > + return cdevfs_add_partition(cdev, &partinfo, NULL); > } > > int devfs_del_partition(const char *name) > @@ -618,7 +618,7 @@ int devfs_create_partitions(const char *devname, > for (; partinfo->name; ++partinfo) { > struct cdev *new; > > - new = __devfs_add_partition(cdev, partinfo, &offset); > + new = cdevfs_add_partition(cdev, partinfo, &offset); > if (IS_ERR(new)) > return PTR_ERR(new); > > diff --git a/include/driver.h b/include/driver.h > index 0e3d5635e4c1..373c4f1d0bca 100644 > --- a/include/driver.h > +++ b/include/driver.h > @@ -681,6 +681,9 @@ struct cdev *devfs_add_partition(const char *devname, > loff_t offset, > loff_t size, unsigned int flags, const char *name); > int devfs_del_partition(const char *name); > > +struct cdev *cdevfs_add_partition(struct cdev *cdev, > + const struct devfs_partition *partinfo, loff_t *end); > + > #define of_match_ptr(compat) \ > IS_ENABLED(CONFIG_OFDEVICE) ? (compat) : NULL > > -- > 2.39.2 > > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |