[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YcA4Zrg0qSqYaVL6@kroah.com>
Date: Mon, 20 Dec 2021 09:01:42 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Rafał Miłecki <zajec5@...il.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Jonathan Corbet <corbet@....net>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Dan Williams <dan.j.williams@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Krzysztof Wilczyński <kw@...ux.com>,
Heiner Kallweit <hkallweit1@...il.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Rafał Miłecki <rafal@...ecki.pl>
Subject: Re: [PATCH 1/2] sysfs: add sysfs_add_bin_file_to_group()
On Mon, Dec 20, 2021 at 07:47:29AM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@...ecki.pl>
>
> There already is sysfs_add_file_to_group() for adding "attribute" to a
> group. This new function allows adding "bin_attribute" as well.
>
> Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
> ---
> fs/sysfs/file.c | 31 +++++++++++++++++++++++++++----
> include/linux/sysfs.h | 3 +++
> 2 files changed, 30 insertions(+), 4 deletions(-)
>
> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 42dcf96881b6..30c798c38d89 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -376,14 +376,19 @@ EXPORT_SYMBOL_GPL(sysfs_create_files);
> * @attr: attribute descriptor.
> * @group: group name.
> */
> -int sysfs_add_file_to_group(struct kobject *kobj,
> - const struct attribute *attr, const char *group)
> +int __sysfs_add_file_to_group(struct kobject *kobj,
> + const struct attribute *attr,
> + const struct bin_attribute *battr,
> + const char *group)
> {
> struct kernfs_node *parent;
> kuid_t uid;
> kgid_t gid;
> int error;
>
> + if (WARN_ON((attr && battr) || (!attr && !battr)))
> + return -EINVAL;
How can this ever happen?
Powered by blists - more mailing lists