[PATCH v2 01/13] fs: devfs-core: add devfs_create_link_node()

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Dec 15 03:14:45 PST 2025



On 12/9/25 1:51 PM, Sascha Hauer wrote:
> Allow to create a devfs link that not only has its own name, but also
> its own device_node.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

> ---
>  fs/devfs-core.c  | 8 +++++++-
>  include/driver.h | 2 ++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/devfs-core.c b/fs/devfs-core.c
> index 92e7c5823ed0d3a4c54cc7b2b1c9bf32ac535907..91082265d1aaa965160de5e414364e3fb14824d1 100644
> --- a/fs/devfs-core.c
> +++ b/fs/devfs-core.c
> @@ -476,7 +476,7 @@ int devfs_create(struct cdev *new)
>  	return 0;
>  }
>  
> -int devfs_create_link(struct cdev *cdev, const char *name)
> +int devfs_create_link_node(struct cdev *cdev, const char *name, struct device_node *node)
>  {
>  	struct cdev *new;
>  	int ret;
> @@ -489,6 +489,7 @@ int devfs_create_link(struct cdev *cdev, const char *name)
>  
>  	new = cdev_alloc(name);
>  	new->link = cdev;
> +	new->device_node = node;
>  
>  	ret = devfs_create(new);
>  	if (ret) {
> @@ -512,6 +513,11 @@ int devfs_create_link(struct cdev *cdev, const char *name)
>  	return 0;
>  }
>  
> +int devfs_create_link(struct cdev *cdev, const char *name)
> +{
> +	return devfs_create_link_node(cdev, name, NULL);
> +}
> +
>  int devfs_remove(struct cdev *cdev)
>  {
>  	struct cdev *c, *tmp;
> diff --git a/include/driver.h b/include/driver.h
> index c130a3cd63fd5e6dc365a33c765a22dc4e2ca90a..e0fddecd085c991db4f1fe34c56405d28b6f53ad 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -461,6 +461,8 @@ static inline const char *cdev_name(struct cdev *cdev)
>  
>  int devfs_create(struct cdev *);
>  int devfs_create_link(struct cdev *, const char *name);
> +int devfs_create_link_node(struct cdev *cdev, const char *name,
> +			   struct device_node *node);
>  int devfs_remove(struct cdev *);
>  int cdev_find_free_index(const char *);
>  struct cdev *cdev_find_partition(struct cdev *cdevm, const char *name);
> 

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




More information about the barebox mailing list