[PATCH] scsi_transport_fc: Initialize sysfs attributes with sysfs_attr_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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++;							\
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux