Skip to content

Commit 62e877b

Browse files
sfrothwellgregkh
authored andcommitted
sysfs: fix for thinko with sysfs_bin_attr_init()
After merging the final tree, today's linux-next build (powerpc allyesconfig) failed like this: drivers/pci/pci-sysfs.c: In function 'pci_create_legacy_files': drivers/pci/pci-sysfs.c:645: error: lvalue required as unary '&' operand drivers/pci/pci-sysfs.c:658: error: lvalue required as unary '&' operand Caused by commit "sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on dynamic attributes" interacting with commit "sysfs: Use one lockdep class per sysfs attribute") both from the driver-core tree. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 0f4288e commit 62e877b

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/pci/pci-sysfs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ void pci_create_legacy_files(struct pci_bus *b)
642642
if (!b->legacy_io)
643643
goto kzalloc_err;
644644

645-
sysfs_bin_attr_init(&b->legacy_io);
645+
sysfs_bin_attr_init(b->legacy_io);
646646
b->legacy_io->attr.name = "legacy_io";
647647
b->legacy_io->size = 0xffff;
648648
b->legacy_io->attr.mode = S_IRUSR | S_IWUSR;
@@ -655,7 +655,7 @@ void pci_create_legacy_files(struct pci_bus *b)
655655
goto legacy_io_err;
656656

657657
/* Allocated above after the legacy_io struct */
658-
sysfs_bin_attr_init(&b->legacy_mem);
658+
sysfs_bin_attr_init(b->legacy_mem);
659659
b->legacy_mem = b->legacy_io + 1;
660660
b->legacy_mem->attr.name = "legacy_mem";
661661
b->legacy_mem->size = 1024*1024;

‎include/linux/sysfs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct bin_attribute {
110110
* enabled. Lockdep gives a nice error when your attribute is
111111
* added to sysfs if you don't have this.
112112
*/
113-
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&bin_attr->attr)
113+
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)
114114

115115
struct sysfs_ops {
116116
ssize_t (*show)(struct kobject *, struct attribute *,char *);

0 commit comments

Comments
 (0)