Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62e877b8 authored by Stephen Rothwell's avatar Stephen Rothwell Committed by Greg Kroah-Hartman
Browse files

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: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0f4288ec
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -642,7 +642,7 @@ void pci_create_legacy_files(struct pci_bus *b)
	if (!b->legacy_io)
	if (!b->legacy_io)
		goto kzalloc_err;
		goto kzalloc_err;


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


	/* Allocated above after the legacy_io struct */
	/* Allocated above after the legacy_io struct */
	sysfs_bin_attr_init(&b->legacy_mem);
	sysfs_bin_attr_init(b->legacy_mem);
	b->legacy_mem = b->legacy_io + 1;
	b->legacy_mem = b->legacy_io + 1;
	b->legacy_mem->attr.name = "legacy_mem";
	b->legacy_mem->attr.name = "legacy_mem";
	b->legacy_mem->size = 1024*1024;
	b->legacy_mem->size = 1024*1024;
+1 −1
Original line number Original line Diff line number Diff line
@@ -110,7 +110,7 @@ struct bin_attribute {
 *	enabled.  Lockdep gives a nice error when your attribute is
 *	enabled.  Lockdep gives a nice error when your attribute is
 *	added to sysfs if you don't have this.
 *	added to sysfs if you don't have this.
 */
 */
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&bin_attr->attr)
#define sysfs_bin_attr_init(bin_attr) sysfs_attr_init(&(bin_attr)->attr)


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