Skip to content

Commit 699e7b8

Browse files
t-8chgregkh
authored andcommitted
sysfs: treewide: constify attribute callback of bin_attribute::llseek()
The llseek() callbacks should not modify the struct bin_attribute passed as argument. Enforce this by marking the argument as const. As there are not many callback implementers perform this change throughout the tree at once. Signed-off-by: Thomas Weißschuh <[email protected]> Acked-by: Krzysztof Wilczyński <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 94a20fb commit 699e7b8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/pci/pci-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ static const struct attribute_group pci_dev_config_attr_group = {
841841
static __maybe_unused loff_t
842842
pci_llseek_resource(struct file *filep,
843843
struct kobject *kobj __always_unused,
844-
struct bin_attribute *attr,
844+
const struct bin_attribute *attr,
845845
loff_t offset, int whence)
846846
{
847847
return fixed_size_llseek(filep, offset, whence, attr->size);

include/linux/sysfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ struct bin_attribute {
307307
char *, loff_t, size_t);
308308
ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
309309
char *, loff_t, size_t);
310-
loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
310+
loff_t (*llseek)(struct file *, struct kobject *, const struct bin_attribute *,
311311
loff_t, int);
312312
int (*mmap)(struct file *, struct kobject *, const struct bin_attribute *attr,
313313
struct vm_area_struct *vma);

0 commit comments

Comments
 (0)