aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_fc.c
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:33 -0400
commitee959b00c335d7780136c5abda37809191fe52c3 (patch)
tree7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/scsi_transport_fc.c
parent56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff)
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.c385
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,
72 * Redefine so that we can have same named attributes in the 72 * Redefine so that we can have same named attributes in the
73 * sdev/starget/host objects. 73 * sdev/starget/host objects.
74 */ 74 */
75#define FC_CLASS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ 75#define FC_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \
76struct class_device_attribute class_device_attr_##_prefix##_##_name = \ 76struct device_attribute device_attr_##_prefix##_##_name = \
77 __ATTR(_name,_mode,_show,_store) 77 __ATTR(_name,_mode,_show,_store)
78 78
79#define fc_enum_name_search(title, table_type, table) \ 79#define fc_enum_name_search(title, table_type, table) \
@@ -326,26 +326,26 @@ struct fc_internal {
326 * part of the midlayer. As the remote port is specific to the 326 * part of the midlayer. As the remote port is specific to the
327 * fc transport, we must provide the attribute container. 327 * fc transport, we must provide the attribute container.
328 */ 328 */
329 struct class_device_attribute private_starget_attrs[ 329 struct device_attribute private_starget_attrs[
330 FC_STARGET_NUM_ATTRS]; 330 FC_STARGET_NUM_ATTRS];
331 struct class_device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1]; 331 struct device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1];
332 332
333 struct class_device_attribute private_host_attrs[FC_HOST_NUM_ATTRS]; 333 struct device_attribute private_host_attrs[FC_HOST_NUM_ATTRS];
334 struct class_device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1]; 334 struct device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1];
335 335
336 struct transport_container rport_attr_cont; 336 struct transport_container rport_attr_cont;
337 struct class_device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS]; 337 struct device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS];
338 struct class_device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1]; 338 struct device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1];
339 339
340 struct transport_container vport_attr_cont; 340 struct transport_container vport_attr_cont;
341 struct class_device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS]; 341 struct device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS];
342 struct class_device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1]; 342 struct device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1];
343}; 343};
344 344
345#define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t) 345#define to_fc_internal(tmpl) container_of(tmpl, struct fc_internal, t)
346 346
347static int fc_target_setup(struct transport_container *tc, struct device *dev, 347static int fc_target_setup(struct transport_container *tc, struct device *dev,
348 struct class_device *cdev) 348 struct device *cdev)
349{ 349{
350 struct scsi_target *starget = to_scsi_target(dev); 350 struct scsi_target *starget = to_scsi_target(dev);
351 struct fc_rport *rport = starget_to_rport(starget); 351 struct fc_rport *rport = starget_to_rport(starget);
@@ -375,7 +375,7 @@ static DECLARE_TRANSPORT_CLASS(fc_transport_class,
375 NULL); 375 NULL);
376 376
377static int fc_host_setup(struct transport_container *tc, struct device *dev, 377static int fc_host_setup(struct transport_container *tc, struct device *dev,
378 struct class_device *cdev) 378 struct device *cdev)
379{ 379{
380 struct Scsi_Host *shost = dev_to_shost(dev); 380 struct Scsi_Host *shost = dev_to_shost(dev);
381 struct fc_host_attrs *fc_host = shost_to_fc_host(shost); 381 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
@@ -682,9 +682,10 @@ static void __exit fc_transport_exit(void)
682 682
683#define fc_rport_show_function(field, format_string, sz, cast) \ 683#define fc_rport_show_function(field, format_string, sz, cast) \
684static ssize_t \ 684static ssize_t \
685show_fc_rport_##field (struct class_device *cdev, char *buf) \ 685show_fc_rport_##field (struct device *dev, \
686 struct device_attribute *attr, char *buf) \
686{ \ 687{ \
687 struct fc_rport *rport = transport_class_to_rport(cdev); \ 688 struct fc_rport *rport = transport_class_to_rport(dev); \
688 struct Scsi_Host *shost = rport_to_shost(rport); \ 689 struct Scsi_Host *shost = rport_to_shost(rport); \
689 struct fc_internal *i = to_fc_internal(shost->transportt); \ 690 struct fc_internal *i = to_fc_internal(shost->transportt); \
690 if ((i->f->get_rport_##field) && \ 691 if ((i->f->get_rport_##field) && \
@@ -697,11 +698,12 @@ show_fc_rport_##field (struct class_device *cdev, char *buf) \
697 698
698#define fc_rport_store_function(field) \ 699#define fc_rport_store_function(field) \
699static ssize_t \ 700static ssize_t \
700store_fc_rport_##field(struct class_device *cdev, const char *buf, \ 701store_fc_rport_##field(struct device *dev, \
701 size_t count) \ 702 struct device_attribute *attr, \
703 const char *buf, size_t count) \
702{ \ 704{ \
703 int val; \ 705 int val; \
704 struct fc_rport *rport = transport_class_to_rport(cdev); \ 706 struct fc_rport *rport = transport_class_to_rport(dev); \
705 struct Scsi_Host *shost = rport_to_shost(rport); \ 707 struct Scsi_Host *shost = rport_to_shost(rport); \
706 struct fc_internal *i = to_fc_internal(shost->transportt); \ 708 struct fc_internal *i = to_fc_internal(shost->transportt); \
707 char *cp; \ 709 char *cp; \
@@ -718,58 +720,60 @@ store_fc_rport_##field(struct class_device *cdev, const char *buf, \
718 720
719#define fc_rport_rd_attr(field, format_string, sz) \ 721#define fc_rport_rd_attr(field, format_string, sz) \
720 fc_rport_show_function(field, format_string, sz, ) \ 722 fc_rport_show_function(field, format_string, sz, ) \
721static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 723static FC_DEVICE_ATTR(rport, field, S_IRUGO, \
722 show_fc_rport_##field, NULL) 724 show_fc_rport_##field, NULL)
723 725
724#define fc_rport_rd_attr_cast(field, format_string, sz, cast) \ 726#define fc_rport_rd_attr_cast(field, format_string, sz, cast) \
725 fc_rport_show_function(field, format_string, sz, (cast)) \ 727 fc_rport_show_function(field, format_string, sz, (cast)) \
726static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 728static FC_DEVICE_ATTR(rport, field, S_IRUGO, \
727 show_fc_rport_##field, NULL) 729 show_fc_rport_##field, NULL)
728 730
729#define fc_rport_rw_attr(field, format_string, sz) \ 731#define fc_rport_rw_attr(field, format_string, sz) \
730 fc_rport_show_function(field, format_string, sz, ) \ 732 fc_rport_show_function(field, format_string, sz, ) \
731 fc_rport_store_function(field) \ 733 fc_rport_store_function(field) \
732static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \ 734static FC_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \
733 show_fc_rport_##field, \ 735 show_fc_rport_##field, \
734 store_fc_rport_##field) 736 store_fc_rport_##field)
735 737
736 738
737#define fc_private_rport_show_function(field, format_string, sz, cast) \ 739#define fc_private_rport_show_function(field, format_string, sz, cast) \
738static ssize_t \ 740static ssize_t \
739show_fc_rport_##field (struct class_device *cdev, char *buf) \ 741show_fc_rport_##field (struct device *dev, \
742 struct device_attribute *attr, char *buf) \
740{ \ 743{ \
741 struct fc_rport *rport = transport_class_to_rport(cdev); \ 744 struct fc_rport *rport = transport_class_to_rport(dev); \
742 return snprintf(buf, sz, format_string, cast rport->field); \ 745 return snprintf(buf, sz, format_string, cast rport->field); \
743} 746}
744 747
745#define fc_private_rport_rd_attr(field, format_string, sz) \ 748#define fc_private_rport_rd_attr(field, format_string, sz) \
746 fc_private_rport_show_function(field, format_string, sz, ) \ 749 fc_private_rport_show_function(field, format_string, sz, ) \
747static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 750static FC_DEVICE_ATTR(rport, field, S_IRUGO, \
748 show_fc_rport_##field, NULL) 751 show_fc_rport_##field, NULL)
749 752
750#define fc_private_rport_rd_attr_cast(field, format_string, sz, cast) \ 753#define fc_private_rport_rd_attr_cast(field, format_string, sz, cast) \
751 fc_private_rport_show_function(field, format_string, sz, (cast)) \ 754 fc_private_rport_show_function(field, format_string, sz, (cast)) \
752static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ 755static FC_DEVICE_ATTR(rport, field, S_IRUGO, \
753 show_fc_rport_##field, NULL) 756 show_fc_rport_##field, NULL)
754 757
755 758
756#define fc_private_rport_rd_enum_attr(title, maxlen) \ 759#define fc_private_rport_rd_enum_attr(title, maxlen) \
757static ssize_t \ 760static ssize_t \
758show_fc_rport_##title (struct class_device *cdev, char *buf) \ 761show_fc_rport_##title (struct device *dev, \
762 struct device_attribute *attr, char *buf) \
759{ \ 763{ \
760 struct fc_rport *rport = transport_class_to_rport(cdev); \ 764 struct fc_rport *rport = transport_class_to_rport(dev); \
761 const char *name; \ 765 const char *name; \
762 name = get_fc_##title##_name(rport->title); \ 766 name = get_fc_##title##_name(rport->title); \
763 if (!name) \ 767 if (!name) \
764 return -EINVAL; \ 768 return -EINVAL; \
765 return snprintf(buf, maxlen, "%s\n", name); \ 769 return snprintf(buf, maxlen, "%s\n", name); \
766} \ 770} \
767static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ 771static FC_DEVICE_ATTR(rport, title, S_IRUGO, \
768 show_fc_rport_##title, NULL) 772 show_fc_rport_##title, NULL)
769 773
770 774
771#define SETUP_RPORT_ATTRIBUTE_RD(field) \ 775#define SETUP_RPORT_ATTRIBUTE_RD(field) \
772 i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 776 i->private_rport_attrs[count] = device_attr_rport_##field; \
773 i->private_rport_attrs[count].attr.mode = S_IRUGO; \ 777 i->private_rport_attrs[count].attr.mode = S_IRUGO; \
774 i->private_rport_attrs[count].store = NULL; \ 778 i->private_rport_attrs[count].store = NULL; \
775 i->rport_attrs[count] = &i->private_rport_attrs[count]; \ 779 i->rport_attrs[count] = &i->private_rport_attrs[count]; \
@@ -777,14 +781,14 @@ static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \
777 count++ 781 count++
778 782
779#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(field) \ 783#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RD(field) \
780 i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 784 i->private_rport_attrs[count] = device_attr_rport_##field; \
781 i->private_rport_attrs[count].attr.mode = S_IRUGO; \ 785 i->private_rport_attrs[count].attr.mode = S_IRUGO; \
782 i->private_rport_attrs[count].store = NULL; \ 786 i->private_rport_attrs[count].store = NULL; \
783 i->rport_attrs[count] = &i->private_rport_attrs[count]; \ 787 i->rport_attrs[count] = &i->private_rport_attrs[count]; \
784 count++ 788 count++
785 789
786#define SETUP_RPORT_ATTRIBUTE_RW(field) \ 790#define SETUP_RPORT_ATTRIBUTE_RW(field) \
787 i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 791 i->private_rport_attrs[count] = device_attr_rport_##field; \
788 if (!i->f->set_rport_##field) { \ 792 if (!i->f->set_rport_##field) { \
789 i->private_rport_attrs[count].attr.mode = S_IRUGO; \ 793 i->private_rport_attrs[count].attr.mode = S_IRUGO; \
790 i->private_rport_attrs[count].store = NULL; \ 794 i->private_rport_attrs[count].store = NULL; \
@@ -795,7 +799,7 @@ static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \
795 799
796#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(field) \ 800#define SETUP_PRIVATE_RPORT_ATTRIBUTE_RW(field) \
797{ \ 801{ \
798 i->private_rport_attrs[count] = class_device_attr_rport_##field; \ 802 i->private_rport_attrs[count] = device_attr_rport_##field; \
799 i->rport_attrs[count] = &i->private_rport_attrs[count]; \ 803 i->rport_attrs[count] = &i->private_rport_attrs[count]; \
800 count++; \ 804 count++; \
801} 805}
@@ -808,14 +812,15 @@ static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \
808fc_private_rport_rd_attr(maxframe_size, "%u bytes\n", 20); 812fc_private_rport_rd_attr(maxframe_size, "%u bytes\n", 20);
809 813
810static ssize_t 814static ssize_t
811show_fc_rport_supported_classes (struct class_device *cdev, char *buf) 815show_fc_rport_supported_classes (struct device *dev,
816 struct device_attribute *attr, char *buf)
812{ 817{
813 struct fc_rport *rport = transport_class_to_rport(cdev); 818 struct fc_rport *rport = transport_class_to_rport(dev);
814 if (rport->supported_classes == FC_COS_UNSPECIFIED) 819 if (rport->supported_classes == FC_COS_UNSPECIFIED)
815 return snprintf(buf, 20, "unspecified\n"); 820 return snprintf(buf, 20, "unspecified\n");
816 return get_fc_cos_names(rport->supported_classes, buf); 821 return get_fc_cos_names(rport->supported_classes, buf);
817} 822}
818static FC_CLASS_DEVICE_ATTR(rport, supported_classes, S_IRUGO, 823static FC_DEVICE_ATTR(rport, supported_classes, S_IRUGO,
819 show_fc_rport_supported_classes, NULL); 824 show_fc_rport_supported_classes, NULL);
820 825
821/* Dynamic Remote Port Attributes */ 826/* Dynamic Remote Port Attributes */
@@ -825,11 +830,11 @@ static FC_CLASS_DEVICE_ATTR(rport, supported_classes, S_IRUGO,
825 */ 830 */
826fc_rport_show_function(dev_loss_tmo, "%d\n", 20, ) 831fc_rport_show_function(dev_loss_tmo, "%d\n", 20, )
827static ssize_t 832static ssize_t
828store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf, 833store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
829 size_t count) 834 const char *buf, size_t count)
830{ 835{
831 int val; 836 int val;
832 struct fc_rport *rport = transport_class_to_rport(cdev); 837 struct fc_rport *rport = transport_class_to_rport(dev);
833 struct Scsi_Host *shost = rport_to_shost(rport); 838 struct Scsi_Host *shost = rport_to_shost(rport);
834 struct fc_internal *i = to_fc_internal(shost->transportt); 839 struct fc_internal *i = to_fc_internal(shost->transportt);
835 char *cp; 840 char *cp;
@@ -844,7 +849,7 @@ store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf,
844 i->f->set_rport_dev_loss_tmo(rport, val); 849 i->f->set_rport_dev_loss_tmo(rport, val);
845 return count; 850 return count;
846} 851}
847static FC_CLASS_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR, 852static FC_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR,
848 show_fc_rport_dev_loss_tmo, store_fc_rport_dev_loss_tmo); 853 show_fc_rport_dev_loss_tmo, store_fc_rport_dev_loss_tmo);
849 854
850 855
@@ -855,9 +860,10 @@ fc_private_rport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long);
855fc_private_rport_rd_attr(port_id, "0x%06x\n", 20); 860fc_private_rport_rd_attr(port_id, "0x%06x\n", 20);
856 861
857static ssize_t 862static ssize_t
858show_fc_rport_roles (struct class_device *cdev, char *buf) 863show_fc_rport_roles (struct device *dev, struct device_attribute *attr,
864 char *buf)
859{ 865{
860 struct fc_rport *rport = transport_class_to_rport(cdev); 866 struct fc_rport *rport = transport_class_to_rport(dev);
861 867
862 /* identify any roles that are port_id specific */ 868 /* identify any roles that are port_id specific */
863 if ((rport->port_id != -1) && 869 if ((rport->port_id != -1) &&
@@ -883,7 +889,7 @@ show_fc_rport_roles (struct class_device *cdev, char *buf)
883 return get_fc_port_roles_names(rport->roles, buf); 889 return get_fc_port_roles_names(rport->roles, buf);
884 } 890 }
885} 891}
886static FC_CLASS_DEVICE_ATTR(rport, roles, S_IRUGO, 892static FC_DEVICE_ATTR(rport, roles, S_IRUGO,
887 show_fc_rport_roles, NULL); 893 show_fc_rport_roles, NULL);
888 894
889fc_private_rport_rd_enum_attr(port_state, FC_PORTSTATE_MAX_NAMELEN); 895fc_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);
893 * fast_io_fail_tmo attribute 899 * fast_io_fail_tmo attribute
894 */ 900 */
895static ssize_t 901static ssize_t
896show_fc_rport_fast_io_fail_tmo (struct class_device *cdev, char *buf) 902show_fc_rport_fast_io_fail_tmo (struct device *dev,
903 struct device_attribute *attr, char *buf)
897{ 904{
898 struct fc_rport *rport = transport_class_to_rport(cdev); 905 struct fc_rport *rport = transport_class_to_rport(dev);
899 906
900 if (rport->fast_io_fail_tmo == -1) 907 if (rport->fast_io_fail_tmo == -1)
901 return snprintf(buf, 5, "off\n"); 908 return snprintf(buf, 5, "off\n");
@@ -903,12 +910,13 @@ show_fc_rport_fast_io_fail_tmo (struct class_device *cdev, char *buf)
903} 910}
904 911
905static ssize_t 912static ssize_t
906store_fc_rport_fast_io_fail_tmo(struct class_device *cdev, const char *buf, 913store_fc_rport_fast_io_fail_tmo(struct device *dev,
907 size_t count) 914 struct device_attribute *attr, const char *buf,
915 size_t count)
908{ 916{
909 int val; 917 int val;
910 char *cp; 918 char *cp;
911 struct fc_rport *rport = transport_class_to_rport(cdev); 919 struct fc_rport *rport = transport_class_to_rport(dev);
912 920
913 if ((rport->port_state == FC_PORTSTATE_BLOCKED) || 921 if ((rport->port_state == FC_PORTSTATE_BLOCKED) ||
914 (rport->port_state == FC_PORTSTATE_DELETED) || 922 (rport->port_state == FC_PORTSTATE_DELETED) ||
@@ -925,7 +933,7 @@ store_fc_rport_fast_io_fail_tmo(struct class_device *cdev, const char *buf,
925 } 933 }
926 return count; 934 return count;
927} 935}
928static FC_CLASS_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, 936static FC_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR,
929 show_fc_rport_fast_io_fail_tmo, store_fc_rport_fast_io_fail_tmo); 937 show_fc_rport_fast_io_fail_tmo, store_fc_rport_fast_io_fail_tmo);
930 938
931 939
@@ -941,9 +949,10 @@ static FC_CLASS_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR,
941 */ 949 */
942#define fc_starget_show_function(field, format_string, sz, cast) \ 950#define fc_starget_show_function(field, format_string, sz, cast) \
943static ssize_t \ 951static ssize_t \
944show_fc_starget_##field (struct class_device *cdev, char *buf) \ 952show_fc_starget_##field (struct device *dev, \
953 struct device_attribute *attr, char *buf) \
945{ \ 954{ \
946 struct scsi_target *starget = transport_class_to_starget(cdev); \ 955 struct scsi_target *starget = transport_class_to_starget(dev); \
947 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ 956 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \
948 struct fc_internal *i = to_fc_internal(shost->transportt); \ 957 struct fc_internal *i = to_fc_internal(shost->transportt); \
949 struct fc_rport *rport = starget_to_rport(starget); \ 958 struct fc_rport *rport = starget_to_rport(starget); \
@@ -957,16 +966,16 @@ show_fc_starget_##field (struct class_device *cdev, char *buf) \
957 966
958#define fc_starget_rd_attr(field, format_string, sz) \ 967#define fc_starget_rd_attr(field, format_string, sz) \
959 fc_starget_show_function(field, format_string, sz, ) \ 968 fc_starget_show_function(field, format_string, sz, ) \
960static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ 969static FC_DEVICE_ATTR(starget, field, S_IRUGO, \
961 show_fc_starget_##field, NULL) 970 show_fc_starget_##field, NULL)
962 971
963#define fc_starget_rd_attr_cast(field, format_string, sz, cast) \ 972#define fc_starget_rd_attr_cast(field, format_string, sz, cast) \
964 fc_starget_show_function(field, format_string, sz, (cast)) \ 973 fc_starget_show_function(field, format_string, sz, (cast)) \
965static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ 974static FC_DEVICE_ATTR(starget, field, S_IRUGO, \
966 show_fc_starget_##field, NULL) 975 show_fc_starget_##field, NULL)
967 976
968#define SETUP_STARGET_ATTRIBUTE_RD(field) \ 977#define SETUP_STARGET_ATTRIBUTE_RD(field) \
969 i->private_starget_attrs[count] = class_device_attr_starget_##field; \ 978 i->private_starget_attrs[count] = device_attr_starget_##field; \
970 i->private_starget_attrs[count].attr.mode = S_IRUGO; \ 979 i->private_starget_attrs[count].attr.mode = S_IRUGO; \
971 i->private_starget_attrs[count].store = NULL; \ 980 i->private_starget_attrs[count].store = NULL; \
972 i->starget_attrs[count] = &i->private_starget_attrs[count]; \ 981 i->starget_attrs[count] = &i->private_starget_attrs[count]; \
@@ -974,7 +983,7 @@ static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \
974 count++ 983 count++
975 984
976#define SETUP_STARGET_ATTRIBUTE_RW(field) \ 985#define SETUP_STARGET_ATTRIBUTE_RW(field) \
977 i->private_starget_attrs[count] = class_device_attr_starget_##field; \ 986 i->private_starget_attrs[count] = device_attr_starget_##field; \
978 if (!i->f->set_starget_##field) { \ 987 if (!i->f->set_starget_##field) { \
979 i->private_starget_attrs[count].attr.mode = S_IRUGO; \ 988 i->private_starget_attrs[count].attr.mode = S_IRUGO; \
980 i->private_starget_attrs[count].store = NULL; \ 989 i->private_starget_attrs[count].store = NULL; \
@@ -995,9 +1004,10 @@ fc_starget_rd_attr(port_id, "0x%06x\n", 20);
995 1004
996#define fc_vport_show_function(field, format_string, sz, cast) \ 1005#define fc_vport_show_function(field, format_string, sz, cast) \
997static ssize_t \ 1006static ssize_t \
998show_fc_vport_##field (struct class_device *cdev, char *buf) \ 1007show_fc_vport_##field (struct device *dev, \
1008 struct device_attribute *attr, char *buf) \
999{ \ 1009{ \
1000 struct fc_vport *vport = transport_class_to_vport(cdev); \ 1010 struct fc_vport *vport = transport_class_to_vport(dev); \
1001 struct Scsi_Host *shost = vport_to_shost(vport); \ 1011 struct Scsi_Host *shost = vport_to_shost(vport); \
1002 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1012 struct fc_internal *i = to_fc_internal(shost->transportt); \
1003 if ((i->f->get_vport_##field) && \ 1013 if ((i->f->get_vport_##field) && \
@@ -1008,11 +1018,12 @@ show_fc_vport_##field (struct class_device *cdev, char *buf) \
1008 1018
1009#define fc_vport_store_function(field) \ 1019#define fc_vport_store_function(field) \
1010static ssize_t \ 1020static ssize_t \
1011store_fc_vport_##field(struct class_device *cdev, const char *buf, \ 1021store_fc_vport_##field(struct device *dev, \
1012 size_t count) \ 1022 struct device_attribute *attr, \
1023 const char *buf, size_t count) \
1013{ \ 1024{ \
1014 int val; \ 1025 int val; \
1015 struct fc_vport *vport = transport_class_to_vport(cdev); \ 1026 struct fc_vport *vport = transport_class_to_vport(dev); \
1016 struct Scsi_Host *shost = vport_to_shost(vport); \ 1027 struct Scsi_Host *shost = vport_to_shost(vport); \
1017 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1028 struct fc_internal *i = to_fc_internal(shost->transportt); \
1018 char *cp; \ 1029 char *cp; \
@@ -1027,10 +1038,11 @@ store_fc_vport_##field(struct class_device *cdev, const char *buf, \
1027 1038
1028#define fc_vport_store_str_function(field, slen) \ 1039#define fc_vport_store_str_function(field, slen) \
1029static ssize_t \ 1040static ssize_t \
1030store_fc_vport_##field(struct class_device *cdev, const char *buf, \ 1041store_fc_vport_##field(struct device *dev, \
1031 size_t count) \ 1042 struct device_attribute *attr, \
1043 const char *buf, size_t count) \
1032{ \ 1044{ \
1033 struct fc_vport *vport = transport_class_to_vport(cdev); \ 1045 struct fc_vport *vport = transport_class_to_vport(dev); \
1034 struct Scsi_Host *shost = vport_to_shost(vport); \ 1046 struct Scsi_Host *shost = vport_to_shost(vport); \
1035 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1047 struct fc_internal *i = to_fc_internal(shost->transportt); \
1036 unsigned int cnt=count; \ 1048 unsigned int cnt=count; \
@@ -1047,36 +1059,38 @@ store_fc_vport_##field(struct class_device *cdev, const char *buf, \
1047 1059
1048#define fc_vport_rd_attr(field, format_string, sz) \ 1060#define fc_vport_rd_attr(field, format_string, sz) \
1049 fc_vport_show_function(field, format_string, sz, ) \ 1061 fc_vport_show_function(field, format_string, sz, ) \
1050static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1062static FC_DEVICE_ATTR(vport, field, S_IRUGO, \
1051 show_fc_vport_##field, NULL) 1063 show_fc_vport_##field, NULL)
1052 1064
1053#define fc_vport_rd_attr_cast(field, format_string, sz, cast) \ 1065#define fc_vport_rd_attr_cast(field, format_string, sz, cast) \
1054 fc_vport_show_function(field, format_string, sz, (cast)) \ 1066 fc_vport_show_function(field, format_string, sz, (cast)) \
1055static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1067static FC_DEVICE_ATTR(vport, field, S_IRUGO, \
1056 show_fc_vport_##field, NULL) 1068 show_fc_vport_##field, NULL)
1057 1069
1058#define fc_vport_rw_attr(field, format_string, sz) \ 1070#define fc_vport_rw_attr(field, format_string, sz) \
1059 fc_vport_show_function(field, format_string, sz, ) \ 1071 fc_vport_show_function(field, format_string, sz, ) \
1060 fc_vport_store_function(field) \ 1072 fc_vport_store_function(field) \
1061static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ 1073static FC_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \
1062 show_fc_vport_##field, \ 1074 show_fc_vport_##field, \
1063 store_fc_vport_##field) 1075 store_fc_vport_##field)
1064 1076
1065#define fc_private_vport_show_function(field, format_string, sz, cast) \ 1077#define fc_private_vport_show_function(field, format_string, sz, cast) \
1066static ssize_t \ 1078static ssize_t \
1067show_fc_vport_##field (struct class_device *cdev, char *buf) \ 1079show_fc_vport_##field (struct device *dev, \
1080 struct device_attribute *attr, char *buf) \
1068{ \ 1081{ \
1069 struct fc_vport *vport = transport_class_to_vport(cdev); \ 1082 struct fc_vport *vport = transport_class_to_vport(dev); \
1070 return snprintf(buf, sz, format_string, cast vport->field); \ 1083 return snprintf(buf, sz, format_string, cast vport->field); \
1071} 1084}
1072 1085
1073#define fc_private_vport_store_u32_function(field) \ 1086#define fc_private_vport_store_u32_function(field) \
1074static ssize_t \ 1087static ssize_t \
1075store_fc_vport_##field(struct class_device *cdev, const char *buf, \ 1088store_fc_vport_##field(struct device *dev, \
1076 size_t count) \ 1089 struct device_attribute *attr, \
1090 const char *buf, size_t count) \
1077{ \ 1091{ \
1078 u32 val; \ 1092 u32 val; \
1079 struct fc_vport *vport = transport_class_to_vport(cdev); \ 1093 struct fc_vport *vport = transport_class_to_vport(dev); \
1080 char *cp; \ 1094 char *cp; \
1081 if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) \ 1095 if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) \
1082 return -EBUSY; \ 1096 return -EBUSY; \
@@ -1090,39 +1104,41 @@ store_fc_vport_##field(struct class_device *cdev, const char *buf, \
1090 1104
1091#define fc_private_vport_rd_attr(field, format_string, sz) \ 1105#define fc_private_vport_rd_attr(field, format_string, sz) \
1092 fc_private_vport_show_function(field, format_string, sz, ) \ 1106 fc_private_vport_show_function(field, format_string, sz, ) \
1093static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1107static FC_DEVICE_ATTR(vport, field, S_IRUGO, \
1094 show_fc_vport_##field, NULL) 1108 show_fc_vport_##field, NULL)
1095 1109
1096#define fc_private_vport_rd_attr_cast(field, format_string, sz, cast) \ 1110#define fc_private_vport_rd_attr_cast(field, format_string, sz, cast) \
1097 fc_private_vport_show_function(field, format_string, sz, (cast)) \ 1111 fc_private_vport_show_function(field, format_string, sz, (cast)) \
1098static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ 1112static FC_DEVICE_ATTR(vport, field, S_IRUGO, \
1099 show_fc_vport_##field, NULL) 1113 show_fc_vport_##field, NULL)
1100 1114
1101#define fc_private_vport_rw_u32_attr(field, format_string, sz) \ 1115#define fc_private_vport_rw_u32_attr(field, format_string, sz) \
1102 fc_private_vport_show_function(field, format_string, sz, ) \ 1116 fc_private_vport_show_function(field, format_string, sz, ) \
1103 fc_private_vport_store_u32_function(field) \ 1117 fc_private_vport_store_u32_function(field) \
1104static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ 1118static FC_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \
1105 show_fc_vport_##field, \ 1119 show_fc_vport_##field, \
1106 store_fc_vport_##field) 1120 store_fc_vport_##field)
1107 1121
1108 1122
1109#define fc_private_vport_rd_enum_attr(title, maxlen) \ 1123#define fc_private_vport_rd_enum_attr(title, maxlen) \
1110static ssize_t \ 1124static ssize_t \
1111show_fc_vport_##title (struct class_device *cdev, char *buf) \ 1125show_fc_vport_##title (struct device *dev, \
1126 struct device_attribute *attr, \
1127 char *buf) \
1112{ \ 1128{ \
1113 struct fc_vport *vport = transport_class_to_vport(cdev); \ 1129 struct fc_vport *vport = transport_class_to_vport(dev); \
1114 const char *name; \ 1130 const char *name; \
1115 name = get_fc_##title##_name(vport->title); \ 1131 name = get_fc_##title##_name(vport->title); \
1116 if (!name) \ 1132 if (!name) \
1117 return -EINVAL; \ 1133 return -EINVAL; \
1118 return snprintf(buf, maxlen, "%s\n", name); \ 1134 return snprintf(buf, maxlen, "%s\n", name); \
1119} \ 1135} \
1120static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \ 1136static FC_DEVICE_ATTR(vport, title, S_IRUGO, \
1121 show_fc_vport_##title, NULL) 1137 show_fc_vport_##title, NULL)
1122 1138
1123 1139
1124#define SETUP_VPORT_ATTRIBUTE_RD(field) \ 1140#define SETUP_VPORT_ATTRIBUTE_RD(field) \
1125 i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1141 i->private_vport_attrs[count] = device_attr_vport_##field; \
1126 i->private_vport_attrs[count].attr.mode = S_IRUGO; \ 1142 i->private_vport_attrs[count].attr.mode = S_IRUGO; \
1127 i->private_vport_attrs[count].store = NULL; \ 1143 i->private_vport_attrs[count].store = NULL; \
1128 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1144 i->vport_attrs[count] = &i->private_vport_attrs[count]; \
@@ -1131,21 +1147,21 @@ static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \
1131 /* NOTE: Above MACRO differs: checks function not show bit */ 1147 /* NOTE: Above MACRO differs: checks function not show bit */
1132 1148
1133#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(field) \ 1149#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RD(field) \
1134 i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1150 i->private_vport_attrs[count] = device_attr_vport_##field; \
1135 i->private_vport_attrs[count].attr.mode = S_IRUGO; \ 1151 i->private_vport_attrs[count].attr.mode = S_IRUGO; \
1136 i->private_vport_attrs[count].store = NULL; \ 1152 i->private_vport_attrs[count].store = NULL; \
1137 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1153 i->vport_attrs[count] = &i->private_vport_attrs[count]; \
1138 count++ 1154 count++
1139 1155
1140#define SETUP_VPORT_ATTRIBUTE_WR(field) \ 1156#define SETUP_VPORT_ATTRIBUTE_WR(field) \
1141 i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1157 i->private_vport_attrs[count] = device_attr_vport_##field; \
1142 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1158 i->vport_attrs[count] = &i->private_vport_attrs[count]; \
1143 if (i->f->field) \ 1159 if (i->f->field) \
1144 count++ 1160 count++
1145 /* NOTE: Above MACRO differs: checks function */ 1161 /* NOTE: Above MACRO differs: checks function */
1146 1162
1147#define SETUP_VPORT_ATTRIBUTE_RW(field) \ 1163#define SETUP_VPORT_ATTRIBUTE_RW(field) \
1148 i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1164 i->private_vport_attrs[count] = device_attr_vport_##field; \
1149 if (!i->f->set_vport_##field) { \ 1165 if (!i->f->set_vport_##field) { \
1150 i->private_vport_attrs[count].attr.mode = S_IRUGO; \ 1166 i->private_vport_attrs[count].attr.mode = S_IRUGO; \
1151 i->private_vport_attrs[count].store = NULL; \ 1167 i->private_vport_attrs[count].store = NULL; \
@@ -1156,7 +1172,7 @@ static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \
1156 1172
1157#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RW(field) \ 1173#define SETUP_PRIVATE_VPORT_ATTRIBUTE_RW(field) \
1158{ \ 1174{ \
1159 i->private_vport_attrs[count] = class_device_attr_vport_##field; \ 1175 i->private_vport_attrs[count] = device_attr_vport_##field; \
1160 i->vport_attrs[count] = &i->private_vport_attrs[count]; \ 1176 i->vport_attrs[count] = &i->private_vport_attrs[count]; \
1161 count++; \ 1177 count++; \
1162} 1178}
@@ -1176,35 +1192,36 @@ fc_private_vport_rd_attr_cast(node_name, "0x%llx\n", 20, unsigned long long);
1176fc_private_vport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); 1192fc_private_vport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long);
1177 1193
1178static ssize_t 1194static ssize_t
1179show_fc_vport_roles (struct class_device *cdev, char *buf) 1195show_fc_vport_roles (struct device *dev, struct device_attribute *attr,
1196 char *buf)
1180{ 1197{
1181 struct fc_vport *vport = transport_class_to_vport(cdev); 1198 struct fc_vport *vport = transport_class_to_vport(dev);
1182 1199
1183 if (vport->roles == FC_PORT_ROLE_UNKNOWN) 1200 if (vport->roles == FC_PORT_ROLE_UNKNOWN)
1184 return snprintf(buf, 20, "unknown\n"); 1201 return snprintf(buf, 20, "unknown\n");
1185 return get_fc_port_roles_names(vport->roles, buf); 1202 return get_fc_port_roles_names(vport->roles, buf);
1186} 1203}
1187static FC_CLASS_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); 1204static FC_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL);
1188 1205
1189fc_private_vport_rd_enum_attr(vport_type, FC_PORTTYPE_MAX_NAMELEN); 1206fc_private_vport_rd_enum_attr(vport_type, FC_PORTTYPE_MAX_NAMELEN);
1190 1207
1191fc_private_vport_show_function(symbolic_name, "%s\n", 1208fc_private_vport_show_function(symbolic_name, "%s\n",
1192 FC_VPORT_SYMBOLIC_NAMELEN + 1, ) 1209 FC_VPORT_SYMBOLIC_NAMELEN + 1, )
1193fc_vport_store_str_function(symbolic_name, FC_VPORT_SYMBOLIC_NAMELEN) 1210fc_vport_store_str_function(symbolic_name, FC_VPORT_SYMBOLIC_NAMELEN)
1194static FC_CLASS_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR, 1211static FC_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR,
1195 show_fc_vport_symbolic_name, store_fc_vport_symbolic_name); 1212 show_fc_vport_symbolic_name, store_fc_vport_symbolic_name);
1196 1213
1197static ssize_t 1214static ssize_t
1198store_fc_vport_delete(struct class_device *cdev, const char *buf, 1215store_fc_vport_delete(struct device *dev, struct device_attribute *attr,
1199 size_t count) 1216 const char *buf, size_t count)
1200{ 1217{
1201 struct fc_vport *vport = transport_class_to_vport(cdev); 1218 struct fc_vport *vport = transport_class_to_vport(dev);
1202 struct Scsi_Host *shost = vport_to_shost(vport); 1219 struct Scsi_Host *shost = vport_to_shost(vport);
1203 1220
1204 fc_queue_work(shost, &vport->vport_delete_work); 1221 fc_queue_work(shost, &vport->vport_delete_work);
1205 return count; 1222 return count;
1206} 1223}
1207static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, 1224static FC_DEVICE_ATTR(vport, vport_delete, S_IWUSR,
1208 NULL, store_fc_vport_delete); 1225 NULL, store_fc_vport_delete);
1209 1226
1210 1227
@@ -1213,10 +1230,11 @@ static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR,
1213 * Write "1" to disable, write "0" to enable 1230 * Write "1" to disable, write "0" to enable
1214 */ 1231 */
1215static ssize_t 1232static ssize_t
1216store_fc_vport_disable(struct class_device *cdev, const char *buf, 1233store_fc_vport_disable(struct device *dev, struct device_attribute *attr,
1234 const char *buf,
1217 size_t count) 1235 size_t count)
1218{ 1236{
1219 struct fc_vport *vport = transport_class_to_vport(cdev); 1237 struct fc_vport *vport = transport_class_to_vport(dev);
1220 struct Scsi_Host *shost = vport_to_shost(vport); 1238 struct Scsi_Host *shost = vport_to_shost(vport);
1221 struct fc_internal *i = to_fc_internal(shost->transportt); 1239 struct fc_internal *i = to_fc_internal(shost->transportt);
1222 int stat; 1240 int stat;
@@ -1236,7 +1254,7 @@ store_fc_vport_disable(struct class_device *cdev, const char *buf,
1236 stat = i->f->vport_disable(vport, ((*buf == '0') ? false : true)); 1254 stat = i->f->vport_disable(vport, ((*buf == '0') ? false : true));
1237 return stat ? stat : count; 1255 return stat ? stat : count;
1238} 1256}
1239static FC_CLASS_DEVICE_ATTR(vport, vport_disable, S_IWUSR, 1257static FC_DEVICE_ATTR(vport, vport_disable, S_IWUSR,
1240 NULL, store_fc_vport_disable); 1258 NULL, store_fc_vport_disable);
1241 1259
1242 1260
@@ -1246,9 +1264,10 @@ static FC_CLASS_DEVICE_ATTR(vport, vport_disable, S_IWUSR,
1246 1264
1247#define fc_host_show_function(field, format_string, sz, cast) \ 1265#define fc_host_show_function(field, format_string, sz, cast) \
1248static ssize_t \ 1266static ssize_t \
1249show_fc_host_##field (struct class_device *cdev, char *buf) \ 1267show_fc_host_##field (struct device *dev, \
1268 struct device_attribute *attr, char *buf) \
1250{ \ 1269{ \
1251 struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1270 struct Scsi_Host *shost = transport_class_to_shost(dev); \
1252 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1271 struct fc_internal *i = to_fc_internal(shost->transportt); \
1253 if (i->f->get_host_##field) \ 1272 if (i->f->get_host_##field) \
1254 i->f->get_host_##field(shost); \ 1273 i->f->get_host_##field(shost); \
@@ -1257,11 +1276,12 @@ show_fc_host_##field (struct class_device *cdev, char *buf) \
1257 1276
1258#define fc_host_store_function(field) \ 1277#define fc_host_store_function(field) \
1259static ssize_t \ 1278static ssize_t \
1260store_fc_host_##field(struct class_device *cdev, const char *buf, \ 1279store_fc_host_##field(struct device *dev, \
1261 size_t count) \ 1280 struct device_attribute *attr, \
1281 const char *buf, size_t count) \
1262{ \ 1282{ \
1263 int val; \ 1283 int val; \
1264 struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1284 struct Scsi_Host *shost = transport_class_to_shost(dev); \
1265 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1285 struct fc_internal *i = to_fc_internal(shost->transportt); \
1266 char *cp; \ 1286 char *cp; \
1267 \ 1287 \
@@ -1274,10 +1294,11 @@ store_fc_host_##field(struct class_device *cdev, const char *buf, \
1274 1294
1275#define fc_host_store_str_function(field, slen) \ 1295#define fc_host_store_str_function(field, slen) \
1276static ssize_t \ 1296static ssize_t \
1277store_fc_host_##field(struct class_device *cdev, const char *buf, \ 1297store_fc_host_##field(struct device *dev, \
1278 size_t count) \ 1298 struct device_attribute *attr, \
1299 const char *buf, size_t count) \
1279{ \ 1300{ \
1280 struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1301 struct Scsi_Host *shost = transport_class_to_shost(dev); \
1281 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1302 struct fc_internal *i = to_fc_internal(shost->transportt); \
1282 unsigned int cnt=count; \ 1303 unsigned int cnt=count; \
1283 \ 1304 \
@@ -1293,26 +1314,27 @@ store_fc_host_##field(struct class_device *cdev, const char *buf, \
1293 1314
1294#define fc_host_rd_attr(field, format_string, sz) \ 1315#define fc_host_rd_attr(field, format_string, sz) \
1295 fc_host_show_function(field, format_string, sz, ) \ 1316 fc_host_show_function(field, format_string, sz, ) \
1296static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1317static FC_DEVICE_ATTR(host, field, S_IRUGO, \
1297 show_fc_host_##field, NULL) 1318 show_fc_host_##field, NULL)
1298 1319
1299#define fc_host_rd_attr_cast(field, format_string, sz, cast) \ 1320#define fc_host_rd_attr_cast(field, format_string, sz, cast) \
1300 fc_host_show_function(field, format_string, sz, (cast)) \ 1321 fc_host_show_function(field, format_string, sz, (cast)) \
1301static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1322static FC_DEVICE_ATTR(host, field, S_IRUGO, \
1302 show_fc_host_##field, NULL) 1323 show_fc_host_##field, NULL)
1303 1324
1304#define fc_host_rw_attr(field, format_string, sz) \ 1325#define fc_host_rw_attr(field, format_string, sz) \
1305 fc_host_show_function(field, format_string, sz, ) \ 1326 fc_host_show_function(field, format_string, sz, ) \
1306 fc_host_store_function(field) \ 1327 fc_host_store_function(field) \
1307static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \ 1328static FC_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \
1308 show_fc_host_##field, \ 1329 show_fc_host_##field, \
1309 store_fc_host_##field) 1330 store_fc_host_##field)
1310 1331
1311#define fc_host_rd_enum_attr(title, maxlen) \ 1332#define fc_host_rd_enum_attr(title, maxlen) \
1312static ssize_t \ 1333static ssize_t \
1313show_fc_host_##title (struct class_device *cdev, char *buf) \ 1334show_fc_host_##title (struct device *dev, \
1335 struct device_attribute *attr, char *buf) \
1314{ \ 1336{ \
1315 struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1337 struct Scsi_Host *shost = transport_class_to_shost(dev); \
1316 struct fc_internal *i = to_fc_internal(shost->transportt); \ 1338 struct fc_internal *i = to_fc_internal(shost->transportt); \
1317 const char *name; \ 1339 const char *name; \
1318 if (i->f->get_host_##title) \ 1340 if (i->f->get_host_##title) \
@@ -1322,10 +1344,10 @@ show_fc_host_##title (struct class_device *cdev, char *buf) \
1322 return -EINVAL; \ 1344 return -EINVAL; \
1323 return snprintf(buf, maxlen, "%s\n", name); \ 1345 return snprintf(buf, maxlen, "%s\n", name); \
1324} \ 1346} \
1325static FC_CLASS_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) 1347static FC_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL)
1326 1348
1327#define SETUP_HOST_ATTRIBUTE_RD(field) \ 1349#define SETUP_HOST_ATTRIBUTE_RD(field) \
1328 i->private_host_attrs[count] = class_device_attr_host_##field; \ 1350 i->private_host_attrs[count] = device_attr_host_##field; \
1329 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1351 i->private_host_attrs[count].attr.mode = S_IRUGO; \
1330 i->private_host_attrs[count].store = NULL; \ 1352 i->private_host_attrs[count].store = NULL; \
1331 i->host_attrs[count] = &i->private_host_attrs[count]; \ 1353 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)
1333 count++ 1355 count++
1334 1356
1335#define SETUP_HOST_ATTRIBUTE_RD_NS(field) \ 1357#define SETUP_HOST_ATTRIBUTE_RD_NS(field) \
1336 i->private_host_attrs[count] = class_device_attr_host_##field; \ 1358 i->private_host_attrs[count] = device_attr_host_##field; \
1337 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1359 i->private_host_attrs[count].attr.mode = S_IRUGO; \
1338 i->private_host_attrs[count].store = NULL; \ 1360 i->private_host_attrs[count].store = NULL; \
1339 i->host_attrs[count] = &i->private_host_attrs[count]; \ 1361 i->host_attrs[count] = &i->private_host_attrs[count]; \
1340 count++ 1362 count++
1341 1363
1342#define SETUP_HOST_ATTRIBUTE_RW(field) \ 1364#define SETUP_HOST_ATTRIBUTE_RW(field) \
1343 i->private_host_attrs[count] = class_device_attr_host_##field; \ 1365 i->private_host_attrs[count] = device_attr_host_##field; \
1344 if (!i->f->set_host_##field) { \ 1366 if (!i->f->set_host_##field) { \
1345 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1367 i->private_host_attrs[count].attr.mode = S_IRUGO; \
1346 i->private_host_attrs[count].store = NULL; \ 1368 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)
1352 1374
1353#define fc_private_host_show_function(field, format_string, sz, cast) \ 1375#define fc_private_host_show_function(field, format_string, sz, cast) \
1354static ssize_t \ 1376static ssize_t \
1355show_fc_host_##field (struct class_device *cdev, char *buf) \ 1377show_fc_host_##field (struct device *dev, \
1378 struct device_attribute *attr, char *buf) \
1356{ \ 1379{ \
1357 struct Scsi_Host *shost = transport_class_to_shost(cdev); \ 1380 struct Scsi_Host *shost = transport_class_to_shost(dev); \
1358 return snprintf(buf, sz, format_string, cast fc_host_##field(shost)); \ 1381 return snprintf(buf, sz, format_string, cast fc_host_##field(shost)); \
1359} 1382}
1360 1383
1361#define fc_private_host_rd_attr(field, format_string, sz) \ 1384#define fc_private_host_rd_attr(field, format_string, sz) \
1362 fc_private_host_show_function(field, format_string, sz, ) \ 1385 fc_private_host_show_function(field, format_string, sz, ) \
1363static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1386static FC_DEVICE_ATTR(host, field, S_IRUGO, \
1364 show_fc_host_##field, NULL) 1387 show_fc_host_##field, NULL)
1365 1388
1366#define fc_private_host_rd_attr_cast(field, format_string, sz, cast) \ 1389#define fc_private_host_rd_attr_cast(field, format_string, sz, cast) \
1367 fc_private_host_show_function(field, format_string, sz, (cast)) \ 1390 fc_private_host_show_function(field, format_string, sz, (cast)) \
1368static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ 1391static FC_DEVICE_ATTR(host, field, S_IRUGO, \
1369 show_fc_host_##field, NULL) 1392 show_fc_host_##field, NULL)
1370 1393
1371#define SETUP_PRIVATE_HOST_ATTRIBUTE_RD(field) \ 1394#define SETUP_PRIVATE_HOST_ATTRIBUTE_RD(field) \
1372 i->private_host_attrs[count] = class_device_attr_host_##field; \ 1395 i->private_host_attrs[count] = device_attr_host_##field; \
1373 i->private_host_attrs[count].attr.mode = S_IRUGO; \ 1396 i->private_host_attrs[count].attr.mode = S_IRUGO; \
1374 i->private_host_attrs[count].store = NULL; \ 1397 i->private_host_attrs[count].store = NULL; \
1375 i->host_attrs[count] = &i->private_host_attrs[count]; \ 1398 i->host_attrs[count] = &i->private_host_attrs[count]; \
@@ -1377,7 +1400,7 @@ static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \
1377 1400
1378#define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field) \ 1401#define SETUP_PRIVATE_HOST_ATTRIBUTE_RW(field) \
1379{ \ 1402{ \
1380 i->private_host_attrs[count] = class_device_attr_host_##field; \ 1403 i->private_host_attrs[count] = device_attr_host_##field; \
1381 i->host_attrs[count] = &i->private_host_attrs[count]; \ 1404 i->host_attrs[count] = &i->private_host_attrs[count]; \
1382 count++; \ 1405 count++; \
1383} 1406}
@@ -1386,38 +1409,41 @@ static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \
1386/* Fixed Host Attributes */ 1409/* Fixed Host Attributes */
1387 1410
1388static ssize_t 1411static ssize_t
1389show_fc_host_supported_classes (struct class_device *cdev, char *buf) 1412show_fc_host_supported_classes (struct device *dev,
1413 struct device_attribute *attr, char *buf)
1390{ 1414{
1391 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1415 struct Scsi_Host *shost = transport_class_to_shost(dev);
1392 1416
1393 if (fc_host_supported_classes(shost) == FC_COS_UNSPECIFIED) 1417 if (fc_host_supported_classes(shost) == FC_COS_UNSPECIFIED)
1394 return snprintf(buf, 20, "unspecified\n"); 1418 return snprintf(buf, 20, "unspecified\n");
1395 1419
1396 return get_fc_cos_names(fc_host_supported_classes(shost), buf); 1420 return get_fc_cos_names(fc_host_supported_classes(shost), buf);
1397} 1421}
1398static FC_CLASS_DEVICE_ATTR(host, supported_classes, S_IRUGO, 1422static FC_DEVICE_ATTR(host, supported_classes, S_IRUGO,
1399 show_fc_host_supported_classes, NULL); 1423 show_fc_host_supported_classes, NULL);
1400 1424
1401static ssize_t 1425static ssize_t
1402show_fc_host_supported_fc4s (struct class_device *cdev, char *buf) 1426show_fc_host_supported_fc4s (struct device *dev,
1427 struct device_attribute *attr, char *buf)
1403{ 1428{
1404 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1429 struct Scsi_Host *shost = transport_class_to_shost(dev);
1405 return (ssize_t)show_fc_fc4s(buf, fc_host_supported_fc4s(shost)); 1430 return (ssize_t)show_fc_fc4s(buf, fc_host_supported_fc4s(shost));
1406} 1431}
1407static FC_CLASS_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, 1432static FC_DEVICE_ATTR(host, supported_fc4s, S_IRUGO,
1408 show_fc_host_supported_fc4s, NULL); 1433 show_fc_host_supported_fc4s, NULL);
1409 1434
1410static ssize_t 1435static ssize_t
1411show_fc_host_supported_speeds (struct class_device *cdev, char *buf) 1436show_fc_host_supported_speeds (struct device *dev,
1437 struct device_attribute *attr, char *buf)
1412{ 1438{
1413 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1439 struct Scsi_Host *shost = transport_class_to_shost(dev);
1414 1440
1415 if (fc_host_supported_speeds(shost) == FC_PORTSPEED_UNKNOWN) 1441 if (fc_host_supported_speeds(shost) == FC_PORTSPEED_UNKNOWN)
1416 return snprintf(buf, 20, "unknown\n"); 1442 return snprintf(buf, 20, "unknown\n");
1417 1443
1418 return get_fc_port_speed_names(fc_host_supported_speeds(shost), buf); 1444 return get_fc_port_speed_names(fc_host_supported_speeds(shost), buf);
1419} 1445}
1420static FC_CLASS_DEVICE_ATTR(host, supported_speeds, S_IRUGO, 1446static FC_DEVICE_ATTR(host, supported_speeds, S_IRUGO,
1421 show_fc_host_supported_speeds, NULL); 1447 show_fc_host_supported_speeds, NULL);
1422 1448
1423 1449
@@ -1433,9 +1459,10 @@ fc_private_host_rd_attr(serial_number, "%s\n", (FC_SERIAL_NUMBER_SIZE +1));
1433/* Dynamic Host Attributes */ 1459/* Dynamic Host Attributes */
1434 1460
1435static ssize_t 1461static ssize_t
1436show_fc_host_active_fc4s (struct class_device *cdev, char *buf) 1462show_fc_host_active_fc4s (struct device *dev,
1463 struct device_attribute *attr, char *buf)
1437{ 1464{
1438 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1465 struct Scsi_Host *shost = transport_class_to_shost(dev);
1439 struct fc_internal *i = to_fc_internal(shost->transportt); 1466 struct fc_internal *i = to_fc_internal(shost->transportt);
1440 1467
1441 if (i->f->get_host_active_fc4s) 1468 if (i->f->get_host_active_fc4s)
@@ -1443,13 +1470,14 @@ show_fc_host_active_fc4s (struct class_device *cdev, char *buf)
1443 1470
1444 return (ssize_t)show_fc_fc4s(buf, fc_host_active_fc4s(shost)); 1471 return (ssize_t)show_fc_fc4s(buf, fc_host_active_fc4s(shost));
1445} 1472}
1446static FC_CLASS_DEVICE_ATTR(host, active_fc4s, S_IRUGO, 1473static FC_DEVICE_ATTR(host, active_fc4s, S_IRUGO,
1447 show_fc_host_active_fc4s, NULL); 1474 show_fc_host_active_fc4s, NULL);
1448 1475
1449static ssize_t 1476static ssize_t
1450show_fc_host_speed (struct class_device *cdev, char *buf) 1477show_fc_host_speed (struct device *dev,
1478 struct device_attribute *attr, char *buf)
1451{ 1479{
1452 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1480 struct Scsi_Host *shost = transport_class_to_shost(dev);
1453 struct fc_internal *i = to_fc_internal(shost->transportt); 1481 struct fc_internal *i = to_fc_internal(shost->transportt);
1454 1482
1455 if (i->f->get_host_speed) 1483 if (i->f->get_host_speed)
@@ -1460,7 +1488,7 @@ show_fc_host_speed (struct class_device *cdev, char *buf)
1460 1488
1461 return get_fc_port_speed_names(fc_host_speed(shost), buf); 1489 return get_fc_port_speed_names(fc_host_speed(shost), buf);
1462} 1490}
1463static FC_CLASS_DEVICE_ATTR(host, speed, S_IRUGO, 1491static FC_DEVICE_ATTR(host, speed, S_IRUGO,
1464 show_fc_host_speed, NULL); 1492 show_fc_host_speed, NULL);
1465 1493
1466 1494
@@ -1473,16 +1501,17 @@ fc_host_rd_attr(symbolic_name, "%s\n", FC_SYMBOLIC_NAME_SIZE + 1);
1473fc_private_host_show_function(system_hostname, "%s\n", 1501fc_private_host_show_function(system_hostname, "%s\n",
1474 FC_SYMBOLIC_NAME_SIZE + 1, ) 1502 FC_SYMBOLIC_NAME_SIZE + 1, )
1475fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE) 1503fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE)
1476static FC_CLASS_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, 1504static FC_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR,
1477 show_fc_host_system_hostname, store_fc_host_system_hostname); 1505 show_fc_host_system_hostname, store_fc_host_system_hostname);
1478 1506
1479 1507
1480/* Private Host Attributes */ 1508/* Private Host Attributes */
1481 1509
1482static ssize_t 1510static ssize_t
1483show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) 1511show_fc_private_host_tgtid_bind_type(struct device *dev,
1512 struct device_attribute *attr, char *buf)
1484{ 1513{
1485 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1514 struct Scsi_Host *shost = transport_class_to_shost(dev);
1486 const char *name; 1515 const char *name;
1487 1516
1488 name = get_fc_tgtid_bind_type_name(fc_host_tgtid_bind_type(shost)); 1517 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)
1495 pos = list_entry((head)->next, typeof(*pos), member) 1524 pos = list_entry((head)->next, typeof(*pos), member)
1496 1525
1497static ssize_t 1526static ssize_t
1498store_fc_private_host_tgtid_bind_type(struct class_device *cdev, 1527store_fc_private_host_tgtid_bind_type(struct device *dev,
1499 const char *buf, size_t count) 1528 struct device_attribute *attr, const char *buf, size_t count)
1500{ 1529{
1501 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1530 struct Scsi_Host *shost = transport_class_to_shost(dev);
1502 struct fc_rport *rport; 1531 struct fc_rport *rport;
1503 enum fc_tgtid_binding_type val; 1532 enum fc_tgtid_binding_type val;
1504 unsigned long flags; 1533 unsigned long flags;
@@ -1523,15 +1552,15 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
1523 return count; 1552 return count;
1524} 1553}
1525 1554
1526static FC_CLASS_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR, 1555static FC_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR,
1527 show_fc_private_host_tgtid_bind_type, 1556 show_fc_private_host_tgtid_bind_type,
1528 store_fc_private_host_tgtid_bind_type); 1557 store_fc_private_host_tgtid_bind_type);
1529 1558
1530static ssize_t 1559static ssize_t
1531store_fc_private_host_issue_lip(struct class_device *cdev, 1560store_fc_private_host_issue_lip(struct device *dev,
1532 const char *buf, size_t count) 1561 struct device_attribute *attr, const char *buf, size_t count)
1533{ 1562{
1534 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1563 struct Scsi_Host *shost = transport_class_to_shost(dev);
1535 struct fc_internal *i = to_fc_internal(shost->transportt); 1564 struct fc_internal *i = to_fc_internal(shost->transportt);
1536 int ret; 1565 int ret;
1537 1566
@@ -1544,7 +1573,7 @@ store_fc_private_host_issue_lip(struct class_device *cdev,
1544 return -ENOENT; 1573 return -ENOENT;
1545} 1574}
1546 1575
1547static FC_CLASS_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL, 1576static FC_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL,
1548 store_fc_private_host_issue_lip); 1577 store_fc_private_host_issue_lip);
1549 1578
1550fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20); 1579fc_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);
1556 1585
1557/* Show a given an attribute in the statistics group */ 1586/* Show a given an attribute in the statistics group */
1558static ssize_t 1587static ssize_t
1559fc_stat_show(const struct class_device *cdev, char *buf, unsigned long offset) 1588fc_stat_show(const struct device *dev, char *buf, unsigned long offset)
1560{ 1589{
1561 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1590 struct Scsi_Host *shost = transport_class_to_shost(dev);
1562 struct fc_internal *i = to_fc_internal(shost->transportt); 1591 struct fc_internal *i = to_fc_internal(shost->transportt);
1563 struct fc_host_statistics *stats; 1592 struct fc_host_statistics *stats;
1564 ssize_t ret = -ENOENT; 1593 ssize_t ret = -ENOENT;
@@ -1579,12 +1608,14 @@ fc_stat_show(const struct class_device *cdev, char *buf, unsigned long offset)
1579 1608
1580/* generate a read-only statistics attribute */ 1609/* generate a read-only statistics attribute */
1581#define fc_host_statistic(name) \ 1610#define fc_host_statistic(name) \
1582static ssize_t show_fcstat_##name(struct class_device *cd, char *buf) \ 1611static ssize_t show_fcstat_##name(struct device *cd, \
1612 struct device_attribute *attr, \
1613 char *buf) \
1583{ \ 1614{ \
1584 return fc_stat_show(cd, buf, \ 1615 return fc_stat_show(cd, buf, \
1585 offsetof(struct fc_host_statistics, name)); \ 1616 offsetof(struct fc_host_statistics, name)); \
1586} \ 1617} \
1587static FC_CLASS_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) 1618static FC_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL)
1588 1619
1589fc_host_statistic(seconds_since_last_reset); 1620fc_host_statistic(seconds_since_last_reset);
1590fc_host_statistic(tx_frames); 1621fc_host_statistic(tx_frames);
@@ -1608,10 +1639,10 @@ fc_host_statistic(fcp_input_megabytes);
1608fc_host_statistic(fcp_output_megabytes); 1639fc_host_statistic(fcp_output_megabytes);
1609 1640
1610static ssize_t 1641static ssize_t
1611fc_reset_statistics(struct class_device *cdev, const char *buf, 1642fc_reset_statistics(struct device *dev, struct device_attribute *attr,
1612 size_t count) 1643 const char *buf, size_t count)
1613{ 1644{
1614 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1645 struct Scsi_Host *shost = transport_class_to_shost(dev);
1615 struct fc_internal *i = to_fc_internal(shost->transportt); 1646 struct fc_internal *i = to_fc_internal(shost->transportt);
1616 1647
1617 /* ignore any data value written to the attribute */ 1648 /* ignore any data value written to the attribute */
@@ -1622,31 +1653,31 @@ fc_reset_statistics(struct class_device *cdev, const char *buf,
1622 1653
1623 return -ENOENT; 1654 return -ENOENT;
1624} 1655}
1625static FC_CLASS_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, 1656static FC_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL,
1626 fc_reset_statistics); 1657 fc_reset_statistics);
1627 1658
1628static struct attribute *fc_statistics_attrs[] = { 1659static struct attribute *fc_statistics_attrs[] = {
1629 &class_device_attr_host_seconds_since_last_reset.attr, 1660 &device_attr_host_seconds_since_last_reset.attr,
1630 &class_device_attr_host_tx_frames.attr, 1661 &device_attr_host_tx_frames.attr,
1631 &class_device_attr_host_tx_words.attr, 1662 &device_attr_host_tx_words.attr,
1632 &class_device_attr_host_rx_frames.attr, 1663 &device_attr_host_rx_frames.attr,
1633 &class_device_attr_host_rx_words.attr, 1664 &device_attr_host_rx_words.attr,
1634 &class_device_attr_host_lip_count.attr, 1665 &device_attr_host_lip_count.attr,
1635 &class_device_attr_host_nos_count.attr, 1666 &device_attr_host_nos_count.attr,
1636 &class_device_attr_host_error_frames.attr, 1667 &device_attr_host_error_frames.attr,
1637 &class_device_attr_host_dumped_frames.attr, 1668 &device_attr_host_dumped_frames.attr,
1638 &class_device_attr_host_link_failure_count.attr, 1669 &device_attr_host_link_failure_count.attr,
1639 &class_device_attr_host_loss_of_sync_count.attr, 1670 &device_attr_host_loss_of_sync_count.attr,
1640 &class_device_attr_host_loss_of_signal_count.attr, 1671 &device_attr_host_loss_of_signal_count.attr,
1641 &class_device_attr_host_prim_seq_protocol_err_count.attr, 1672 &device_attr_host_prim_seq_protocol_err_count.attr,
1642 &class_device_attr_host_invalid_tx_word_count.attr, 1673 &device_attr_host_invalid_tx_word_count.attr,
1643 &class_device_attr_host_invalid_crc_count.attr, 1674 &device_attr_host_invalid_crc_count.attr,
1644 &class_device_attr_host_fcp_input_requests.attr, 1675 &device_attr_host_fcp_input_requests.attr,
1645 &class_device_attr_host_fcp_output_requests.attr, 1676 &device_attr_host_fcp_output_requests.attr,
1646 &class_device_attr_host_fcp_control_requests.attr, 1677 &device_attr_host_fcp_control_requests.attr,
1647 &class_device_attr_host_fcp_input_megabytes.attr, 1678 &device_attr_host_fcp_input_megabytes.attr,
1648 &class_device_attr_host_fcp_output_megabytes.attr, 1679 &device_attr_host_fcp_output_megabytes.attr,
1649 &class_device_attr_host_reset_statistics.attr, 1680 &device_attr_host_reset_statistics.attr,
1650 NULL 1681 NULL
1651}; 1682};
1652 1683
@@ -1695,10 +1726,10 @@ fc_parse_wwn(const char *ns, u64 *nm)
1695 * as hex characters, and may *not* contain any prefixes (e.g. 0x, x, etc) 1726 * as hex characters, and may *not* contain any prefixes (e.g. 0x, x, etc)
1696 */ 1727 */
1697static ssize_t 1728static ssize_t
1698store_fc_host_vport_create(struct class_device *cdev, const char *buf, 1729store_fc_host_vport_create(struct device *dev, struct device_attribute *attr,
1699 size_t count) 1730 const char *buf, size_t count)
1700{ 1731{
1701 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1732 struct Scsi_Host *shost = transport_class_to_shost(dev);
1702 struct fc_vport_identifiers vid; 1733 struct fc_vport_identifiers vid;
1703 struct fc_vport *vport; 1734 struct fc_vport *vport;
1704 unsigned int cnt=count; 1735 unsigned int cnt=count;
@@ -1731,7 +1762,7 @@ store_fc_host_vport_create(struct class_device *cdev, const char *buf,
1731 stat = fc_vport_create(shost, 0, &shost->shost_gendev, &vid, &vport); 1762 stat = fc_vport_create(shost, 0, &shost->shost_gendev, &vid, &vport);
1732 return stat ? stat : count; 1763 return stat ? stat : count;
1733} 1764}
1734static FC_CLASS_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, 1765static FC_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL,
1735 store_fc_host_vport_create); 1766 store_fc_host_vport_create);
1736 1767
1737 1768
@@ -1742,10 +1773,10 @@ static FC_CLASS_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL,
1742 * any prefixes (e.g. 0x, x, etc) 1773 * any prefixes (e.g. 0x, x, etc)
1743 */ 1774 */
1744static ssize_t 1775static ssize_t
1745store_fc_host_vport_delete(struct class_device *cdev, const char *buf, 1776store_fc_host_vport_delete(struct device *dev, struct device_attribute *attr,
1746 size_t count) 1777 const char *buf, size_t count)
1747{ 1778{
1748 struct Scsi_Host *shost = transport_class_to_shost(cdev); 1779 struct Scsi_Host *shost = transport_class_to_shost(dev);
1749 struct fc_host_attrs *fc_host = shost_to_fc_host(shost); 1780 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
1750 struct fc_vport *vport; 1781 struct fc_vport *vport;
1751 u64 wwpn, wwnn; 1782 u64 wwpn, wwnn;
@@ -1787,7 +1818,7 @@ store_fc_host_vport_delete(struct class_device *cdev, const char *buf,
1787 stat = fc_vport_terminate(vport); 1818 stat = fc_vport_terminate(vport);
1788 return stat ? stat : count; 1819 return stat ? stat : count;
1789} 1820}
1790static FC_CLASS_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL, 1821static FC_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL,
1791 store_fc_host_vport_delete); 1822 store_fc_host_vport_delete);
1792 1823
1793 1824