diff options
author | Tony Jones <tonyj@suse.de> | 2008-02-22 00:13:36 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-19 19:10:33 -0700 |
commit | ee959b00c335d7780136c5abda37809191fe52c3 (patch) | |
tree | 7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/scsi_transport_fc.c | |
parent | 56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff) | |
download | lwn-ee959b00c335d7780136c5abda37809191fe52c3.tar.gz lwn-ee959b00c335d7780136c5abda37809191fe52c3.zip |
SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller...
Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_transport_fc.c')
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 385 |
1 files changed, 208 insertions, 177 deletions
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index b1119da6e88c..6b092a6c295d 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -72,8 +72,8 @@ static int fc_vport_create(struct Scsi_Host *shost, int channel, * Redefine so that we can have same named attributes in the * sdev/starget/host objects. */ -#define FC_CLASS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ -struct class_device_attribute class_device_attr_##_prefix##_##_name = \ +#define FC_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ +struct device_attribute device_attr_##_prefix##_##_name = \ __ATTR(_name,_mode,_show,_store) #define fc_enum_name_search(title, table_type, table) \ @@ -326,26 +326,26 @@ struct fc_internal { * part of the midlayer. As the remote port is specific to the * fc transport, we must provide the attribute container. */ - struct class_device_attribute private_starget_attrs[ + struct device_attribute private_starget_attrs[ FC_STARGET_NUM_ATTRS]; - struct class_device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1]; + struct device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1]; - struct class_device_attribute private_host_attrs[FC_HOST_NUM_ATTRS]; - struct class_device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1]; + struct device_attribute private_host_attrs[FC_HOST_NUM_ATTRS]; + struct device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1]; struct transport_container rport_attr_cont; - struct class_device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS]; - struct class_device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1]; + struct device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS]; + struct device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1]; struct transport_container vport_attr_cont; - struct class_device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS]; - struct class_device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1]; + struct device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS]; + struct device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1]; }; #define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t) static int fc_target_setup(struct transport_container *tc, struct device *dev, - struct class_device *cdev) + struct device *cdev) { struct scsi_target *starget = to_scsi_target(dev); struct fc_rport *rport = starget_to_rport(starget); @@ -375,7 +375,7 @@ static DECLARE_TRANSPORT_CLASS(fc_transport_class, NULL); static int fc_host_setup(struct transport_container *tc, struct device *dev, - struct class_device *cdev) + struct device *cdev) { struct Scsi_Host *shost = dev_to_shost(dev); struct fc_host_attrs *fc_host = shost_to_fc_host(shost); @@ -682,9 +682,10 @@ static void __exit fc_transport_exit(void) #define fc_rport_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_rport_##field (struct class_device *cdev, char *buf) \ +show_fc_rport_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct fc_rport *rport = transport_class_to_rport(cdev); \ + struct fc_rport *rport = transport_class_to_rport(dev); \ struct Scsi_Host *shost = rport_to_shost(rport); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ if ((i->f->get_rport_##field) && \ @@ -697,11 +698,12 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \ #define fc_rport_store_function(field) \ static ssize_t \ -store_fc_rport_##field(struct class_device *cdev, const char *buf, \ - size_t count) \ +store_fc_rport_##field(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t count) \ { \ int val; \ - struct fc_rport *rport = transport_class_to_rport(cdev); \ + struct fc_rport *rport = transport_class_to_rport(dev); \ struct Scsi_Host *shost = rport_to_shost(rport); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ char *cp; \ @@ -718,58 +720,60 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \ #define fc_rport_rd_attr(field, format_string, sz) \ fc_rport_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ show_fc_rport_##field, NULL) #define fc_rport_rd_attr_cast(field, format_string, sz, cast) \ fc_rport_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ show_fc_rport_##field, NULL) #define fc_rport_rw_attr(field, format_string, sz) \ fc_rport_show_function(field, format_string, sz, ) \ fc_rport_store_function(field) \ -static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \ +static FC_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \ show_fc_rport_##field, \ store_fc_rport_##field) #define fc_private_rport_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_rport_##field (struct class_device *cdev, char *buf) \ +show_fc_rport_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct fc_rport *rport = transport_class_to_rport(cdev); \ + struct fc_rport *rport = transport_class_to_rport(dev); \ return snprintf(buf, sz, format_string, cast rport->field); \ } #define fc_private_rport_rd_attr(field, format_string, sz) \ fc_private_rport_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ show_fc_rport_##field, NULL) #define fc_private_rport_rd_attr_cast(field, format_string, sz, cast) \ fc_private_rport_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(rport, field, S_IRUGO, \ show_fc_rport_##field, NULL) #define fc_private_rport_rd_enum_attr(title, maxlen) \ static ssize_t \ -show_fc_rport_##title (struct class_device *cdev, char *buf) \ +show_fc_rport_##title (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct fc_rport *rport = transport_class_to_rport(cdev); \ + struct fc_rport *rport = transport_class_to_rport(dev); \ const char *name; \ name = get_fc_##title##_name(rport->title); \ if (!name) \ return -EINVAL; \ return snprintf(buf, maxlen, "%s\n", name); \ } \ -static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ +static FC_DEVICE_ATTR(rport, title, S_IRUGO, \ show_fc_rport_##title, NULL) #define SETUP_RPORT_ATTRIBUTE_RD(field) \ - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ + i->private_rport_attrs[count] = device_attr_rport_##field; \ 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]; \ @@ -777,14 +781,14 @@ static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ count++ #define SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(field) \ - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ + i->private_rport_attrs[count] = device_attr_rport_##field; \ 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]; \ count++ #define SETUP_RPORT_ATTRIBUTE_RW(field) \ - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ + i->private_rport_attrs[count] = device_attr_rport_##field; \ if (!i->f->set_rport_##field) { \ i->private_rport_attrs[count].attr.mode = S_IRUGO; \ i->private_rport_attrs[count].store = NULL; \ @@ -795,7 +799,7 @@ static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ #define SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(field) \ { \ - i->private_rport_attrs[count] = class_device_attr_rport_##field; \ + i->private_rport_attrs[count] = device_attr_rport_##field; \ i->rport_attrs[count] = &i->private_rport_attrs[count]; \ count++; \ } @@ -808,14 +812,15 @@ static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ fc_private_rport_rd_attr(maxframe_size, "%u bytes\n", 20); static ssize_t -show_fc_rport_supported_classes (struct class_device *cdev, char *buf) +show_fc_rport_supported_classes (struct device *dev, + struct device_attribute *attr, char *buf) { - struct fc_rport *rport = transport_class_to_rport(cdev); + struct fc_rport *rport = transport_class_to_rport(dev); if (rport->supported_classes == FC_COS_UNSPECIFIED) return snprintf(buf, 20, "unspecified\n"); return get_fc_cos_names(rport->supported_classes, buf); } -static FC_CLASS_DEVICE_ATTR(rport, supported_classes, S_IRUGO, +static FC_DEVICE_ATTR(rport, supported_classes, S_IRUGO, show_fc_rport_supported_classes, NULL); /* Dynamic Remote Port Attributes */ @@ -825,11 +830,11 @@ static FC_CLASS_DEVICE_ATTR(rport, supported_classes, S_IRUGO, */ fc_rport_show_function(dev_loss_tmo, "%d\n", 20, ) static ssize_t -store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf, - size_t count) +store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { int val; - struct fc_rport *rport = transport_class_to_rport(cdev); + struct fc_rport *rport = transport_class_to_rport(dev); struct Scsi_Host *shost = rport_to_shost(rport); struct fc_internal *i = to_fc_internal(shost->transportt); char *cp; @@ -844,7 +849,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf, i->f->set_rport_dev_loss_tmo(rport, val); return count; } -static FC_CLASS_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR, +static FC_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR, show_fc_rport_dev_loss_tmo, store_fc_rport_dev_loss_tmo); @@ -855,9 +860,10 @@ fc_private_rport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); fc_private_rport_rd_attr(port_id, "0x%06x\n", 20); static ssize_t -show_fc_rport_roles (struct class_device *cdev, char *buf) +show_fc_rport_roles (struct device *dev, struct device_attribute *attr, + char *buf) { - struct fc_rport *rport = transport_class_to_rport(cdev); + struct fc_rport *rport = transport_class_to_rport(dev); /* identify any roles that are port_id specific */ if ((rport->port_id != -1) && @@ -883,7 +889,7 @@ show_fc_rport_roles (struct class_device *cdev, char *buf) return get_fc_port_roles_names(rport->roles, buf); } } -static FC_CLASS_DEVICE_ATTR(rport, roles, S_IRUGO, +static FC_DEVICE_ATTR(rport, roles, S_IRUGO, show_fc_rport_roles, NULL); fc_private_rport_rd_enum_attr(port_state, FC_PORTSTATE_MAX_NAMELEN); @@ -893,9 +899,10 @@ fc_private_rport_rd_attr(scsi_target_id, "%d\n", 20); * fast_io_fail_tmo attribute */ static ssize_t -show_fc_rport_fast_io_fail_tmo (struct class_device *cdev, char *buf) +show_fc_rport_fast_io_fail_tmo (struct device *dev, + struct device_attribute *attr, char *buf) { - struct fc_rport *rport = transport_class_to_rport(cdev); + struct fc_rport *rport = transport_class_to_rport(dev); if (rport->fast_io_fail_tmo == -1) return snprintf(buf, 5, "off\n"); @@ -903,12 +910,13 @@ show_fc_rport_fast_io_fail_tmo (struct class_device *cdev, char *buf) } static ssize_t -store_fc_rport_fast_io_fail_tmo(struct class_device *cdev, const char *buf, - size_t count) +store_fc_rport_fast_io_fail_tmo(struct device *dev, + struct device_attribute *attr, const char *buf, + size_t count) { int val; char *cp; - struct fc_rport *rport = transport_class_to_rport(cdev); + struct fc_rport *rport = transport_class_to_rport(dev); if ((rport->port_state == FC_PORTSTATE_BLOCKED) || (rport->port_state == FC_PORTSTATE_DELETED) || @@ -925,7 +933,7 @@ store_fc_rport_fast_io_fail_tmo(struct class_device *cdev, const char *buf, } return count; } -static FC_CLASS_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, +static FC_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, show_fc_rport_fast_io_fail_tmo, store_fc_rport_fast_io_fail_tmo); @@ -941,9 +949,10 @@ static FC_CLASS_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, */ #define fc_starget_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_starget_##field (struct class_device *cdev, char *buf) \ +show_fc_starget_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct scsi_target *starget = transport_class_to_starget(cdev); \ + struct scsi_target *starget = transport_class_to_starget(dev); \ struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ struct fc_rport *rport = starget_to_rport(starget); \ @@ -957,16 +966,16 @@ show_fc_starget_##field (struct class_device *cdev, char *buf) \ #define fc_starget_rd_attr(field, format_string, sz) \ fc_starget_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ +static FC_DEVICE_ATTR(starget, field, S_IRUGO, \ show_fc_starget_##field, NULL) #define fc_starget_rd_attr_cast(field, format_string, sz, cast) \ fc_starget_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ +static FC_DEVICE_ATTR(starget, field, S_IRUGO, \ show_fc_starget_##field, NULL) #define SETUP_STARGET_ATTRIBUTE_RD(field) \ - i->private_starget_attrs[count] = class_device_attr_starget_##field; \ + i->private_starget_attrs[count] = device_attr_starget_##field; \ 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]; \ @@ -974,7 +983,7 @@ static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ count++ #define SETUP_STARGET_ATTRIBUTE_RW(field) \ - i->private_starget_attrs[count] = class_device_attr_starget_##field; \ + i->private_starget_attrs[count] = device_attr_starget_##field; \ if (!i->f->set_starget_##field) { \ i->private_starget_attrs[count].attr.mode = S_IRUGO; \ i->private_starget_attrs[count].store = NULL; \ @@ -995,9 +1004,10 @@ fc_starget_rd_attr(port_id, "0x%06x\n", 20); #define fc_vport_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_vport_##field (struct class_device *cdev, char *buf) \ +show_fc_vport_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct fc_vport *vport = transport_class_to_vport(cdev); \ + struct fc_vport *vport = transport_class_to_vport(dev); \ struct Scsi_Host *shost = vport_to_shost(vport); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ if ((i->f->get_vport_##field) && \ @@ -1008,11 +1018,12 @@ show_fc_vport_##field (struct class_device *cdev, char *buf) \ #define fc_vport_store_function(field) \ static ssize_t \ -store_fc_vport_##field(struct class_device *cdev, const char *buf, \ - size_t count) \ +store_fc_vport_##field(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t count) \ { \ int val; \ - struct fc_vport *vport = transport_class_to_vport(cdev); \ + struct fc_vport *vport = transport_class_to_vport(dev); \ struct Scsi_Host *shost = vport_to_shost(vport); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ char *cp; \ @@ -1027,10 +1038,11 @@ store_fc_vport_##field(struct class_device *cdev, const char *buf, \ #define fc_vport_store_str_function(field, slen) \ static ssize_t \ -store_fc_vport_##field(struct class_device *cdev, const char *buf, \ - size_t count) \ +store_fc_vport_##field(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t count) \ { \ - struct fc_vport *vport = transport_class_to_vport(cdev); \ + struct fc_vport *vport = transport_class_to_vport(dev); \ struct Scsi_Host *shost = vport_to_shost(vport); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ unsigned int cnt=count; \ @@ -1047,36 +1059,38 @@ store_fc_vport_##field(struct class_device *cdev, const char *buf, \ #define fc_vport_rd_attr(field, format_string, sz) \ fc_vport_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ show_fc_vport_##field, NULL) #define fc_vport_rd_attr_cast(field, format_string, sz, cast) \ fc_vport_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ show_fc_vport_##field, NULL) #define fc_vport_rw_attr(field, format_string, sz) \ fc_vport_show_function(field, format_string, sz, ) \ fc_vport_store_function(field) \ -static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ +static FC_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ show_fc_vport_##field, \ store_fc_vport_##field) #define fc_private_vport_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_vport_##field (struct class_device *cdev, char *buf) \ +show_fc_vport_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct fc_vport *vport = transport_class_to_vport(cdev); \ + struct fc_vport *vport = transport_class_to_vport(dev); \ return snprintf(buf, sz, format_string, cast vport->field); \ } #define fc_private_vport_store_u32_function(field) \ static ssize_t \ -store_fc_vport_##field(struct class_device *cdev, const char *buf, \ - size_t count) \ +store_fc_vport_##field(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t count) \ { \ u32 val; \ - struct fc_vport *vport = transport_class_to_vport(cdev); \ + struct fc_vport *vport = transport_class_to_vport(dev); \ char *cp; \ if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) \ return -EBUSY; \ @@ -1090,39 +1104,41 @@ store_fc_vport_##field(struct class_device *cdev, const char *buf, \ #define fc_private_vport_rd_attr(field, format_string, sz) \ fc_private_vport_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ show_fc_vport_##field, NULL) #define fc_private_vport_rd_attr_cast(field, format_string, sz, cast) \ fc_private_vport_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ +static FC_DEVICE_ATTR(vport, field, S_IRUGO, \ show_fc_vport_##field, NULL) #define fc_private_vport_rw_u32_attr(field, format_string, sz) \ fc_private_vport_show_function(field, format_string, sz, ) \ fc_private_vport_store_u32_function(field) \ -static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ +static FC_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ show_fc_vport_##field, \ store_fc_vport_##field) #define fc_private_vport_rd_enum_attr(title, maxlen) \ static ssize_t \ -show_fc_vport_##title (struct class_device *cdev, char *buf) \ +show_fc_vport_##title (struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ { \ - struct fc_vport *vport = transport_class_to_vport(cdev); \ + struct fc_vport *vport = transport_class_to_vport(dev); \ const char *name; \ name = get_fc_##title##_name(vport->title); \ if (!name) \ return -EINVAL; \ return snprintf(buf, maxlen, "%s\n", name); \ } \ -static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \ +static FC_DEVICE_ATTR(vport, title, S_IRUGO, \ show_fc_vport_##title, NULL) #define SETUP_VPORT_ATTRIBUTE_RD(field) \ - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ + i->private_vport_attrs[count] = device_attr_vport_##field; \ 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]; \ @@ -1131,21 +1147,21 @@ static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \ /* NOTE: Above MACRO differs: checks function not show bit */ #define SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(field) \ - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ + i->private_vport_attrs[count] = device_attr_vport_##field; \ 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]; \ count++ #define SETUP_VPORT_ATTRIBUTE_WR(field) \ - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ + i->private_vport_attrs[count] = device_attr_vport_##field; \ i->vport_attrs[count] = &i->private_vport_attrs[count]; \ if (i->f->field) \ count++ /* NOTE: Above MACRO differs: checks function */ #define SETUP_VPORT_ATTRIBUTE_RW(field) \ - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ + i->private_vport_attrs[count] = device_attr_vport_##field; \ if (!i->f->set_vport_##field) { \ i->private_vport_attrs[count].attr.mode = S_IRUGO; \ i->private_vport_attrs[count].store = NULL; \ @@ -1156,7 +1172,7 @@ static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \ #define SETUP_PRIVATE_VPORT_ATTRIBUTE_RW(field) \ { \ - i->private_vport_attrs[count] = class_device_attr_vport_##field; \ + i->private_vport_attrs[count] = device_attr_vport_##field; \ i->vport_attrs[count] = &i->private_vport_attrs[count]; \ count++; \ } @@ -1176,35 +1192,36 @@ fc_private_vport_rd_attr_cast(node_name, "0x%llx\n", 20, unsigned long long); fc_private_vport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); static ssize_t -show_fc_vport_roles (struct class_device *cdev, char *buf) +show_fc_vport_roles (struct device *dev, struct device_attribute *attr, + char *buf) { - struct fc_vport *vport = transport_class_to_vport(cdev); + struct fc_vport *vport = transport_class_to_vport(dev); if (vport->roles == FC_PORT_ROLE_UNKNOWN) return snprintf(buf, 20, "unknown\n"); return get_fc_port_roles_names(vport->roles, buf); } -static FC_CLASS_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); +static FC_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); fc_private_vport_rd_enum_attr(vport_type, FC_PORTTYPE_MAX_NAMELEN); fc_private_vport_show_function(symbolic_name, "%s\n", FC_VPORT_SYMBOLIC_NAMELEN + 1, ) fc_vport_store_str_function(symbolic_name, FC_VPORT_SYMBOLIC_NAMELEN) -static FC_CLASS_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR, +static FC_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR, show_fc_vport_symbolic_name, store_fc_vport_symbolic_name); static ssize_t -store_fc_vport_delete(struct class_device *cdev, const char *buf, - size_t count) +store_fc_vport_delete(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - struct fc_vport *vport = transport_class_to_vport(cdev); + struct fc_vport *vport = transport_class_to_vport(dev); struct Scsi_Host *shost = vport_to_shost(vport); fc_queue_work(shost, &vport->vport_delete_work); return count; } -static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, +static FC_DEVICE_ATTR(vport, vport_delete, S_IWUSR, NULL, store_fc_vport_delete); @@ -1213,10 +1230,11 @@ static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, * Write "1" to disable, write "0" to enable */ static ssize_t -store_fc_vport_disable(struct class_device *cdev, const char *buf, +store_fc_vport_disable(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - struct fc_vport *vport = transport_class_to_vport(cdev); + struct fc_vport *vport = transport_class_to_vport(dev); struct Scsi_Host *shost = vport_to_shost(vport); struct fc_internal *i = to_fc_internal(shost->transportt); int stat; @@ -1236,7 +1254,7 @@ store_fc_vport_disable(struct class_device *cdev, const char *buf, stat = i->f->vport_disable(vport, ((*buf == '0') ? false : true)); return stat ? stat : count; } -static FC_CLASS_DEVICE_ATTR(vport, vport_disable, S_IWUSR, +static FC_DEVICE_ATTR(vport, vport_disable, S_IWUSR, NULL, store_fc_vport_disable); @@ -1246,9 +1264,10 @@ static FC_CLASS_DEVICE_ATTR(vport, vport_disable, S_IWUSR, #define fc_host_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_host_##field (struct class_device *cdev, char *buf) \ +show_fc_host_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ + struct Scsi_Host *shost = transport_class_to_shost(dev); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ if (i->f->get_host_##field) \ i->f->get_host_##field(shost); \ @@ -1257,11 +1276,12 @@ show_fc_host_##field (struct class_device *cdev, char *buf) \ #define fc_host_store_function(field) \ static ssize_t \ -store_fc_host_##field(struct class_device *cdev, const char *buf, \ - size_t count) \ +store_fc_host_##field(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t count) \ { \ int val; \ - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ + struct Scsi_Host *shost = transport_class_to_shost(dev); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ char *cp; \ \ @@ -1274,10 +1294,11 @@ store_fc_host_##field(struct class_device *cdev, const char *buf, \ #define fc_host_store_str_function(field, slen) \ static ssize_t \ -store_fc_host_##field(struct class_device *cdev, const char *buf, \ - size_t count) \ +store_fc_host_##field(struct device *dev, \ + struct device_attribute *attr, \ + const char *buf, size_t count) \ { \ - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ + struct Scsi_Host *shost = transport_class_to_shost(dev); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ unsigned int cnt=count; \ \ @@ -1293,26 +1314,27 @@ store_fc_host_##field(struct class_device *cdev, const char *buf, \ #define fc_host_rd_attr(field, format_string, sz) \ fc_host_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ +static FC_DEVICE_ATTR(host, field, S_IRUGO, \ show_fc_host_##field, NULL) #define fc_host_rd_attr_cast(field, format_string, sz, cast) \ fc_host_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ +static FC_DEVICE_ATTR(host, field, S_IRUGO, \ show_fc_host_##field, NULL) #define fc_host_rw_attr(field, format_string, sz) \ fc_host_show_function(field, format_string, sz, ) \ fc_host_store_function(field) \ -static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \ +static FC_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \ show_fc_host_##field, \ store_fc_host_##field) #define fc_host_rd_enum_attr(title, maxlen) \ static ssize_t \ -show_fc_host_##title (struct class_device *cdev, char *buf) \ +show_fc_host_##title (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ + struct Scsi_Host *shost = transport_class_to_shost(dev); \ struct fc_internal *i = to_fc_internal(shost->transportt); \ const char *name; \ if (i->f->get_host_##title) \ @@ -1322,10 +1344,10 @@ show_fc_host_##title (struct class_device *cdev, char *buf) \ return -EINVAL; \ return snprintf(buf, maxlen, "%s\n", name); \ } \ -static FC_CLASS_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) +static FC_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) #define SETUP_HOST_ATTRIBUTE_RD(field) \ - i->private_host_attrs[count] = class_device_attr_host_##field; \ + i->private_host_attrs[count] = device_attr_host_##field; \ 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]; \ @@ -1333,14 +1355,14 @@ static FC_CLASS_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) count++ #define SETUP_HOST_ATTRIBUTE_RD_NS(field) \ - i->private_host_attrs[count] = class_device_attr_host_##field; \ + i->private_host_attrs[count] = device_attr_host_##field; \ 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]; \ count++ #define SETUP_HOST_ATTRIBUTE_RW(field) \ - i->private_host_attrs[count] = class_device_attr_host_##field; \ + i->private_host_attrs[count] = device_attr_host_##field; \ if (!i->f->set_host_##field) { \ i->private_host_attrs[count].attr.mode = S_IRUGO; \ i->private_host_attrs[count].store = NULL; \ @@ -1352,24 +1374,25 @@ static FC_CLASS_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) #define fc_private_host_show_function(field, format_string, sz, cast) \ static ssize_t \ -show_fc_host_##field (struct class_device *cdev, char *buf) \ +show_fc_host_##field (struct device *dev, \ + struct device_attribute *attr, char *buf) \ { \ - struct Scsi_Host *shost = transport_class_to_shost(cdev); \ + struct Scsi_Host *shost = transport_class_to_shost(dev); \ return snprintf(buf, sz, format_string, cast fc_host_##field(shost)); \ } #define fc_private_host_rd_attr(field, format_string, sz) \ fc_private_host_show_function(field, format_string, sz, ) \ -static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ +static FC_DEVICE_ATTR(host, field, S_IRUGO, \ show_fc_host_##field, NULL) #define fc_private_host_rd_attr_cast(field, format_string, sz, cast) \ fc_private_host_show_function(field, format_string, sz, (cast)) \ -static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ +static FC_DEVICE_ATTR(host, field, S_IRUGO, \ show_fc_host_##field, NULL) #define SETUP_PRIVATE_HOST_ATTRIBUTE_RD(field) \ - i->private_host_attrs[count] = class_device_attr_host_##field; \ + i->private_host_attrs[count] = device_attr_host_##field; \ 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]; \ @@ -1377,7 +1400,7 @@ static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ #define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field) \ { \ - i->private_host_attrs[count] = class_device_attr_host_##field; \ + i->private_host_attrs[count] = device_attr_host_##field; \ i->host_attrs[count] = &i->private_host_attrs[count]; \ count++; \ } @@ -1386,38 +1409,41 @@ static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ /* Fixed Host Attributes */ static ssize_t -show_fc_host_supported_classes (struct class_device *cdev, char *buf) +show_fc_host_supported_classes (struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); if (fc_host_supported_classes(shost) == FC_COS_UNSPECIFIED) return snprintf(buf, 20, "unspecified\n"); return get_fc_cos_names(fc_host_supported_classes(shost), buf); } -static FC_CLASS_DEVICE_ATTR(host, supported_classes, S_IRUGO, +static FC_DEVICE_ATTR(host, supported_classes, S_IRUGO, show_fc_host_supported_classes, NULL); static ssize_t -show_fc_host_supported_fc4s (struct class_device *cdev, char *buf) +show_fc_host_supported_fc4s (struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); return (ssize_t)show_fc_fc4s(buf, fc_host_supported_fc4s(shost)); } -static FC_CLASS_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, +static FC_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, show_fc_host_supported_fc4s, NULL); static ssize_t -show_fc_host_supported_speeds (struct class_device *cdev, char *buf) +show_fc_host_supported_speeds (struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); if (fc_host_supported_speeds(shost) == FC_PORTSPEED_UNKNOWN) return snprintf(buf, 20, "unknown\n"); return get_fc_port_speed_names(fc_host_supported_speeds(shost), buf); } -static FC_CLASS_DEVICE_ATTR(host, supported_speeds, S_IRUGO, +static FC_DEVICE_ATTR(host, supported_speeds, S_IRUGO, show_fc_host_supported_speeds, NULL); @@ -1433,9 +1459,10 @@ fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1)); /* Dynamic Host Attributes */ static ssize_t -show_fc_host_active_fc4s (struct class_device *cdev, char *buf) +show_fc_host_active_fc4s (struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_internal *i = to_fc_internal(shost->transportt); if (i->f->get_host_active_fc4s) @@ -1443,13 +1470,14 @@ show_fc_host_active_fc4s (struct class_device *cdev, char *buf) return (ssize_t)show_fc_fc4s(buf, fc_host_active_fc4s(shost)); } -static FC_CLASS_DEVICE_ATTR(host, active_fc4s, S_IRUGO, +static FC_DEVICE_ATTR(host, active_fc4s, S_IRUGO, show_fc_host_active_fc4s, NULL); static ssize_t -show_fc_host_speed (struct class_device *cdev, char *buf) +show_fc_host_speed (struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_internal *i = to_fc_internal(shost->transportt); if (i->f->get_host_speed) @@ -1460,7 +1488,7 @@ show_fc_host_speed (struct class_device *cdev, char *buf) return get_fc_port_speed_names(fc_host_speed(shost), buf); } -static FC_CLASS_DEVICE_ATTR(host, speed, S_IRUGO, +static FC_DEVICE_ATTR(host, speed, S_IRUGO, show_fc_host_speed, NULL); @@ -1473,16 +1501,17 @@ fc_host_rd_attr(symbolic_name, "%s\n", FC_SYMBOLIC_NAME_SIZE + 1); fc_private_host_show_function(system_hostname, "%s\n", FC_SYMBOLIC_NAME_SIZE + 1, ) fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE) -static FC_CLASS_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, +static FC_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, show_fc_host_system_hostname, store_fc_host_system_hostname); /* Private Host Attributes */ static ssize_t -show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) +show_fc_private_host_tgtid_bind_type(struct device *dev, + struct device_attribute *attr, char *buf) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); const char *name; name = get_fc_tgtid_bind_type_name(fc_host_tgtid_bind_type(shost)); @@ -1495,10 +1524,10 @@ show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) pos = list_entry((head)->next, typeof(*pos), member) static ssize_t -store_fc_private_host_tgtid_bind_type(struct class_device *cdev, - const char *buf, size_t count) +store_fc_private_host_tgtid_bind_type(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_rport *rport; enum fc_tgtid_binding_type val; unsigned long flags; @@ -1523,15 +1552,15 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev, return count; } -static FC_CLASS_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR, +static FC_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR, show_fc_private_host_tgtid_bind_type, store_fc_private_host_tgtid_bind_type); static ssize_t -store_fc_private_host_issue_lip(struct class_device *cdev, - const char *buf, size_t count) +store_fc_private_host_issue_lip(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_internal *i = to_fc_internal(shost->transportt); int ret; @@ -1544,7 +1573,7 @@ store_fc_private_host_issue_lip(struct class_device *cdev, return -ENOENT; } -static FC_CLASS_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL, +static FC_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL, store_fc_private_host_issue_lip); fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20); @@ -1556,9 +1585,9 @@ fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20); /* Show a given an attribute in the statistics group */ static ssize_t -fc_stat_show(const struct class_device *cdev, char *buf, unsigned long offset) +fc_stat_show(const struct device *dev, char *buf, unsigned long offset) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_internal *i = to_fc_internal(shost->transportt); struct fc_host_statistics *stats; ssize_t ret = -ENOENT; @@ -1579,12 +1608,14 @@ fc_stat_show(const struct class_device *cdev, char *buf, unsigned long offset) /* generate a read-only statistics attribute */ #define fc_host_statistic(name) \ -static ssize_t show_fcstat_##name(struct class_device *cd, char *buf) \ +static ssize_t show_fcstat_##name(struct device *cd, \ + struct device_attribute *attr, \ + char *buf) \ { \ return fc_stat_show(cd, buf, \ offsetof(struct fc_host_statistics, name)); \ } \ -static FC_CLASS_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) +static FC_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) fc_host_statistic(seconds_since_last_reset); fc_host_statistic(tx_frames); @@ -1608,10 +1639,10 @@ fc_host_statistic(fcp_input_megabytes); fc_host_statistic(fcp_output_megabytes); static ssize_t -fc_reset_statistics(struct class_device *cdev, const char *buf, - size_t count) +fc_reset_statistics(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_internal *i = to_fc_internal(shost->transportt); /* ignore any data value written to the attribute */ @@ -1622,31 +1653,31 @@ fc_reset_statistics(struct class_device *cdev, const char *buf, return -ENOENT; } -static FC_CLASS_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, +static FC_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, fc_reset_statistics); static struct attribute *fc_statistics_attrs[] = { - &class_device_attr_host_seconds_since_last_reset.attr, - &class_device_attr_host_tx_frames.attr, - &class_device_attr_host_tx_words.attr, - &class_device_attr_host_rx_frames.attr, - &class_device_attr_host_rx_words.attr, - &class_device_attr_host_lip_count.attr, - &class_device_attr_host_nos_count.attr, - &class_device_attr_host_error_frames.attr, - &class_device_attr_host_dumped_frames.attr, - &class_device_attr_host_link_failure_count.attr, - &class_device_attr_host_loss_of_sync_count.attr, - &class_device_attr_host_loss_of_signal_count.attr, - &class_device_attr_host_prim_seq_protocol_err_count.attr, - &class_device_attr_host_invalid_tx_word_count.attr, - &class_device_attr_host_invalid_crc_count.attr, - &class_device_attr_host_fcp_input_requests.attr, - &class_device_attr_host_fcp_output_requests.attr, - &class_device_attr_host_fcp_control_requests.attr, - &class_device_attr_host_fcp_input_megabytes.attr, - &class_device_attr_host_fcp_output_megabytes.attr, - &class_device_attr_host_reset_statistics.attr, + &device_attr_host_seconds_since_last_reset.attr, + &device_attr_host_tx_frames.attr, + &device_attr_host_tx_words.attr, + &device_attr_host_rx_frames.attr, + &device_attr_host_rx_words.attr, + &device_attr_host_lip_count.attr, + &device_attr_host_nos_count.attr, + &device_attr_host_error_frames.attr, + &device_attr_host_dumped_frames.attr, + &device_attr_host_link_failure_count.attr, + &device_attr_host_loss_of_sync_count.attr, + &device_attr_host_loss_of_signal_count.attr, + &device_attr_host_prim_seq_protocol_err_count.attr, + &device_attr_host_invalid_tx_word_count.attr, + &device_attr_host_invalid_crc_count.attr, + &device_attr_host_fcp_input_requests.attr, + &device_attr_host_fcp_output_requests.attr, + &device_attr_host_fcp_control_requests.attr, + &device_attr_host_fcp_input_megabytes.attr, + &device_attr_host_fcp_output_megabytes.attr, + &device_attr_host_reset_statistics.attr, NULL }; @@ -1695,10 +1726,10 @@ fc_parse_wwn(const char *ns, u64 *nm) * as hex characters, and may *not* contain any prefixes (e.g. 0x, x, etc) */ static ssize_t -store_fc_host_vport_create(struct class_device *cdev, const char *buf, - size_t count) +store_fc_host_vport_create(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_vport_identifiers vid; struct fc_vport *vport; unsigned int cnt=count; @@ -1731,7 +1762,7 @@ store_fc_host_vport_create(struct class_device *cdev, const char *buf, stat = fc_vport_create(shost, 0, &shost->shost_gendev, &vid, &vport); return stat ? stat : count; } -static FC_CLASS_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, +static FC_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, store_fc_host_vport_create); @@ -1742,10 +1773,10 @@ static FC_CLASS_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, * any prefixes (e.g. 0x, x, etc) */ static ssize_t -store_fc_host_vport_delete(struct class_device *cdev, const char *buf, - size_t count) +store_fc_host_vport_delete(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - struct Scsi_Host *shost = transport_class_to_shost(cdev); + struct Scsi_Host *shost = transport_class_to_shost(dev); struct fc_host_attrs *fc_host = shost_to_fc_host(shost); struct fc_vport *vport; u64 wwpn, wwnn; @@ -1787,7 +1818,7 @@ store_fc_host_vport_delete(struct class_device *cdev, const char *buf, stat = fc_vport_terminate(vport); return stat ? stat : count; } -static FC_CLASS_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL, +static FC_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL, store_fc_host_vport_delete); |