* [PATCH] sas transport sysfs write attributes bug fix
@ 2006-04-25 23:35 Eric Moore
2006-04-25 23:57 ` James Bottomley
0 siblings, 1 reply; 3+ messages in thread
From: Eric Moore @ 2006-04-25 23:35 UTC (permalink / raw)
To: linux-scsi; +Cc: James.Bottomley
The SAS Transport Layers SySFS write attributes were recently broke when
SETUP_OPTIONAL_PORT_ATTRIBUTE_WRONLY was added. This fix's the following
write attributes:
/sys/class/sas_phy/phy-0:0/hard_reset
/sys/class/sas_phy/phy-0:0/link_reset
Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
diff -uarN b/drivers/scsi/scsi_transport_sas.c a/drivers/scsi/scsi_transport_sas.c
--- b/drivers/scsi/scsi_transport_sas.c 2006-04-20 17:23:04.000000000 -0600
+++ a/drivers/scsi/scsi_transport_sas.c 2006-04-25 17:13:21.000000000 -0600
@@ -982,6 +982,13 @@
if (test) \
count++
+#define SETUP_TEMPLATE_WRONLY(attrb, field, perm, test) \
+ i->private_##attrb[count] = class_device_attr_##field; \
+ i->private_##attrb[count].attr.mode = perm; \
+ i->private_##attrb[count].show = NULL; \
+ i->attrb[count] = &i->private_##attrb[count]; \
+ if (test) \
+ count++
#define SETUP_RPORT_ATTRIBUTE(field) \
SETUP_TEMPLATE(rphy_attrs, field, S_IRUGO, 1)
@@ -996,10 +1003,10 @@
SETUP_TEMPLATE(phy_attrs, field, S_IRUGO, i->f->func)
#define SETUP_PORT_ATTRIBUTE_WRONLY(field) \
- SETUP_TEMPLATE(phy_attrs, field, S_IWUGO, 1)
+ SETUP_TEMPLATE_WRONLY(phy_attrs, field, S_IWUGO, 1)
#define SETUP_OPTIONAL_PORT_ATTRIBUTE_WRONLY(field, func) \
- SETUP_TEMPLATE(phy_attrs, field, S_IWUGO, i->f->func)
+ SETUP_TEMPLATE_WRONLY(phy_attrs, field, S_IWUGO, i->f->func)
#define SETUP_END_DEV_ATTRIBUTE(field) \
SETUP_TEMPLATE(end_dev_attrs, field, S_IRUGO, 1)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sas transport sysfs write attributes bug fix
2006-04-25 23:35 [PATCH] sas transport sysfs write attributes bug fix Eric Moore
@ 2006-04-25 23:57 ` James Bottomley
2006-04-26 5:18 ` Moore, Eric
0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2006-04-25 23:57 UTC (permalink / raw)
To: Eric Moore; +Cc: linux-scsi
On Tue, 2006-04-25 at 17:35 -0600, Eric Moore wrote:
> The SAS Transport Layers SySFS write attributes were recently broke when
> SETUP_OPTIONAL_PORT_ATTRIBUTE_WRONLY was added. This fix's the following
> write attributes:
>
> /sys/class/sas_phy/phy-0:0/hard_reset
> /sys/class/sas_phy/phy-0:0/link_reset
>
> Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Heh, that's a bit of a screw up in the templates (cut and paste error, I
think), but isn't this the simpler fix?
James
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index 8b6d65e..40bef6c 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -974,10 +974,9 @@ static int sas_user_scan(struct Scsi_Hos
* Setup / Teardown code
*/
-#define SETUP_TEMPLATE(attrb, field, perm, test) \
+#define SETUP_TEMPLATE(attrb, field, perm, test) \
i->private_##attrb[count] = class_device_attr_##field; \
i->private_##attrb[count].attr.mode = perm; \
- i->private_##attrb[count].store = NULL; \
i->attrb[count] = &i->private_##attrb[count]; \
if (test) \
count++
>
> diff -uarN b/drivers/scsi/scsi_transport_sas.c a/drivers/scsi/scsi_transport_sas.c
> --- b/drivers/scsi/scsi_transport_sas.c 2006-04-20 17:23:04.000000000 -0600
> +++ a/drivers/scsi/scsi_transport_sas.c 2006-04-25 17:13:21.000000000 -0600
> @@ -982,6 +982,13 @@
> if (test) \
> count++
>
> +#define SETUP_TEMPLATE_WRONLY(attrb, field, perm, test) \
> + i->private_##attrb[count] = class_device_attr_##field; \
> + i->private_##attrb[count].attr.mode = perm; \
> + i->private_##attrb[count].show = NULL; \
> + i->attrb[count] = &i->private_##attrb[count]; \
> + if (test) \
> + count++
>
> #define SETUP_RPORT_ATTRIBUTE(field) \
> SETUP_TEMPLATE(rphy_attrs, field, S_IRUGO, 1)
> @@ -996,10 +1003,10 @@
> SETUP_TEMPLATE(phy_attrs, field, S_IRUGO, i->f->func)
>
> #define SETUP_PORT_ATTRIBUTE_WRONLY(field) \
> - SETUP_TEMPLATE(phy_attrs, field, S_IWUGO, 1)
> + SETUP_TEMPLATE_WRONLY(phy_attrs, field, S_IWUGO, 1)
>
> #define SETUP_OPTIONAL_PORT_ATTRIBUTE_WRONLY(field, func) \
> - SETUP_TEMPLATE(phy_attrs, field, S_IWUGO, i->f->func)
> + SETUP_TEMPLATE_WRONLY(phy_attrs, field, S_IWUGO, i->f->func)
>
> #define SETUP_END_DEV_ATTRIBUTE(field) \
> SETUP_TEMPLATE(end_dev_attrs, field, S_IRUGO, 1)
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sas transport sysfs write attributes bug fix
2006-04-25 23:57 ` James Bottomley
@ 2006-04-26 5:18 ` Moore, Eric
0 siblings, 0 replies; 3+ messages in thread
From: Moore, Eric @ 2006-04-26 5:18 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi
On Tuesday, April 25, 2006 5:57 PM, James Bottomley wrote:
> Heh, that's a bit of a screw up in the templates (cut and paste error, I
> think), but isn't this the simpler fix?
>
Agreed.
Yes, it would be simpler if we didn't bother with the store and show pointer
from SETUP_TEMPLATE. I'm sure the i struct would of been already initialized
by now, and corresponding store/show fields would be set accordingly.
Regards,
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-26 5:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-25 23:35 [PATCH] sas transport sysfs write attributes bug fix Eric Moore
2006-04-25 23:57 ` James Bottomley
2006-04-26 5:18 ` Moore, Eric
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox