mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-04-13 09:59:31 +00:00
sysfs: constify bin_attribute argument of sysfs_bin_attr_simple_read()
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> Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com> Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com> Tested-by: Aditya Gupta <adityag@linux.ibm.com> Link: https://lore.kernel.org/r/20241228-sysfs-const-bin_attr-simple-v2-1-7c6f3f1767a3@weissschuh.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
92d6254f58
commit
3675a926fe
4 changed files with 5 additions and 5 deletions
|
@ -818,7 +818,7 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
|
||||||
sysfs_bin_attr_init(attr);
|
sysfs_bin_attr_init(attr);
|
||||||
attr->attr.name = name;
|
attr->attr.name = name;
|
||||||
attr->attr.mode = 0400;
|
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->private = __va(vals[0]);
|
||||||
attr->size = vals[1];
|
attr->size = vals[1];
|
||||||
|
|
||||||
|
|
|
@ -817,7 +817,7 @@ EXPORT_SYMBOL_GPL(sysfs_emit_at);
|
||||||
* Returns number of bytes written to @buf.
|
* Returns number of bytes written to @buf.
|
||||||
*/
|
*/
|
||||||
ssize_t sysfs_bin_attr_simple_read(struct file *file, struct kobject *kobj,
|
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)
|
loff_t off, size_t count)
|
||||||
{
|
{
|
||||||
memcpy(buf, attr->private + off, count);
|
memcpy(buf, attr->private + off, count);
|
||||||
|
|
|
@ -511,7 +511,7 @@ __printf(3, 4)
|
||||||
int sysfs_emit_at(char *buf, int at, const char *fmt, ...);
|
int sysfs_emit_at(char *buf, int at, const char *fmt, ...);
|
||||||
|
|
||||||
ssize_t sysfs_bin_attr_simple_read(struct file *file, struct kobject *kobj,
|
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);
|
loff_t off, size_t count);
|
||||||
|
|
||||||
#else /* CONFIG_SYSFS */
|
#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,
|
static inline ssize_t sysfs_bin_attr_simple_read(struct file *file,
|
||||||
struct kobject *kobj,
|
struct kobject *kobj,
|
||||||
struct bin_attribute *attr,
|
const struct bin_attribute *attr,
|
||||||
char *buf, loff_t off,
|
char *buf, loff_t off,
|
||||||
size_t count)
|
size_t count)
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,7 +196,7 @@ static int add_notes_attrs(struct module *mod, const struct load_info *info)
|
||||||
nattr->attr.mode = 0444;
|
nattr->attr.mode = 0444;
|
||||||
nattr->size = info->sechdrs[i].sh_size;
|
nattr->size = info->sechdrs[i].sh_size;
|
||||||
nattr->private = (void *)info->sechdrs[i].sh_addr;
|
nattr->private = (void *)info->sechdrs[i].sh_addr;
|
||||||
nattr->read = sysfs_bin_attr_simple_read;
|
nattr->read_new = sysfs_bin_attr_simple_read;
|
||||||
++nattr;
|
++nattr;
|
||||||
}
|
}
|
||||||
++loaded;
|
++loaded;
|
||||||
|
|
Loading…
Add table
Reference in a new issue