From: Madhavan Srinivasan <maddy@linux.ibm.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
"Naveen N Rao" <naveen@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Luis Chamberlain" <mcgrof@kernel.org>,
"Petr Pavlu" <petr.pavlu@suse.com>,
"Sami Tolvanen" <samitolvanen@google.com>,
"Daniel Gomez" <da.gomez@samsung.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@fomichev.me>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
linux-modules@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v2 1/3] sysfs: constify bin_attribute argument of sysfs_bin_attr_simple_read()
Date: Mon, 6 Jan 2025 16:49:56 +0530 [thread overview]
Message-ID: <1fe2354e-3547-4000-80b7-1ed2b8e9fb4a@linux.ibm.com> (raw)
In-Reply-To: <20241228-sysfs-const-bin_attr-simple-v2-1-7c6f3f1767a3@weissschuh.net>
On 12/28/24 2:13 PM, Thomas Weißschuh wrote:
> Most users use this function through the BIN_ATTR_SIMPLE* macros,
> they can handle the switch transparently.
> Also adapt the two non-macro users in the same change.
Changes looks fine to me.
Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com>
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> arch/powerpc/platforms/powernv/opal.c | 2 +-
> fs/sysfs/file.c | 2 +-
> include/linux/sysfs.h | 4 ++--
> kernel/module/sysfs.c | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 5d0f35bb917ebced8c741cd3af2c511949a1d2ef..013637e2b2a8e6a4ec6b93a520f8d5d9d3245467 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -818,7 +818,7 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
> sysfs_bin_attr_init(attr);
> attr->attr.name = name;
> attr->attr.mode = 0400;
> - attr->read = sysfs_bin_attr_simple_read;
> + attr->read_new = sysfs_bin_attr_simple_read;
> attr->private = __va(vals[0]);
> attr->size = vals[1];
>
> diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
> index 785408861c01c89fc84c787848243a13c1338367..6931308876c4ac3b4c19878d5e1158ad8fe4f16f 100644
> --- a/fs/sysfs/file.c
> +++ b/fs/sysfs/file.c
> @@ -817,7 +817,7 @@ EXPORT_SYMBOL_GPL(sysfs_emit_at);
> * Returns number of bytes written to @buf.
> */
> ssize_t sysfs_bin_attr_simple_read(struct file *file, struct kobject *kobj,
> - struct bin_attribute *attr, char *buf,
> + const struct bin_attribute *attr, char *buf,
> loff_t off, size_t count)
> {
> memcpy(buf, attr->private + off, count);
> diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
> index 0f2fcd244523f050c5286f19d4fe1846506f9214..2205561159afdb57d0a250bb0439b28c01d9010e 100644
> --- a/include/linux/sysfs.h
> +++ b/include/linux/sysfs.h
> @@ -511,7 +511,7 @@ __printf(3, 4)
> int sysfs_emit_at(char *buf, int at, const char *fmt, ...);
>
> ssize_t sysfs_bin_attr_simple_read(struct file *file, struct kobject *kobj,
> - struct bin_attribute *attr, char *buf,
> + const struct bin_attribute *attr, char *buf,
> loff_t off, size_t count);
>
> #else /* CONFIG_SYSFS */
> @@ -774,7 +774,7 @@ static inline int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
>
> static inline ssize_t sysfs_bin_attr_simple_read(struct file *file,
> struct kobject *kobj,
> - struct bin_attribute *attr,
> + const struct bin_attribute *attr,
> char *buf, loff_t off,
> size_t count)
> {
> diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
> index 456358e1fdc43e6b5b24f383bbefa37812971174..254017b58b645d4afcf6876d29bcc2e2113a8dc4 100644
> --- a/kernel/module/sysfs.c
> +++ b/kernel/module/sysfs.c
> @@ -196,7 +196,7 @@ static int add_notes_attrs(struct module *mod, const struct load_info *info)
> nattr->attr.mode = 0444;
> nattr->size = info->sechdrs[i].sh_size;
> nattr->private = (void *)info->sechdrs[i].sh_addr;
> - nattr->read = sysfs_bin_attr_simple_read;
> + nattr->read_new = sysfs_bin_attr_simple_read;
> ++nattr;
> }
> ++loaded;
>
next prev parent reply other threads:[~2025-01-06 11:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-28 8:43 [PATCH v2 0/3] sysfs: constify bin_attribute argument of sysfs_bin_attr_simple_read() Thomas Weißschuh
2024-12-28 8:43 ` [PATCH v2 1/3] " Thomas Weißschuh
2025-01-02 5:37 ` Aditya Gupta
2025-01-02 5:41 ` Aditya Gupta
2025-01-03 8:55 ` Mahesh J Salgaonkar
2025-01-06 11:19 ` Madhavan Srinivasan [this message]
2024-12-28 8:43 ` [PATCH v2 2/3] btf: Switch vmlinux BTF attribute to sysfs_bin_attr_simple_read() Thomas Weißschuh
2024-12-28 8:43 ` [PATCH v2 3/3] btf: Switch module " Thomas Weißschuh
2024-12-31 0:50 ` [PATCH v2 0/3] sysfs: constify bin_attribute argument of sysfs_bin_attr_simple_read() Alexei Starovoitov
2024-12-31 10:30 ` Thomas Weißschuh
2025-01-08 17:45 ` Alexei Starovoitov
2025-01-09 7:56 ` Greg Kroah-Hartman
2025-01-09 8:06 ` Christoph Hellwig
2025-01-09 8:12 ` Greg Kroah-Hartman
2025-01-09 8:23 ` Christoph Hellwig
2025-01-10 14:02 ` Greg Kroah-Hartman
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=1fe2354e-3547-4000-80b7-1ed2b8e9fb4a@linux.ibm.com \
--to=maddy@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=da.gomez@samsung.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.lau@linux.dev \
--cc=mcgrof@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
--cc=petr.pavlu@suse.com \
--cc=rafael@kernel.org \
--cc=samitolvanen@google.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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;
as well as URLs for NNTP newsgroup(s).