From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH] scsi_transport_fc: Initialize sysfs attributes with sysfs_attr_init
Date: Tue, 16 Mar 2010 11:14:53 +0100 [thread overview]
Message-ID: <20100316101453.GA9734@schmichrtp.mainz.de.ibm.com> (raw)
With the new lockdep tracking in sysfs, sysfs_attr_init has to be used
for initializing all non-static sysfs attributes. Otherwise, lockdep
will warn about the missing initialization with:
Mar 15 09:19:49 t6345029 kernel: BUG: key 000000002f5ae350 not in .data!
Mar 15 09:19:49 t6345029 kernel: BUG: key 000000002f5ae388 not in .data!
Mar 15 09:19:49 t6345029 kernel: BUG: key 000000002f5ae3c0 not in .data!
Mar 15 09:19:49 t6345029 kernel: BUG: key 000000002f5ae3f8 not in .data!
Add the calls to sysfs_attr_init for the attributes in struct
fc_internal.
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---
drivers/scsi/scsi_transport_fc.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
--- a/drivers/scsi/scsi_transport_fc.c 2010-03-15 16:39:54.000000000 +0100
+++ b/drivers/scsi/scsi_transport_fc.c 2010-03-15 16:59:08.000000000 +0100
@@ -777,6 +777,7 @@ static FC_DEVICE_ATTR(rport, title, S_IR
i->private_rport_attrs[count].attr.mode = S_IRUGO; \
i->private_rport_attrs[count].store = NULL; \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
+ sysfs_attr_init(&i->rport_attrs[count]->attr); \
if (i->f->show_rport_##field) \
count++
@@ -785,6 +786,7 @@ static FC_DEVICE_ATTR(rport, title, S_IR
i->private_rport_attrs[count].attr.mode = S_IRUGO; \
i->private_rport_attrs[count].store = NULL; \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
+ sysfs_attr_init(&i->rport_attrs[count]->attr); \
count++
#define SETUP_RPORT_ATTRIBUTE_RW(field) \
@@ -794,6 +796,7 @@ static FC_DEVICE_ATTR(rport, title, S_IR
i->private_rport_attrs[count].store = NULL; \
} \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
+ sysfs_attr_init(&i->rport_attrs[count]->attr); \
if (i->f->show_rport_##field) \
count++
@@ -801,6 +804,7 @@ static FC_DEVICE_ATTR(rport, title, S_IR
{ \
i->private_rport_attrs[count] = device_attr_rport_##field; \
i->rport_attrs[count] = &i->private_rport_attrs[count]; \
+ sysfs_attr_init(&i->rport_attrs[count]->attr); \
count++; \
}
@@ -994,6 +998,7 @@ static FC_DEVICE_ATTR(starget, field, S_
i->private_starget_attrs[count].attr.mode = S_IRUGO; \
i->private_starget_attrs[count].store = NULL; \
i->starget_attrs[count] = &i->private_starget_attrs[count]; \
+ sysfs_attr_init(&i->starget_attrs[count]->attr); \
if (i->f->show_starget_##field) \
count++
@@ -1004,6 +1009,7 @@ static FC_DEVICE_ATTR(starget, field, S_
i->private_starget_attrs[count].store = NULL; \
} \
i->starget_attrs[count] = &i->private_starget_attrs[count]; \
+ sysfs_attr_init(&i->starget_attrs[count]->attr); \
if (i->f->show_starget_##field) \
count++
@@ -1157,6 +1163,7 @@ static FC_DEVICE_ATTR(vport, title, S_IR
i->private_vport_attrs[count].attr.mode = S_IRUGO; \
i->private_vport_attrs[count].store = NULL; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
+ sysfs_attr_init(i->vport_attrs[count].attr); \
if (i->f->get_##field) \
count++
/* NOTE: Above MACRO differs: checks function not show bit */
@@ -1166,11 +1173,13 @@ static FC_DEVICE_ATTR(vport, title, S_IR
i->private_vport_attrs[count].attr.mode = S_IRUGO; \
i->private_vport_attrs[count].store = NULL; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
+ sysfs_attr_init(&i->vport_attrs[count]->attr); \
count++
#define SETUP_VPORT_ATTRIBUTE_WR(field) \
i->private_vport_attrs[count] = device_attr_vport_##field; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
+ sysfs_attr_init(&i->vport_attrs[count]->attr); \
if (i->f->field) \
count++
/* NOTE: Above MACRO differs: checks function */
@@ -1182,6 +1191,7 @@ static FC_DEVICE_ATTR(vport, title, S_IR
i->private_vport_attrs[count].store = NULL; \
} \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
+ sysfs_attr_init(&i->vport_attrs[count]->attr); \
count++
/* NOTE: Above MACRO differs: does not check show bit */
@@ -1189,6 +1199,7 @@ static FC_DEVICE_ATTR(vport, title, S_IR
{ \
i->private_vport_attrs[count] = device_attr_vport_##field; \
i->vport_attrs[count] = &i->private_vport_attrs[count]; \
+ sysfs_attr_init(&i->vport_attrs[count]->attr); \
count++; \
}
@@ -1366,6 +1377,7 @@ static FC_DEVICE_ATTR(host, title, S_IRU
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
+ sysfs_attr_init(&i->host_attrs[count]->attr); \
if (i->f->show_host_##field) \
count++
@@ -1374,6 +1386,7 @@ static FC_DEVICE_ATTR(host, title, S_IRU
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
+ sysfs_attr_init(&i->host_attrs[count]->attr); \
count++
#define SETUP_HOST_ATTRIBUTE_RW(field) \
@@ -1383,6 +1396,7 @@ static FC_DEVICE_ATTR(host, title, S_IRU
i->private_host_attrs[count].store = NULL; \
} \
i->host_attrs[count] = &i->private_host_attrs[count]; \
+ sysfs_attr_init(&i->host_attrs[count]->attr); \
if (i->f->show_host_##field) \
count++
@@ -1411,12 +1425,14 @@ static FC_DEVICE_ATTR(host, field, S_IRU
i->private_host_attrs[count].attr.mode = S_IRUGO; \
i->private_host_attrs[count].store = NULL; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
+ sysfs_attr_init(&i->host_attrs[count]->attr); \
count++
#define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field) \
{ \
i->private_host_attrs[count] = device_attr_host_##field; \
i->host_attrs[count] = &i->private_host_attrs[count]; \
+ sysfs_attr_init(&i->host_attrs[count]->attr); \
count++; \
}
next reply other threads:[~2010-03-16 10:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 10:14 Christof Schmitt [this message]
2010-03-16 20:48 ` [PATCH] scsi_transport_fc: Initialize sysfs attributes with sysfs_attr_init Mike Christie
2010-03-16 20:49 ` James Bottomley
2010-03-17 13:20 ` Christof Schmitt
2010-03-20 17:44 ` James Bottomley
2010-03-22 10:13 ` Christof Schmitt
2010-03-22 19:16 ` Alex.Iannicelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100316101453.GA9734@schmichrtp.mainz.de.ibm.com \
--to=christof.schmitt@de.ibm.com \
--cc=James.Bottomley@suse.de \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox