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.
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;
--
2.47.1
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;
>
On 2024-12-28 09:43:41 Sat, 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.
>
> 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(-)
Looks good to me.
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Thanks,
-Mahesh.
>
> 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;
>
> --
> 2.47.1
>
>
--
Mahesh J Salgaonkar
Looks good to me. Did boot test and reading the /sys files works.
Linux-ci tests [0] are also good (the failing tests are broken from
some time, ignoring them):
[0]: https://github.com/adi-g15-ibm/linux-ci/actions?query=branch%3Atmp-test-branch-10962+branch%3Atmp-test-branch-26310+branch%3Atmp-test-branch-23431++
Tested-by: Aditya Gupta <adityagupta@ibm.com>
Thanks,
- Aditya G
On 24/12/28 09:43AM, 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.
>
> 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;
>
> --
> 2.47.1
>
Hi,
Please use this Tested-by instead of the previous one i sent:
Tested-by: Aditya Gupta <adityag@linux.ibm.com>
Thanks,
- Aditya G
On 02/01/25 11:07, Aditya Gupta wrote:
> Looks good to me. Did boot test and reading the /sys files works.
>
> Linux-ci tests [0] are also good (the failing tests are broken from
> some time, ignoring them):
>
> [0]: https://github.com/adi-g15-ibm/linux-ci/actions?query=branch%3Atmp-test-branch-10962+branch%3Atmp-test-branch-26310+branch%3Atmp-test-branch-23431++
>
> Tested-by: Aditya Gupta <adityagupta@ibm.com>
>
> Thanks,
> - Aditya G
>
> On 24/12/28 09:43AM, 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.
>>
>> 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;
>>
>> --
>> 2.47.1
>>
© 2016 - 2025 Red Hat, Inc.