mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	Barebox List <barebox@lists.infradead.org>
Cc: Michael Olbrich <mol@pengutronix.de>
Subject: Re: [PATCH 3/8] rename cdev_open() -> cdev_open_name()
Date: Mon, 7 Feb 2022 11:43:59 +0100	[thread overview]
Message-ID: <ea3c5d85-d751-d09f-41a1-192782b34afb@pengutronix.de> (raw)
In-Reply-To: <20220207094953.949868-3-s.hauer@pengutronix.de>

On 07.02.22 10:49, Sascha Hauer wrote:
> 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.

Nitpick: cdev_open_by_name would align it more with the naming style
elsewhere in barebox.

Otherwise,

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

> 
> Signed-off-by: Sascha Hauer <s.hauer@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;


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

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-02-07 10:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07  9:49 [PATCH 1/8] cdev: rename partuuid to uuid Sascha Hauer
2022-02-07  9:49 ` [PATCH 2/8] cdev: add diskuuid support Sascha Hauer
2022-02-07  9:49 ` [PATCH 3/8] rename cdev_open() -> cdev_open_name() Sascha Hauer
2022-02-07 10:43   ` Ahmad Fatoum [this message]
2022-02-07  9:49 ` [PATCH 4/8] cdev: implement cdev_open() Sascha Hauer
2022-02-07 10:46   ` Ahmad Fatoum
2022-02-07  9:49 ` [PATCH 5/8] driver: Add functions to free devices Sascha Hauer
2022-02-07  9:49 ` [PATCH 6/8] cdev: Create missing cdev_* functions Sascha Hauer
2022-02-07  9:49 ` [PATCH 7/8] cdev: create iterator for cdev list Sascha Hauer
2022-02-07  9:49 ` [PATCH 8/8] misc: Add storage-by-uuid driver Sascha Hauer
2022-02-07  9:52   ` Sascha Hauer
2022-02-07 10:59   ` [PATCH] efi: probe devices from the device-tree Michael Olbrich
2022-02-08  9:29   ` [PATCH 8/8] misc: Add storage-by-uuid driver Michael Olbrich
2022-02-08 12:27     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea3c5d85-d751-d09f-41a1-192782b34afb@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mol@pengutronix.de \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox