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 4/8] cdev: implement cdev_open()
Date: Mon, 7 Feb 2022 11:46:14 +0100 [thread overview]
Message-ID: <385c4354-2b54-120f-53d2-9f027b3bcfa1@pengutronix.de> (raw)
In-Reply-To: <20220207094953.949868-4-s.hauer@pengutronix.de>
On 07.02.22 10:49, Sascha Hauer wrote:
> Implement cdev_open() with the expected semantics that takes a struct
> cdev * argument. We already have an unimplemented prototype
> cdev_do_open(), remove this.
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> 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);
--
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
next prev parent reply other threads:[~2022-02-07 10:47 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
2022-02-07 9:49 ` [PATCH 4/8] cdev: implement cdev_open() Sascha Hauer
2022-02-07 10:46 ` Ahmad Fatoum [this message]
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=385c4354-2b54-120f-53d2-9f027b3bcfa1@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