diff options
Diffstat (limited to 'drivers/scsi')
33 files changed, 1441 insertions, 1223 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 51c3ebf1c7d1..b31faeccb9cd 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -140,9 +140,10 @@ static void twa_unmap_scsi_data(TW_Device_Extension *tw_dev, int request_id); | |||
140 | /* Functions */ | 140 | /* Functions */ |
141 | 141 | ||
142 | /* Show some statistics about the card */ | 142 | /* Show some statistics about the card */ |
143 | static ssize_t twa_show_stats(struct class_device *class_dev, char *buf) | 143 | static ssize_t twa_show_stats(struct device *dev, |
144 | struct device_attribute *attr, char *buf) | ||
144 | { | 145 | { |
145 | struct Scsi_Host *host = class_to_shost(class_dev); | 146 | struct Scsi_Host *host = class_to_shost(dev); |
146 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; | 147 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; |
147 | unsigned long flags = 0; | 148 | unsigned long flags = 0; |
148 | ssize_t len; | 149 | ssize_t len; |
@@ -184,7 +185,7 @@ static int twa_change_queue_depth(struct scsi_device *sdev, int queue_depth) | |||
184 | } /* End twa_change_queue_depth() */ | 185 | } /* End twa_change_queue_depth() */ |
185 | 186 | ||
186 | /* Create sysfs 'stats' entry */ | 187 | /* Create sysfs 'stats' entry */ |
187 | static struct class_device_attribute twa_host_stats_attr = { | 188 | static struct device_attribute twa_host_stats_attr = { |
188 | .attr = { | 189 | .attr = { |
189 | .name = "stats", | 190 | .name = "stats", |
190 | .mode = S_IRUGO, | 191 | .mode = S_IRUGO, |
@@ -193,7 +194,7 @@ static struct class_device_attribute twa_host_stats_attr = { | |||
193 | }; | 194 | }; |
194 | 195 | ||
195 | /* Host attributes initializer */ | 196 | /* Host attributes initializer */ |
196 | static struct class_device_attribute *twa_host_attrs[] = { | 197 | static struct device_attribute *twa_host_attrs[] = { |
197 | &twa_host_stats_attr, | 198 | &twa_host_stats_attr, |
198 | NULL, | 199 | NULL, |
199 | }; | 200 | }; |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index adb98a297210..8c22329aa85e 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -484,9 +484,10 @@ static void tw_state_request_start(TW_Device_Extension *tw_dev, int *request_id) | |||
484 | } /* End tw_state_request_start() */ | 484 | } /* End tw_state_request_start() */ |
485 | 485 | ||
486 | /* Show some statistics about the card */ | 486 | /* Show some statistics about the card */ |
487 | static ssize_t tw_show_stats(struct class_device *class_dev, char *buf) | 487 | static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr, |
488 | char *buf) | ||
488 | { | 489 | { |
489 | struct Scsi_Host *host = class_to_shost(class_dev); | 490 | struct Scsi_Host *host = class_to_shost(dev); |
490 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; | 491 | TW_Device_Extension *tw_dev = (TW_Device_Extension *)host->hostdata; |
491 | unsigned long flags = 0; | 492 | unsigned long flags = 0; |
492 | ssize_t len; | 493 | ssize_t len; |
@@ -528,7 +529,7 @@ static int tw_change_queue_depth(struct scsi_device *sdev, int queue_depth) | |||
528 | } /* End tw_change_queue_depth() */ | 529 | } /* End tw_change_queue_depth() */ |
529 | 530 | ||
530 | /* Create sysfs 'stats' entry */ | 531 | /* Create sysfs 'stats' entry */ |
531 | static struct class_device_attribute tw_host_stats_attr = { | 532 | static struct device_attribute tw_host_stats_attr = { |
532 | .attr = { | 533 | .attr = { |
533 | .name = "stats", | 534 | .name = "stats", |
534 | .mode = S_IRUGO, | 535 | .mode = S_IRUGO, |
@@ -537,7 +538,7 @@ static struct class_device_attribute tw_host_stats_attr = { | |||
537 | }; | 538 | }; |
538 | 539 | ||
539 | /* Host attributes initializer */ | 540 | /* Host attributes initializer */ |
540 | static struct class_device_attribute *tw_host_attrs[] = { | 541 | static struct device_attribute *tw_host_attrs[] = { |
541 | &tw_host_stats_attr, | 542 | &tw_host_stats_attr, |
542 | NULL, | 543 | NULL, |
543 | }; | 544 | }; |
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 369fcf78f396..439fd8146657 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -1316,7 +1316,7 @@ int aac_get_adapter_info(struct aac_dev* dev) | |||
1316 | tmp>>24,(tmp>>16)&0xff,tmp&0xff, | 1316 | tmp>>24,(tmp>>16)&0xff,tmp&0xff, |
1317 | le32_to_cpu(dev->adapter_info.biosbuild)); | 1317 | le32_to_cpu(dev->adapter_info.biosbuild)); |
1318 | buffer[0] = '\0'; | 1318 | buffer[0] = '\0'; |
1319 | if (aac_show_serial_number( | 1319 | if (aac_get_serial_number( |
1320 | shost_to_class(dev->scsi_host_ptr), buffer)) | 1320 | shost_to_class(dev->scsi_host_ptr), buffer)) |
1321 | printk(KERN_INFO "%s%d: serial %s", | 1321 | printk(KERN_INFO "%s%d: serial %s", |
1322 | dev->name, dev->id, buffer); | 1322 | dev->name, dev->id, buffer); |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index ace0b751c131..113ca9c8934c 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1850,9 +1850,9 @@ int aac_get_containers(struct aac_dev *dev); | |||
1850 | int aac_scsi_cmd(struct scsi_cmnd *cmd); | 1850 | int aac_scsi_cmd(struct scsi_cmnd *cmd); |
1851 | int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); | 1851 | int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg); |
1852 | #ifndef shost_to_class | 1852 | #ifndef shost_to_class |
1853 | #define shost_to_class(shost) &shost->shost_classdev | 1853 | #define shost_to_class(shost) &shost->shost_dev |
1854 | #endif | 1854 | #endif |
1855 | ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf); | 1855 | ssize_t aac_get_serial_number(struct device *dev, char *buf); |
1856 | int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); | 1856 | int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); |
1857 | int aac_rx_init(struct aac_dev *dev); | 1857 | int aac_rx_init(struct aac_dev *dev); |
1858 | int aac_rkt_init(struct aac_dev *dev); | 1858 | int aac_rkt_init(struct aac_dev *dev); |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index ae5f74fb62d5..c6391838b2cd 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -755,10 +755,10 @@ static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long | |||
755 | } | 755 | } |
756 | #endif | 756 | #endif |
757 | 757 | ||
758 | static ssize_t aac_show_model(struct class_device *class_dev, | 758 | static ssize_t aac_show_model(struct device *device, |
759 | char *buf) | 759 | struct device_attribute *attr, char *buf) |
760 | { | 760 | { |
761 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 761 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
762 | int len; | 762 | int len; |
763 | 763 | ||
764 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { | 764 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { |
@@ -774,10 +774,10 @@ static ssize_t aac_show_model(struct class_device *class_dev, | |||
774 | return len; | 774 | return len; |
775 | } | 775 | } |
776 | 776 | ||
777 | static ssize_t aac_show_vendor(struct class_device *class_dev, | 777 | static ssize_t aac_show_vendor(struct device *device, |
778 | char *buf) | 778 | struct device_attribute *attr, char *buf) |
779 | { | 779 | { |
780 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 780 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
781 | int len; | 781 | int len; |
782 | 782 | ||
783 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { | 783 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { |
@@ -793,10 +793,11 @@ static ssize_t aac_show_vendor(struct class_device *class_dev, | |||
793 | return len; | 793 | return len; |
794 | } | 794 | } |
795 | 795 | ||
796 | static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) | 796 | static ssize_t aac_show_flags(struct device *cdev, |
797 | struct device_attribute *attr, char *buf) | ||
797 | { | 798 | { |
798 | int len = 0; | 799 | int len = 0; |
799 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 800 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata; |
800 | 801 | ||
801 | if (nblank(dprintk(x))) | 802 | if (nblank(dprintk(x))) |
802 | len = snprintf(buf, PAGE_SIZE, "dprintk\n"); | 803 | len = snprintf(buf, PAGE_SIZE, "dprintk\n"); |
@@ -812,10 +813,11 @@ static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) | |||
812 | return len; | 813 | return len; |
813 | } | 814 | } |
814 | 815 | ||
815 | static ssize_t aac_show_kernel_version(struct class_device *class_dev, | 816 | static ssize_t aac_show_kernel_version(struct device *device, |
816 | char *buf) | 817 | struct device_attribute *attr, |
818 | char *buf) | ||
817 | { | 819 | { |
818 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 820 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
819 | int len, tmp; | 821 | int len, tmp; |
820 | 822 | ||
821 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | 823 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); |
@@ -825,10 +827,11 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev, | |||
825 | return len; | 827 | return len; |
826 | } | 828 | } |
827 | 829 | ||
828 | static ssize_t aac_show_monitor_version(struct class_device *class_dev, | 830 | static ssize_t aac_show_monitor_version(struct device *device, |
829 | char *buf) | 831 | struct device_attribute *attr, |
832 | char *buf) | ||
830 | { | 833 | { |
831 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 834 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
832 | int len, tmp; | 835 | int len, tmp; |
833 | 836 | ||
834 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); | 837 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); |
@@ -838,10 +841,11 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev, | |||
838 | return len; | 841 | return len; |
839 | } | 842 | } |
840 | 843 | ||
841 | static ssize_t aac_show_bios_version(struct class_device *class_dev, | 844 | static ssize_t aac_show_bios_version(struct device *device, |
842 | char *buf) | 845 | struct device_attribute *attr, |
846 | char *buf) | ||
843 | { | 847 | { |
844 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 848 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
845 | int len, tmp; | 849 | int len, tmp; |
846 | 850 | ||
847 | tmp = le32_to_cpu(dev->adapter_info.biosrev); | 851 | tmp = le32_to_cpu(dev->adapter_info.biosrev); |
@@ -851,9 +855,10 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, | |||
851 | return len; | 855 | return len; |
852 | } | 856 | } |
853 | 857 | ||
854 | ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) | 858 | ssize_t aac_show_serial_number(struct device *device, |
859 | struct device_attribute *attr, char *buf) | ||
855 | { | 860 | { |
856 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 861 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
857 | int len = 0; | 862 | int len = 0; |
858 | 863 | ||
859 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) | 864 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) |
@@ -869,35 +874,39 @@ ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) | |||
869 | return len; | 874 | return len; |
870 | } | 875 | } |
871 | 876 | ||
872 | static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf) | 877 | static ssize_t aac_show_max_channel(struct device *device, |
878 | struct device_attribute *attr, char *buf) | ||
873 | { | 879 | { |
874 | return snprintf(buf, PAGE_SIZE, "%d\n", | 880 | return snprintf(buf, PAGE_SIZE, "%d\n", |
875 | class_to_shost(class_dev)->max_channel); | 881 | class_to_shost(device)->max_channel); |
876 | } | 882 | } |
877 | 883 | ||
878 | static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf) | 884 | static ssize_t aac_show_max_id(struct device *device, |
885 | struct device_attribute *attr, char *buf) | ||
879 | { | 886 | { |
880 | return snprintf(buf, PAGE_SIZE, "%d\n", | 887 | return snprintf(buf, PAGE_SIZE, "%d\n", |
881 | class_to_shost(class_dev)->max_id); | 888 | class_to_shost(device)->max_id); |
882 | } | 889 | } |
883 | 890 | ||
884 | static ssize_t aac_store_reset_adapter(struct class_device *class_dev, | 891 | static ssize_t aac_store_reset_adapter(struct device *device, |
885 | const char *buf, size_t count) | 892 | struct device_attribute *attr, |
893 | const char *buf, size_t count) | ||
886 | { | 894 | { |
887 | int retval = -EACCES; | 895 | int retval = -EACCES; |
888 | 896 | ||
889 | if (!capable(CAP_SYS_ADMIN)) | 897 | if (!capable(CAP_SYS_ADMIN)) |
890 | return retval; | 898 | return retval; |
891 | retval = aac_reset_adapter((struct aac_dev*)class_to_shost(class_dev)->hostdata, buf[0] == '!'); | 899 | retval = aac_reset_adapter((struct aac_dev*)class_to_shost(device)->hostdata, buf[0] == '!'); |
892 | if (retval >= 0) | 900 | if (retval >= 0) |
893 | retval = count; | 901 | retval = count; |
894 | return retval; | 902 | return retval; |
895 | } | 903 | } |
896 | 904 | ||
897 | static ssize_t aac_show_reset_adapter(struct class_device *class_dev, | 905 | static ssize_t aac_show_reset_adapter(struct device *device, |
898 | char *buf) | 906 | struct device_attribute *attr, |
907 | char *buf) | ||
899 | { | 908 | { |
900 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 909 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
901 | int len, tmp; | 910 | int len, tmp; |
902 | 911 | ||
903 | tmp = aac_adapter_check_health(dev); | 912 | tmp = aac_adapter_check_health(dev); |
@@ -907,70 +916,70 @@ static ssize_t aac_show_reset_adapter(struct class_device *class_dev, | |||
907 | return len; | 916 | return len; |
908 | } | 917 | } |
909 | 918 | ||
910 | static struct class_device_attribute aac_model = { | 919 | static struct device_attribute aac_model = { |
911 | .attr = { | 920 | .attr = { |
912 | .name = "model", | 921 | .name = "model", |
913 | .mode = S_IRUGO, | 922 | .mode = S_IRUGO, |
914 | }, | 923 | }, |
915 | .show = aac_show_model, | 924 | .show = aac_show_model, |
916 | }; | 925 | }; |
917 | static struct class_device_attribute aac_vendor = { | 926 | static struct device_attribute aac_vendor = { |
918 | .attr = { | 927 | .attr = { |
919 | .name = "vendor", | 928 | .name = "vendor", |
920 | .mode = S_IRUGO, | 929 | .mode = S_IRUGO, |
921 | }, | 930 | }, |
922 | .show = aac_show_vendor, | 931 | .show = aac_show_vendor, |
923 | }; | 932 | }; |
924 | static struct class_device_attribute aac_flags = { | 933 | static struct device_attribute aac_flags = { |
925 | .attr = { | 934 | .attr = { |
926 | .name = "flags", | 935 | .name = "flags", |
927 | .mode = S_IRUGO, | 936 | .mode = S_IRUGO, |
928 | }, | 937 | }, |
929 | .show = aac_show_flags, | 938 | .show = aac_show_flags, |
930 | }; | 939 | }; |
931 | static struct class_device_attribute aac_kernel_version = { | 940 | static struct device_attribute aac_kernel_version = { |
932 | .attr = { | 941 | .attr = { |
933 | .name = "hba_kernel_version", | 942 | .name = "hba_kernel_version", |
934 | .mode = S_IRUGO, | 943 | .mode = S_IRUGO, |
935 | }, | 944 | }, |
936 | .show = aac_show_kernel_version, | 945 | .show = aac_show_kernel_version, |
937 | }; | 946 | }; |
938 | static struct class_device_attribute aac_monitor_version = { | 947 | static struct device_attribute aac_monitor_version = { |
939 | .attr = { | 948 | .attr = { |
940 | .name = "hba_monitor_version", | 949 | .name = "hba_monitor_version", |
941 | .mode = S_IRUGO, | 950 | .mode = S_IRUGO, |
942 | }, | 951 | }, |
943 | .show = aac_show_monitor_version, | 952 | .show = aac_show_monitor_version, |
944 | }; | 953 | }; |
945 | static struct class_device_attribute aac_bios_version = { | 954 | static struct device_attribute aac_bios_version = { |
946 | .attr = { | 955 | .attr = { |
947 | .name = "hba_bios_version", | 956 | .name = "hba_bios_version", |
948 | .mode = S_IRUGO, | 957 | .mode = S_IRUGO, |
949 | }, | 958 | }, |
950 | .show = aac_show_bios_version, | 959 | .show = aac_show_bios_version, |
951 | }; | 960 | }; |
952 | static struct class_device_attribute aac_serial_number = { | 961 | static struct device_attribute aac_serial_number = { |
953 | .attr = { | 962 | .attr = { |
954 | .name = "serial_number", | 963 | .name = "serial_number", |
955 | .mode = S_IRUGO, | 964 | .mode = S_IRUGO, |
956 | }, | 965 | }, |
957 | .show = aac_show_serial_number, | 966 | .show = aac_show_serial_number, |
958 | }; | 967 | }; |
959 | static struct class_device_attribute aac_max_channel = { | 968 | static struct device_attribute aac_max_channel = { |
960 | .attr = { | 969 | .attr = { |
961 | .name = "max_channel", | 970 | .name = "max_channel", |
962 | .mode = S_IRUGO, | 971 | .mode = S_IRUGO, |
963 | }, | 972 | }, |
964 | .show = aac_show_max_channel, | 973 | .show = aac_show_max_channel, |
965 | }; | 974 | }; |
966 | static struct class_device_attribute aac_max_id = { | 975 | static struct device_attribute aac_max_id = { |
967 | .attr = { | 976 | .attr = { |
968 | .name = "max_id", | 977 | .name = "max_id", |
969 | .mode = S_IRUGO, | 978 | .mode = S_IRUGO, |
970 | }, | 979 | }, |
971 | .show = aac_show_max_id, | 980 | .show = aac_show_max_id, |
972 | }; | 981 | }; |
973 | static struct class_device_attribute aac_reset = { | 982 | static struct device_attribute aac_reset = { |
974 | .attr = { | 983 | .attr = { |
975 | .name = "reset_host", | 984 | .name = "reset_host", |
976 | .mode = S_IWUSR|S_IRUGO, | 985 | .mode = S_IWUSR|S_IRUGO, |
@@ -979,7 +988,7 @@ static struct class_device_attribute aac_reset = { | |||
979 | .show = aac_show_reset_adapter, | 988 | .show = aac_show_reset_adapter, |
980 | }; | 989 | }; |
981 | 990 | ||
982 | static struct class_device_attribute *aac_attrs[] = { | 991 | static struct device_attribute *aac_attrs[] = { |
983 | &aac_model, | 992 | &aac_model, |
984 | &aac_vendor, | 993 | &aac_vendor, |
985 | &aac_flags, | 994 | &aac_flags, |
@@ -993,6 +1002,10 @@ static struct class_device_attribute *aac_attrs[] = { | |||
993 | NULL | 1002 | NULL |
994 | }; | 1003 | }; |
995 | 1004 | ||
1005 | ssize_t aac_get_serial_number(struct device *device, char *buf) | ||
1006 | { | ||
1007 | return aac_show_serial_number(device, &aac_serial_number, buf); | ||
1008 | } | ||
996 | 1009 | ||
997 | static const struct file_operations aac_cfg_fops = { | 1010 | static const struct file_operations aac_cfg_fops = { |
998 | .owner = THIS_MODULE, | 1011 | .owner = THIS_MODULE, |
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h index 3288be2e49f8..ab646e580d64 100644 --- a/drivers/scsi/arcmsr/arcmsr.h +++ b/drivers/scsi/arcmsr/arcmsr.h | |||
@@ -44,7 +44,7 @@ | |||
44 | */ | 44 | */ |
45 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
46 | 46 | ||
47 | struct class_device_attribute; | 47 | struct device_attribute; |
48 | /*The limit of outstanding scsi command that firmware can handle*/ | 48 | /*The limit of outstanding scsi command that firmware can handle*/ |
49 | #define ARCMSR_MAX_OUTSTANDING_CMD 256 | 49 | #define ARCMSR_MAX_OUTSTANDING_CMD 256 |
50 | #define ARCMSR_MAX_FREECCB_NUM 320 | 50 | #define ARCMSR_MAX_FREECCB_NUM 320 |
@@ -556,6 +556,6 @@ struct SENSE_DATA | |||
556 | extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); | 556 | extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); |
557 | extern void arcmsr_iop_message_read(struct AdapterControlBlock *); | 557 | extern void arcmsr_iop_message_read(struct AdapterControlBlock *); |
558 | extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); | 558 | extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); |
559 | extern struct class_device_attribute *arcmsr_host_attrs[]; | 559 | extern struct device_attribute *arcmsr_host_attrs[]; |
560 | extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); | 560 | extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); |
561 | void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); | 561 | void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); |
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index 7d7b0a554276..69f8346aa288 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -57,15 +57,15 @@ | |||
57 | #include <scsi/scsi_transport.h> | 57 | #include <scsi/scsi_transport.h> |
58 | #include "arcmsr.h" | 58 | #include "arcmsr.h" |
59 | 59 | ||
60 | struct class_device_attribute *arcmsr_host_attrs[]; | 60 | struct device_attribute *arcmsr_host_attrs[]; |
61 | 61 | ||
62 | static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, | 62 | static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, |
63 | struct bin_attribute *bin, | 63 | struct bin_attribute *bin, |
64 | char *buf, loff_t off, | 64 | char *buf, loff_t off, |
65 | size_t count) | 65 | size_t count) |
66 | { | 66 | { |
67 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 67 | struct device *dev = container_of(kobj,struct device,kobj); |
68 | struct Scsi_Host *host = class_to_shost(cdev); | 68 | struct Scsi_Host *host = class_to_shost(dev); |
69 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 69 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
70 | uint8_t *pQbuffer,*ptmpQbuffer; | 70 | uint8_t *pQbuffer,*ptmpQbuffer; |
71 | int32_t allxfer_len = 0; | 71 | int32_t allxfer_len = 0; |
@@ -110,8 +110,8 @@ static ssize_t arcmsr_sysfs_iop_message_write(struct kobject *kobj, | |||
110 | char *buf, loff_t off, | 110 | char *buf, loff_t off, |
111 | size_t count) | 111 | size_t count) |
112 | { | 112 | { |
113 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 113 | struct device *dev = container_of(kobj,struct device,kobj); |
114 | struct Scsi_Host *host = class_to_shost(cdev); | 114 | struct Scsi_Host *host = class_to_shost(dev); |
115 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 115 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
116 | int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; | 116 | int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; |
117 | uint8_t *pQbuffer, *ptmpuserbuffer; | 117 | uint8_t *pQbuffer, *ptmpuserbuffer; |
@@ -158,8 +158,8 @@ static ssize_t arcmsr_sysfs_iop_message_clear(struct kobject *kobj, | |||
158 | char *buf, loff_t off, | 158 | char *buf, loff_t off, |
159 | size_t count) | 159 | size_t count) |
160 | { | 160 | { |
161 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 161 | struct device *dev = container_of(kobj,struct device,kobj); |
162 | struct Scsi_Host *host = class_to_shost(cdev); | 162 | struct Scsi_Host *host = class_to_shost(dev); |
163 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 163 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
164 | uint8_t *pQbuffer; | 164 | uint8_t *pQbuffer; |
165 | 165 | ||
@@ -220,87 +220,104 @@ int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *acb) | |||
220 | struct Scsi_Host *host = acb->host; | 220 | struct Scsi_Host *host = acb->host; |
221 | int error; | 221 | int error; |
222 | 222 | ||
223 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); | 223 | error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); |
224 | if (error) { | 224 | if (error) { |
225 | printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n"); | 225 | printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n"); |
226 | goto error_bin_file_message_read; | 226 | goto error_bin_file_message_read; |
227 | } | 227 | } |
228 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); | 228 | error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); |
229 | if (error) { | 229 | if (error) { |
230 | printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n"); | 230 | printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n"); |
231 | goto error_bin_file_message_write; | 231 | goto error_bin_file_message_write; |
232 | } | 232 | } |
233 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); | 233 | error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr); |
234 | if (error) { | 234 | if (error) { |
235 | printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n"); | 235 | printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n"); |
236 | goto error_bin_file_message_clear; | 236 | goto error_bin_file_message_clear; |
237 | } | 237 | } |
238 | return 0; | 238 | return 0; |
239 | error_bin_file_message_clear: | 239 | error_bin_file_message_clear: |
240 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); | 240 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); |
241 | error_bin_file_message_write: | 241 | error_bin_file_message_write: |
242 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); | 242 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); |
243 | error_bin_file_message_read: | 243 | error_bin_file_message_read: |
244 | return error; | 244 | return error; |
245 | } | 245 | } |
246 | 246 | ||
247 | void | 247 | void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) |
248 | arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) { | 248 | { |
249 | struct Scsi_Host *host = acb->host; | 249 | struct Scsi_Host *host = acb->host; |
250 | 250 | ||
251 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); | 251 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr); |
252 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); | 252 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); |
253 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); | 253 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
257 | static ssize_t | 257 | static ssize_t |
258 | arcmsr_attr_host_driver_version(struct class_device *cdev, char *buf) { | 258 | arcmsr_attr_host_driver_version(struct device *dev, |
259 | struct device_attribute *attr, char *buf) | ||
260 | { | ||
259 | return snprintf(buf, PAGE_SIZE, | 261 | return snprintf(buf, PAGE_SIZE, |
260 | "%s\n", | 262 | "%s\n", |
261 | ARCMSR_DRIVER_VERSION); | 263 | ARCMSR_DRIVER_VERSION); |
262 | } | 264 | } |
263 | 265 | ||
264 | static ssize_t | 266 | static ssize_t |
265 | arcmsr_attr_host_driver_posted_cmd(struct class_device *cdev, char *buf) { | 267 | arcmsr_attr_host_driver_posted_cmd(struct device *dev, |
266 | struct Scsi_Host *host = class_to_shost(cdev); | 268 | struct device_attribute *attr, char *buf) |
267 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 269 | { |
270 | struct Scsi_Host *host = class_to_shost(dev); | ||
271 | struct AdapterControlBlock *acb = | ||
272 | (struct AdapterControlBlock *) host->hostdata; | ||
268 | return snprintf(buf, PAGE_SIZE, | 273 | return snprintf(buf, PAGE_SIZE, |
269 | "%4d\n", | 274 | "%4d\n", |
270 | atomic_read(&acb->ccboutstandingcount)); | 275 | atomic_read(&acb->ccboutstandingcount)); |
271 | } | 276 | } |
272 | 277 | ||
273 | static ssize_t | 278 | static ssize_t |
274 | arcmsr_attr_host_driver_reset(struct class_device *cdev, char *buf) { | 279 | arcmsr_attr_host_driver_reset(struct device *dev, |
275 | struct Scsi_Host *host = class_to_shost(cdev); | 280 | struct device_attribute *attr, char *buf) |
276 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 281 | { |
282 | struct Scsi_Host *host = class_to_shost(dev); | ||
283 | struct AdapterControlBlock *acb = | ||
284 | (struct AdapterControlBlock *) host->hostdata; | ||
277 | return snprintf(buf, PAGE_SIZE, | 285 | return snprintf(buf, PAGE_SIZE, |
278 | "%4d\n", | 286 | "%4d\n", |
279 | acb->num_resets); | 287 | acb->num_resets); |
280 | } | 288 | } |
281 | 289 | ||
282 | static ssize_t | 290 | static ssize_t |
283 | arcmsr_attr_host_driver_abort(struct class_device *cdev, char *buf) { | 291 | arcmsr_attr_host_driver_abort(struct device *dev, |
284 | struct Scsi_Host *host = class_to_shost(cdev); | 292 | struct device_attribute *attr, char *buf) |
285 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 293 | { |
294 | struct Scsi_Host *host = class_to_shost(dev); | ||
295 | struct AdapterControlBlock *acb = | ||
296 | (struct AdapterControlBlock *) host->hostdata; | ||
286 | return snprintf(buf, PAGE_SIZE, | 297 | return snprintf(buf, PAGE_SIZE, |
287 | "%4d\n", | 298 | "%4d\n", |
288 | acb->num_aborts); | 299 | acb->num_aborts); |
289 | } | 300 | } |
290 | 301 | ||
291 | static ssize_t | 302 | static ssize_t |
292 | arcmsr_attr_host_fw_model(struct class_device *cdev, char *buf) { | 303 | arcmsr_attr_host_fw_model(struct device *dev, struct device_attribute *attr, |
293 | struct Scsi_Host *host = class_to_shost(cdev); | 304 | char *buf) |
294 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 305 | { |
306 | struct Scsi_Host *host = class_to_shost(dev); | ||
307 | struct AdapterControlBlock *acb = | ||
308 | (struct AdapterControlBlock *) host->hostdata; | ||
295 | return snprintf(buf, PAGE_SIZE, | 309 | return snprintf(buf, PAGE_SIZE, |
296 | "%s\n", | 310 | "%s\n", |
297 | acb->firm_model); | 311 | acb->firm_model); |
298 | } | 312 | } |
299 | 313 | ||
300 | static ssize_t | 314 | static ssize_t |
301 | arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { | 315 | arcmsr_attr_host_fw_version(struct device *dev, |
302 | struct Scsi_Host *host = class_to_shost(cdev); | 316 | struct device_attribute *attr, char *buf) |
303 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 317 | { |
318 | struct Scsi_Host *host = class_to_shost(dev); | ||
319 | struct AdapterControlBlock *acb = | ||
320 | (struct AdapterControlBlock *) host->hostdata; | ||
304 | 321 | ||
305 | return snprintf(buf, PAGE_SIZE, | 322 | return snprintf(buf, PAGE_SIZE, |
306 | "%s\n", | 323 | "%s\n", |
@@ -308,9 +325,12 @@ arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { | |||
308 | } | 325 | } |
309 | 326 | ||
310 | static ssize_t | 327 | static ssize_t |
311 | arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { | 328 | arcmsr_attr_host_fw_request_len(struct device *dev, |
312 | struct Scsi_Host *host = class_to_shost(cdev); | 329 | struct device_attribute *attr, char *buf) |
313 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 330 | { |
331 | struct Scsi_Host *host = class_to_shost(dev); | ||
332 | struct AdapterControlBlock *acb = | ||
333 | (struct AdapterControlBlock *) host->hostdata; | ||
314 | 334 | ||
315 | return snprintf(buf, PAGE_SIZE, | 335 | return snprintf(buf, PAGE_SIZE, |
316 | "%4d\n", | 336 | "%4d\n", |
@@ -318,9 +338,12 @@ arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { | |||
318 | } | 338 | } |
319 | 339 | ||
320 | static ssize_t | 340 | static ssize_t |
321 | arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { | 341 | arcmsr_attr_host_fw_numbers_queue(struct device *dev, |
322 | struct Scsi_Host *host = class_to_shost(cdev); | 342 | struct device_attribute *attr, char *buf) |
323 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 343 | { |
344 | struct Scsi_Host *host = class_to_shost(dev); | ||
345 | struct AdapterControlBlock *acb = | ||
346 | (struct AdapterControlBlock *) host->hostdata; | ||
324 | 347 | ||
325 | return snprintf(buf, PAGE_SIZE, | 348 | return snprintf(buf, PAGE_SIZE, |
326 | "%4d\n", | 349 | "%4d\n", |
@@ -328,9 +351,12 @@ arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { | |||
328 | } | 351 | } |
329 | 352 | ||
330 | static ssize_t | 353 | static ssize_t |
331 | arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { | 354 | arcmsr_attr_host_fw_sdram_size(struct device *dev, |
332 | struct Scsi_Host *host = class_to_shost(cdev); | 355 | struct device_attribute *attr, char *buf) |
333 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 356 | { |
357 | struct Scsi_Host *host = class_to_shost(dev); | ||
358 | struct AdapterControlBlock *acb = | ||
359 | (struct AdapterControlBlock *) host->hostdata; | ||
334 | 360 | ||
335 | return snprintf(buf, PAGE_SIZE, | 361 | return snprintf(buf, PAGE_SIZE, |
336 | "%4d\n", | 362 | "%4d\n", |
@@ -338,36 +364,39 @@ arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { | |||
338 | } | 364 | } |
339 | 365 | ||
340 | static ssize_t | 366 | static ssize_t |
341 | arcmsr_attr_host_fw_hd_channels(struct class_device *cdev, char *buf) { | 367 | arcmsr_attr_host_fw_hd_channels(struct device *dev, |
342 | struct Scsi_Host *host = class_to_shost(cdev); | 368 | struct device_attribute *attr, char *buf) |
343 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 369 | { |
370 | struct Scsi_Host *host = class_to_shost(dev); | ||
371 | struct AdapterControlBlock *acb = | ||
372 | (struct AdapterControlBlock *) host->hostdata; | ||
344 | 373 | ||
345 | return snprintf(buf, PAGE_SIZE, | 374 | return snprintf(buf, PAGE_SIZE, |
346 | "%4d\n", | 375 | "%4d\n", |
347 | acb->firm_hd_channels); | 376 | acb->firm_hd_channels); |
348 | } | 377 | } |
349 | 378 | ||
350 | static CLASS_DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); | 379 | static DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); |
351 | static CLASS_DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); | 380 | static DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); |
352 | static CLASS_DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); | 381 | static DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); |
353 | static CLASS_DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); | 382 | static DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); |
354 | static CLASS_DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); | 383 | static DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); |
355 | static CLASS_DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); | 384 | static DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); |
356 | static CLASS_DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); | 385 | static DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); |
357 | static CLASS_DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); | 386 | static DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); |
358 | static CLASS_DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); | 387 | static DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); |
359 | static CLASS_DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); | 388 | static DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); |
360 | 389 | ||
361 | struct class_device_attribute *arcmsr_host_attrs[] = { | 390 | struct device_attribute *arcmsr_host_attrs[] = { |
362 | &class_device_attr_host_driver_version, | 391 | &dev_attr_host_driver_version, |
363 | &class_device_attr_host_driver_posted_cmd, | 392 | &dev_attr_host_driver_posted_cmd, |
364 | &class_device_attr_host_driver_reset, | 393 | &dev_attr_host_driver_reset, |
365 | &class_device_attr_host_driver_abort, | 394 | &dev_attr_host_driver_abort, |
366 | &class_device_attr_host_fw_model, | 395 | &dev_attr_host_fw_model, |
367 | &class_device_attr_host_fw_version, | 396 | &dev_attr_host_fw_version, |
368 | &class_device_attr_host_fw_request_len, | 397 | &dev_attr_host_fw_request_len, |
369 | &class_device_attr_host_fw_numbers_queue, | 398 | &dev_attr_host_fw_numbers_queue, |
370 | &class_device_attr_host_fw_sdram_size, | 399 | &dev_attr_host_fw_sdram_size, |
371 | &class_device_attr_host_fw_hd_channels, | 400 | &dev_attr_host_fw_hd_channels, |
372 | NULL, | 401 | NULL, |
373 | }; | 402 | }; |
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c index 92d1cb1b21cb..75c84d7b9ce8 100644 --- a/drivers/scsi/ch.c +++ b/drivers/scsi/ch.c | |||
@@ -881,7 +881,7 @@ static long ch_ioctl_compat(struct file * file, | |||
881 | static int ch_probe(struct device *dev) | 881 | static int ch_probe(struct device *dev) |
882 | { | 882 | { |
883 | struct scsi_device *sd = to_scsi_device(dev); | 883 | struct scsi_device *sd = to_scsi_device(dev); |
884 | struct class_device *class_dev; | 884 | struct device *class_dev; |
885 | int minor, ret = -ENOMEM; | 885 | int minor, ret = -ENOMEM; |
886 | scsi_changer *ch; | 886 | scsi_changer *ch; |
887 | 887 | ||
@@ -910,11 +910,11 @@ static int ch_probe(struct device *dev) | |||
910 | ch->minor = minor; | 910 | ch->minor = minor; |
911 | sprintf(ch->name,"ch%d",ch->minor); | 911 | sprintf(ch->name,"ch%d",ch->minor); |
912 | 912 | ||
913 | class_dev = class_device_create(ch_sysfs_class, NULL, | 913 | class_dev = device_create(ch_sysfs_class, dev, |
914 | MKDEV(SCSI_CHANGER_MAJOR, ch->minor), | 914 | MKDEV(SCSI_CHANGER_MAJOR,ch->minor), |
915 | dev, "s%s", ch->name); | 915 | "s%s", ch->name); |
916 | if (IS_ERR(class_dev)) { | 916 | if (IS_ERR(class_dev)) { |
917 | printk(KERN_WARNING "ch%d: class_device_create failed\n", | 917 | printk(KERN_WARNING "ch%d: device_create failed\n", |
918 | ch->minor); | 918 | ch->minor); |
919 | ret = PTR_ERR(class_dev); | 919 | ret = PTR_ERR(class_dev); |
920 | goto remove_idr; | 920 | goto remove_idr; |
@@ -945,8 +945,7 @@ static int ch_remove(struct device *dev) | |||
945 | idr_remove(&ch_index_idr, ch->minor); | 945 | idr_remove(&ch_index_idr, ch->minor); |
946 | spin_unlock(&ch_index_lock); | 946 | spin_unlock(&ch_index_lock); |
947 | 947 | ||
948 | class_device_destroy(ch_sysfs_class, | 948 | device_destroy(ch_sysfs_class, MKDEV(SCSI_CHANGER_MAJOR,ch->minor)); |
949 | MKDEV(SCSI_CHANGER_MAJOR,ch->minor)); | ||
950 | kfree(ch->dt); | 949 | kfree(ch->dt); |
951 | kfree(ch); | 950 | kfree(ch); |
952 | return 0; | 951 | return 0; |
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 1592640a87b5..c264a8c5f01e 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c | |||
@@ -43,14 +43,14 @@ | |||
43 | static int scsi_host_next_hn; /* host_no for next new host */ | 43 | static int scsi_host_next_hn; /* host_no for next new host */ |
44 | 44 | ||
45 | 45 | ||
46 | static void scsi_host_cls_release(struct class_device *class_dev) | 46 | static void scsi_host_cls_release(struct device *dev) |
47 | { | 47 | { |
48 | put_device(&class_to_shost(class_dev)->shost_gendev); | 48 | put_device(&class_to_shost(dev)->shost_gendev); |
49 | } | 49 | } |
50 | 50 | ||
51 | static struct class shost_class = { | 51 | static struct class shost_class = { |
52 | .name = "scsi_host", | 52 | .name = "scsi_host", |
53 | .release = scsi_host_cls_release, | 53 | .dev_release = scsi_host_cls_release, |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /** | 56 | /** |
@@ -174,7 +174,7 @@ void scsi_remove_host(struct Scsi_Host *shost) | |||
174 | spin_unlock_irqrestore(shost->host_lock, flags); | 174 | spin_unlock_irqrestore(shost->host_lock, flags); |
175 | 175 | ||
176 | transport_unregister_device(&shost->shost_gendev); | 176 | transport_unregister_device(&shost->shost_gendev); |
177 | class_device_unregister(&shost->shost_classdev); | 177 | device_unregister(&shost->shost_dev); |
178 | device_del(&shost->shost_gendev); | 178 | device_del(&shost->shost_gendev); |
179 | scsi_proc_hostdir_rm(shost->hostt); | 179 | scsi_proc_hostdir_rm(shost->hostt); |
180 | } | 180 | } |
@@ -212,7 +212,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) | |||
212 | scsi_host_set_state(shost, SHOST_RUNNING); | 212 | scsi_host_set_state(shost, SHOST_RUNNING); |
213 | get_device(shost->shost_gendev.parent); | 213 | get_device(shost->shost_gendev.parent); |
214 | 214 | ||
215 | error = class_device_add(&shost->shost_classdev); | 215 | error = device_add(&shost->shost_dev); |
216 | if (error) | 216 | if (error) |
217 | goto out_del_gendev; | 217 | goto out_del_gendev; |
218 | 218 | ||
@@ -223,7 +223,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) | |||
223 | GFP_KERNEL); | 223 | GFP_KERNEL); |
224 | if (shost->shost_data == NULL) { | 224 | if (shost->shost_data == NULL) { |
225 | error = -ENOMEM; | 225 | error = -ENOMEM; |
226 | goto out_del_classdev; | 226 | goto out_del_dev; |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
@@ -250,8 +250,8 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev) | |||
250 | destroy_workqueue(shost->work_q); | 250 | destroy_workqueue(shost->work_q); |
251 | out_free_shost_data: | 251 | out_free_shost_data: |
252 | kfree(shost->shost_data); | 252 | kfree(shost->shost_data); |
253 | out_del_classdev: | 253 | out_del_dev: |
254 | class_device_del(&shost->shost_classdev); | 254 | device_del(&shost->shost_dev); |
255 | out_del_gendev: | 255 | out_del_gendev: |
256 | device_del(&shost->shost_gendev); | 256 | device_del(&shost->shost_gendev); |
257 | out: | 257 | out: |
@@ -385,11 +385,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) | |||
385 | shost->host_no); | 385 | shost->host_no); |
386 | shost->shost_gendev.release = scsi_host_dev_release; | 386 | shost->shost_gendev.release = scsi_host_dev_release; |
387 | 387 | ||
388 | class_device_initialize(&shost->shost_classdev); | 388 | device_initialize(&shost->shost_dev); |
389 | shost->shost_classdev.dev = &shost->shost_gendev; | 389 | shost->shost_dev.parent = &shost->shost_gendev; |
390 | shost->shost_classdev.class = &shost_class; | 390 | shost->shost_dev.class = &shost_class; |
391 | snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d", | 391 | snprintf(shost->shost_dev.bus_id, BUS_ID_SIZE, "host%d", |
392 | shost->host_no); | 392 | shost->host_no); |
393 | 393 | ||
394 | shost->ehandler = kthread_run(scsi_error_handler, shost, | 394 | shost->ehandler = kthread_run(scsi_error_handler, shost, |
395 | "scsi_eh_%d", shost->host_no); | 395 | "scsi_eh_%d", shost->host_no); |
@@ -432,12 +432,12 @@ void scsi_unregister(struct Scsi_Host *shost) | |||
432 | } | 432 | } |
433 | EXPORT_SYMBOL(scsi_unregister); | 433 | EXPORT_SYMBOL(scsi_unregister); |
434 | 434 | ||
435 | static int __scsi_host_match(struct class_device *cdev, void *data) | 435 | static int __scsi_host_match(struct device *dev, void *data) |
436 | { | 436 | { |
437 | struct Scsi_Host *p; | 437 | struct Scsi_Host *p; |
438 | unsigned short *hostnum = (unsigned short *)data; | 438 | unsigned short *hostnum = (unsigned short *)data; |
439 | 439 | ||
440 | p = class_to_shost(cdev); | 440 | p = class_to_shost(dev); |
441 | return p->host_no == *hostnum; | 441 | return p->host_no == *hostnum; |
442 | } | 442 | } |
443 | 443 | ||
@@ -450,10 +450,10 @@ static int __scsi_host_match(struct class_device *cdev, void *data) | |||
450 | **/ | 450 | **/ |
451 | struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) | 451 | struct Scsi_Host *scsi_host_lookup(unsigned short hostnum) |
452 | { | 452 | { |
453 | struct class_device *cdev; | 453 | struct device *cdev; |
454 | struct Scsi_Host *shost = ERR_PTR(-ENXIO); | 454 | struct Scsi_Host *shost = ERR_PTR(-ENXIO); |
455 | 455 | ||
456 | cdev = class_find_child(&shost_class, &hostnum, __scsi_host_match); | 456 | cdev = class_find_device(&shost_class, &hostnum, __scsi_host_match); |
457 | if (cdev) | 457 | if (cdev) |
458 | shost = scsi_host_get(class_to_shost(cdev)); | 458 | shost = scsi_host_get(class_to_shost(cdev)); |
459 | 459 | ||
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index beecda991682..5b7be1e9841c 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c | |||
@@ -859,14 +859,16 @@ static int hptiop_adjust_disk_queue_depth(struct scsi_device *sdev, | |||
859 | return queue_depth; | 859 | return queue_depth; |
860 | } | 860 | } |
861 | 861 | ||
862 | static ssize_t hptiop_show_version(struct class_device *class_dev, char *buf) | 862 | static ssize_t hptiop_show_version(struct device *dev, |
863 | struct device_attribute *attr, char *buf) | ||
863 | { | 864 | { |
864 | return snprintf(buf, PAGE_SIZE, "%s\n", driver_ver); | 865 | return snprintf(buf, PAGE_SIZE, "%s\n", driver_ver); |
865 | } | 866 | } |
866 | 867 | ||
867 | static ssize_t hptiop_show_fw_version(struct class_device *class_dev, char *buf) | 868 | static ssize_t hptiop_show_fw_version(struct device *dev, |
869 | struct device_attribute *attr, char *buf) | ||
868 | { | 870 | { |
869 | struct Scsi_Host *host = class_to_shost(class_dev); | 871 | struct Scsi_Host *host = class_to_shost(dev); |
870 | struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; | 872 | struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; |
871 | 873 | ||
872 | return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n", | 874 | return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n", |
@@ -876,7 +878,7 @@ static ssize_t hptiop_show_fw_version(struct class_device *class_dev, char *buf) | |||
876 | hba->firmware_version & 0xff); | 878 | hba->firmware_version & 0xff); |
877 | } | 879 | } |
878 | 880 | ||
879 | static struct class_device_attribute hptiop_attr_version = { | 881 | static struct device_attribute hptiop_attr_version = { |
880 | .attr = { | 882 | .attr = { |
881 | .name = "driver-version", | 883 | .name = "driver-version", |
882 | .mode = S_IRUGO, | 884 | .mode = S_IRUGO, |
@@ -884,7 +886,7 @@ static struct class_device_attribute hptiop_attr_version = { | |||
884 | .show = hptiop_show_version, | 886 | .show = hptiop_show_version, |
885 | }; | 887 | }; |
886 | 888 | ||
887 | static struct class_device_attribute hptiop_attr_fw_version = { | 889 | static struct device_attribute hptiop_attr_fw_version = { |
888 | .attr = { | 890 | .attr = { |
889 | .name = "firmware-version", | 891 | .name = "firmware-version", |
890 | .mode = S_IRUGO, | 892 | .mode = S_IRUGO, |
@@ -892,7 +894,7 @@ static struct class_device_attribute hptiop_attr_fw_version = { | |||
892 | .show = hptiop_show_fw_version, | 894 | .show = hptiop_show_fw_version, |
893 | }; | 895 | }; |
894 | 896 | ||
895 | static struct class_device_attribute *hptiop_attrs[] = { | 897 | static struct device_attribute *hptiop_attrs[] = { |
896 | &hptiop_attr_version, | 898 | &hptiop_attr_version, |
897 | &hptiop_attr_fw_version, | 899 | &hptiop_attr_fw_version, |
898 | NULL | 900 | NULL |
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 78d46a900bb5..4a922c57125e 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -1456,9 +1456,10 @@ static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth) | |||
1456 | /* ------------------------------------------------------------ | 1456 | /* ------------------------------------------------------------ |
1457 | * sysfs attributes | 1457 | * sysfs attributes |
1458 | */ | 1458 | */ |
1459 | static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf) | 1459 | static ssize_t show_host_srp_version(struct device *dev, |
1460 | struct device_attribute *attr, char *buf) | ||
1460 | { | 1461 | { |
1461 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1462 | struct Scsi_Host *shost = class_to_shost(dev); |
1462 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); | 1463 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1463 | int len; | 1464 | int len; |
1464 | 1465 | ||
@@ -1467,7 +1468,7 @@ static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf) | |||
1467 | return len; | 1468 | return len; |
1468 | } | 1469 | } |
1469 | 1470 | ||
1470 | static struct class_device_attribute ibmvscsi_host_srp_version = { | 1471 | static struct device_attribute ibmvscsi_host_srp_version = { |
1471 | .attr = { | 1472 | .attr = { |
1472 | .name = "srp_version", | 1473 | .name = "srp_version", |
1473 | .mode = S_IRUGO, | 1474 | .mode = S_IRUGO, |
@@ -1475,10 +1476,11 @@ static struct class_device_attribute ibmvscsi_host_srp_version = { | |||
1475 | .show = show_host_srp_version, | 1476 | .show = show_host_srp_version, |
1476 | }; | 1477 | }; |
1477 | 1478 | ||
1478 | static ssize_t show_host_partition_name(struct class_device *class_dev, | 1479 | static ssize_t show_host_partition_name(struct device *dev, |
1480 | struct device_attribute *attr, | ||
1479 | char *buf) | 1481 | char *buf) |
1480 | { | 1482 | { |
1481 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1483 | struct Scsi_Host *shost = class_to_shost(dev); |
1482 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); | 1484 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1483 | int len; | 1485 | int len; |
1484 | 1486 | ||
@@ -1487,7 +1489,7 @@ static ssize_t show_host_partition_name(struct class_device *class_dev, | |||
1487 | return len; | 1489 | return len; |
1488 | } | 1490 | } |
1489 | 1491 | ||
1490 | static struct class_device_attribute ibmvscsi_host_partition_name = { | 1492 | static struct device_attribute ibmvscsi_host_partition_name = { |
1491 | .attr = { | 1493 | .attr = { |
1492 | .name = "partition_name", | 1494 | .name = "partition_name", |
1493 | .mode = S_IRUGO, | 1495 | .mode = S_IRUGO, |
@@ -1495,10 +1497,11 @@ static struct class_device_attribute ibmvscsi_host_partition_name = { | |||
1495 | .show = show_host_partition_name, | 1497 | .show = show_host_partition_name, |
1496 | }; | 1498 | }; |
1497 | 1499 | ||
1498 | static ssize_t show_host_partition_number(struct class_device *class_dev, | 1500 | static ssize_t show_host_partition_number(struct device *dev, |
1501 | struct device_attribute *attr, | ||
1499 | char *buf) | 1502 | char *buf) |
1500 | { | 1503 | { |
1501 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1504 | struct Scsi_Host *shost = class_to_shost(dev); |
1502 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); | 1505 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1503 | int len; | 1506 | int len; |
1504 | 1507 | ||
@@ -1507,7 +1510,7 @@ static ssize_t show_host_partition_number(struct class_device *class_dev, | |||
1507 | return len; | 1510 | return len; |
1508 | } | 1511 | } |
1509 | 1512 | ||
1510 | static struct class_device_attribute ibmvscsi_host_partition_number = { | 1513 | static struct device_attribute ibmvscsi_host_partition_number = { |
1511 | .attr = { | 1514 | .attr = { |
1512 | .name = "partition_number", | 1515 | .name = "partition_number", |
1513 | .mode = S_IRUGO, | 1516 | .mode = S_IRUGO, |
@@ -1515,9 +1518,10 @@ static struct class_device_attribute ibmvscsi_host_partition_number = { | |||
1515 | .show = show_host_partition_number, | 1518 | .show = show_host_partition_number, |
1516 | }; | 1519 | }; |
1517 | 1520 | ||
1518 | static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf) | 1521 | static ssize_t show_host_mad_version(struct device *dev, |
1522 | struct device_attribute *attr, char *buf) | ||
1519 | { | 1523 | { |
1520 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1524 | struct Scsi_Host *shost = class_to_shost(dev); |
1521 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); | 1525 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1522 | int len; | 1526 | int len; |
1523 | 1527 | ||
@@ -1526,7 +1530,7 @@ static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf) | |||
1526 | return len; | 1530 | return len; |
1527 | } | 1531 | } |
1528 | 1532 | ||
1529 | static struct class_device_attribute ibmvscsi_host_mad_version = { | 1533 | static struct device_attribute ibmvscsi_host_mad_version = { |
1530 | .attr = { | 1534 | .attr = { |
1531 | .name = "mad_version", | 1535 | .name = "mad_version", |
1532 | .mode = S_IRUGO, | 1536 | .mode = S_IRUGO, |
@@ -1534,9 +1538,10 @@ static struct class_device_attribute ibmvscsi_host_mad_version = { | |||
1534 | .show = show_host_mad_version, | 1538 | .show = show_host_mad_version, |
1535 | }; | 1539 | }; |
1536 | 1540 | ||
1537 | static ssize_t show_host_os_type(struct class_device *class_dev, char *buf) | 1541 | static ssize_t show_host_os_type(struct device *dev, |
1542 | struct device_attribute *attr, char *buf) | ||
1538 | { | 1543 | { |
1539 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1544 | struct Scsi_Host *shost = class_to_shost(dev); |
1540 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); | 1545 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1541 | int len; | 1546 | int len; |
1542 | 1547 | ||
@@ -1544,7 +1549,7 @@ static ssize_t show_host_os_type(struct class_device *class_dev, char *buf) | |||
1544 | return len; | 1549 | return len; |
1545 | } | 1550 | } |
1546 | 1551 | ||
1547 | static struct class_device_attribute ibmvscsi_host_os_type = { | 1552 | static struct device_attribute ibmvscsi_host_os_type = { |
1548 | .attr = { | 1553 | .attr = { |
1549 | .name = "os_type", | 1554 | .name = "os_type", |
1550 | .mode = S_IRUGO, | 1555 | .mode = S_IRUGO, |
@@ -1552,9 +1557,10 @@ static struct class_device_attribute ibmvscsi_host_os_type = { | |||
1552 | .show = show_host_os_type, | 1557 | .show = show_host_os_type, |
1553 | }; | 1558 | }; |
1554 | 1559 | ||
1555 | static ssize_t show_host_config(struct class_device *class_dev, char *buf) | 1560 | static ssize_t show_host_config(struct device *dev, |
1561 | struct device_attribute *attr, char *buf) | ||
1556 | { | 1562 | { |
1557 | struct Scsi_Host *shost = class_to_shost(class_dev); | 1563 | struct Scsi_Host *shost = class_to_shost(dev); |
1558 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); | 1564 | struct ibmvscsi_host_data *hostdata = shost_priv(shost); |
1559 | 1565 | ||
1560 | /* returns null-terminated host config data */ | 1566 | /* returns null-terminated host config data */ |
@@ -1564,7 +1570,7 @@ static ssize_t show_host_config(struct class_device *class_dev, char *buf) | |||
1564 | return 0; | 1570 | return 0; |
1565 | } | 1571 | } |
1566 | 1572 | ||
1567 | static struct class_device_attribute ibmvscsi_host_config = { | 1573 | static struct device_attribute ibmvscsi_host_config = { |
1568 | .attr = { | 1574 | .attr = { |
1569 | .name = "config", | 1575 | .name = "config", |
1570 | .mode = S_IRUGO, | 1576 | .mode = S_IRUGO, |
@@ -1572,7 +1578,7 @@ static struct class_device_attribute ibmvscsi_host_config = { | |||
1572 | .show = show_host_config, | 1578 | .show = show_host_config, |
1573 | }; | 1579 | }; |
1574 | 1580 | ||
1575 | static struct class_device_attribute *ibmvscsi_attrs[] = { | 1581 | static struct device_attribute *ibmvscsi_attrs[] = { |
1576 | &ibmvscsi_host_srp_version, | 1582 | &ibmvscsi_host_srp_version, |
1577 | &ibmvscsi_host_partition_name, | 1583 | &ibmvscsi_host_partition_name, |
1578 | &ibmvscsi_host_partition_number, | 1584 | &ibmvscsi_host_partition_number, |
diff --git a/drivers/scsi/ibmvscsi/ibmvstgt.c b/drivers/scsi/ibmvscsi/ibmvstgt.c index e5881e92d0fb..3b9514c8f1f1 100644 --- a/drivers/scsi/ibmvscsi/ibmvstgt.c +++ b/drivers/scsi/ibmvscsi/ibmvstgt.c | |||
@@ -780,32 +780,35 @@ static int ibmvstgt_it_nexus_response(struct Scsi_Host *shost, u64 itn_id, | |||
780 | return 0; | 780 | return 0; |
781 | } | 781 | } |
782 | 782 | ||
783 | static ssize_t system_id_show(struct class_device *cdev, char *buf) | 783 | static ssize_t system_id_show(struct device *dev, |
784 | struct device_attribute *attr, char *buf) | ||
784 | { | 785 | { |
785 | return snprintf(buf, PAGE_SIZE, "%s\n", system_id); | 786 | return snprintf(buf, PAGE_SIZE, "%s\n", system_id); |
786 | } | 787 | } |
787 | 788 | ||
788 | static ssize_t partition_number_show(struct class_device *cdev, char *buf) | 789 | static ssize_t partition_number_show(struct device *dev, |
790 | struct device_attribute *attr, char *buf) | ||
789 | { | 791 | { |
790 | return snprintf(buf, PAGE_SIZE, "%x\n", partition_number); | 792 | return snprintf(buf, PAGE_SIZE, "%x\n", partition_number); |
791 | } | 793 | } |
792 | 794 | ||
793 | static ssize_t unit_address_show(struct class_device *cdev, char *buf) | 795 | static ssize_t unit_address_show(struct device *dev, |
796 | struct device_attribute *attr, char *buf) | ||
794 | { | 797 | { |
795 | struct Scsi_Host *shost = class_to_shost(cdev); | 798 | struct Scsi_Host *shost = class_to_shost(dev); |
796 | struct srp_target *target = host_to_srp_target(shost); | 799 | struct srp_target *target = host_to_srp_target(shost); |
797 | struct vio_port *vport = target_to_port(target); | 800 | struct vio_port *vport = target_to_port(target); |
798 | return snprintf(buf, PAGE_SIZE, "%x\n", vport->dma_dev->unit_address); | 801 | return snprintf(buf, PAGE_SIZE, "%x\n", vport->dma_dev->unit_address); |
799 | } | 802 | } |
800 | 803 | ||
801 | static CLASS_DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL); | 804 | static DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL); |
802 | static CLASS_DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL); | 805 | static DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL); |
803 | static CLASS_DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL); | 806 | static DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL); |
804 | 807 | ||
805 | static struct class_device_attribute *ibmvstgt_attrs[] = { | 808 | static struct device_attribute *ibmvstgt_attrs[] = { |
806 | &class_device_attr_system_id, | 809 | &dev_attr_system_id, |
807 | &class_device_attr_partition_number, | 810 | &dev_attr_partition_number, |
808 | &class_device_attr_unit_address, | 811 | &dev_attr_unit_address, |
809 | NULL, | 812 | NULL, |
810 | }; | 813 | }; |
811 | 814 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 65dc18dea845..de5ae6a65029 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2431,7 +2431,7 @@ restart: | |||
2431 | } | 2431 | } |
2432 | 2432 | ||
2433 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); | 2433 | spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); |
2434 | kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE); | 2434 | kobject_uevent(&ioa_cfg->host->shost_dev.kobj, KOBJ_CHANGE); |
2435 | LEAVE; | 2435 | LEAVE; |
2436 | } | 2436 | } |
2437 | 2437 | ||
@@ -2451,8 +2451,8 @@ static ssize_t ipr_read_trace(struct kobject *kobj, | |||
2451 | struct bin_attribute *bin_attr, | 2451 | struct bin_attribute *bin_attr, |
2452 | char *buf, loff_t off, size_t count) | 2452 | char *buf, loff_t off, size_t count) |
2453 | { | 2453 | { |
2454 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 2454 | struct device *dev = container_of(kobj, struct device, kobj); |
2455 | struct Scsi_Host *shost = class_to_shost(cdev); | 2455 | struct Scsi_Host *shost = class_to_shost(dev); |
2456 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2456 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2457 | unsigned long lock_flags = 0; | 2457 | unsigned long lock_flags = 0; |
2458 | int size = IPR_TRACE_SIZE; | 2458 | int size = IPR_TRACE_SIZE; |
@@ -2492,15 +2492,16 @@ static const struct { | |||
2492 | 2492 | ||
2493 | /** | 2493 | /** |
2494 | * ipr_show_write_caching - Show the write caching attribute | 2494 | * ipr_show_write_caching - Show the write caching attribute |
2495 | * @class_dev: class device struct | 2495 | * @dev: device struct |
2496 | * @buf: buffer | 2496 | * @buf: buffer |
2497 | * | 2497 | * |
2498 | * Return value: | 2498 | * Return value: |
2499 | * number of bytes printed to buffer | 2499 | * number of bytes printed to buffer |
2500 | **/ | 2500 | **/ |
2501 | static ssize_t ipr_show_write_caching(struct class_device *class_dev, char *buf) | 2501 | static ssize_t ipr_show_write_caching(struct device *dev, |
2502 | struct device_attribute *attr, char *buf) | ||
2502 | { | 2503 | { |
2503 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2504 | struct Scsi_Host *shost = class_to_shost(dev); |
2504 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2505 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2505 | unsigned long lock_flags = 0; | 2506 | unsigned long lock_flags = 0; |
2506 | int i, len = 0; | 2507 | int i, len = 0; |
@@ -2519,19 +2520,20 @@ static ssize_t ipr_show_write_caching(struct class_device *class_dev, char *buf) | |||
2519 | 2520 | ||
2520 | /** | 2521 | /** |
2521 | * ipr_store_write_caching - Enable/disable adapter write cache | 2522 | * ipr_store_write_caching - Enable/disable adapter write cache |
2522 | * @class_dev: class_device struct | 2523 | * @dev: device struct |
2523 | * @buf: buffer | 2524 | * @buf: buffer |
2524 | * @count: buffer size | 2525 | * @count: buffer size |
2525 | * | 2526 | * |
2526 | * This function will enable/disable adapter write cache. | 2527 | * This function will enable/disable adapter write cache. |
2527 | * | 2528 | * |
2528 | * Return value: | 2529 | * Return value: |
2529 | * count on success / other on failure | 2530 | * count on success / other on failure |
2530 | **/ | 2531 | **/ |
2531 | static ssize_t ipr_store_write_caching(struct class_device *class_dev, | 2532 | static ssize_t ipr_store_write_caching(struct device *dev, |
2532 | const char *buf, size_t count) | 2533 | struct device_attribute *attr, |
2534 | const char *buf, size_t count) | ||
2533 | { | 2535 | { |
2534 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2536 | struct Scsi_Host *shost = class_to_shost(dev); |
2535 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2537 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2536 | unsigned long lock_flags = 0; | 2538 | unsigned long lock_flags = 0; |
2537 | enum ipr_cache_state new_state = CACHE_INVALID; | 2539 | enum ipr_cache_state new_state = CACHE_INVALID; |
@@ -2569,7 +2571,7 @@ static ssize_t ipr_store_write_caching(struct class_device *class_dev, | |||
2569 | return count; | 2571 | return count; |
2570 | } | 2572 | } |
2571 | 2573 | ||
2572 | static struct class_device_attribute ipr_ioa_cache_attr = { | 2574 | static struct device_attribute ipr_ioa_cache_attr = { |
2573 | .attr = { | 2575 | .attr = { |
2574 | .name = "write_cache", | 2576 | .name = "write_cache", |
2575 | .mode = S_IRUGO | S_IWUSR, | 2577 | .mode = S_IRUGO | S_IWUSR, |
@@ -2580,15 +2582,16 @@ static struct class_device_attribute ipr_ioa_cache_attr = { | |||
2580 | 2582 | ||
2581 | /** | 2583 | /** |
2582 | * ipr_show_fw_version - Show the firmware version | 2584 | * ipr_show_fw_version - Show the firmware version |
2583 | * @class_dev: class device struct | 2585 | * @dev: class device struct |
2584 | * @buf: buffer | 2586 | * @buf: buffer |
2585 | * | 2587 | * |
2586 | * Return value: | 2588 | * Return value: |
2587 | * number of bytes printed to buffer | 2589 | * number of bytes printed to buffer |
2588 | **/ | 2590 | **/ |
2589 | static ssize_t ipr_show_fw_version(struct class_device *class_dev, char *buf) | 2591 | static ssize_t ipr_show_fw_version(struct device *dev, |
2592 | struct device_attribute *attr, char *buf) | ||
2590 | { | 2593 | { |
2591 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2594 | struct Scsi_Host *shost = class_to_shost(dev); |
2592 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2595 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2593 | struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data; | 2596 | struct ipr_inquiry_page3 *ucode_vpd = &ioa_cfg->vpd_cbs->page3_data; |
2594 | unsigned long lock_flags = 0; | 2597 | unsigned long lock_flags = 0; |
@@ -2603,7 +2606,7 @@ static ssize_t ipr_show_fw_version(struct class_device *class_dev, char *buf) | |||
2603 | return len; | 2606 | return len; |
2604 | } | 2607 | } |
2605 | 2608 | ||
2606 | static struct class_device_attribute ipr_fw_version_attr = { | 2609 | static struct device_attribute ipr_fw_version_attr = { |
2607 | .attr = { | 2610 | .attr = { |
2608 | .name = "fw_version", | 2611 | .name = "fw_version", |
2609 | .mode = S_IRUGO, | 2612 | .mode = S_IRUGO, |
@@ -2613,15 +2616,16 @@ static struct class_device_attribute ipr_fw_version_attr = { | |||
2613 | 2616 | ||
2614 | /** | 2617 | /** |
2615 | * ipr_show_log_level - Show the adapter's error logging level | 2618 | * ipr_show_log_level - Show the adapter's error logging level |
2616 | * @class_dev: class device struct | 2619 | * @dev: class device struct |
2617 | * @buf: buffer | 2620 | * @buf: buffer |
2618 | * | 2621 | * |
2619 | * Return value: | 2622 | * Return value: |
2620 | * number of bytes printed to buffer | 2623 | * number of bytes printed to buffer |
2621 | **/ | 2624 | **/ |
2622 | static ssize_t ipr_show_log_level(struct class_device *class_dev, char *buf) | 2625 | static ssize_t ipr_show_log_level(struct device *dev, |
2626 | struct device_attribute *attr, char *buf) | ||
2623 | { | 2627 | { |
2624 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2628 | struct Scsi_Host *shost = class_to_shost(dev); |
2625 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2629 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2626 | unsigned long lock_flags = 0; | 2630 | unsigned long lock_flags = 0; |
2627 | int len; | 2631 | int len; |
@@ -2634,16 +2638,17 @@ static ssize_t ipr_show_log_level(struct class_device *class_dev, char *buf) | |||
2634 | 2638 | ||
2635 | /** | 2639 | /** |
2636 | * ipr_store_log_level - Change the adapter's error logging level | 2640 | * ipr_store_log_level - Change the adapter's error logging level |
2637 | * @class_dev: class device struct | 2641 | * @dev: class device struct |
2638 | * @buf: buffer | 2642 | * @buf: buffer |
2639 | * | 2643 | * |
2640 | * Return value: | 2644 | * Return value: |
2641 | * number of bytes printed to buffer | 2645 | * number of bytes printed to buffer |
2642 | **/ | 2646 | **/ |
2643 | static ssize_t ipr_store_log_level(struct class_device *class_dev, | 2647 | static ssize_t ipr_store_log_level(struct device *dev, |
2648 | struct device_attribute *attr, | ||
2644 | const char *buf, size_t count) | 2649 | const char *buf, size_t count) |
2645 | { | 2650 | { |
2646 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2651 | struct Scsi_Host *shost = class_to_shost(dev); |
2647 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2652 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2648 | unsigned long lock_flags = 0; | 2653 | unsigned long lock_flags = 0; |
2649 | 2654 | ||
@@ -2653,7 +2658,7 @@ static ssize_t ipr_store_log_level(struct class_device *class_dev, | |||
2653 | return strlen(buf); | 2658 | return strlen(buf); |
2654 | } | 2659 | } |
2655 | 2660 | ||
2656 | static struct class_device_attribute ipr_log_level_attr = { | 2661 | static struct device_attribute ipr_log_level_attr = { |
2657 | .attr = { | 2662 | .attr = { |
2658 | .name = "log_level", | 2663 | .name = "log_level", |
2659 | .mode = S_IRUGO | S_IWUSR, | 2664 | .mode = S_IRUGO | S_IWUSR, |
@@ -2664,9 +2669,9 @@ static struct class_device_attribute ipr_log_level_attr = { | |||
2664 | 2669 | ||
2665 | /** | 2670 | /** |
2666 | * ipr_store_diagnostics - IOA Diagnostics interface | 2671 | * ipr_store_diagnostics - IOA Diagnostics interface |
2667 | * @class_dev: class_device struct | 2672 | * @dev: device struct |
2668 | * @buf: buffer | 2673 | * @buf: buffer |
2669 | * @count: buffer size | 2674 | * @count: buffer size |
2670 | * | 2675 | * |
2671 | * This function will reset the adapter and wait a reasonable | 2676 | * This function will reset the adapter and wait a reasonable |
2672 | * amount of time for any errors that the adapter might log. | 2677 | * amount of time for any errors that the adapter might log. |
@@ -2674,10 +2679,11 @@ static struct class_device_attribute ipr_log_level_attr = { | |||
2674 | * Return value: | 2679 | * Return value: |
2675 | * count on success / other on failure | 2680 | * count on success / other on failure |
2676 | **/ | 2681 | **/ |
2677 | static ssize_t ipr_store_diagnostics(struct class_device *class_dev, | 2682 | static ssize_t ipr_store_diagnostics(struct device *dev, |
2683 | struct device_attribute *attr, | ||
2678 | const char *buf, size_t count) | 2684 | const char *buf, size_t count) |
2679 | { | 2685 | { |
2680 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2686 | struct Scsi_Host *shost = class_to_shost(dev); |
2681 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2687 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2682 | unsigned long lock_flags = 0; | 2688 | unsigned long lock_flags = 0; |
2683 | int rc = count; | 2689 | int rc = count; |
@@ -2714,7 +2720,7 @@ static ssize_t ipr_store_diagnostics(struct class_device *class_dev, | |||
2714 | return rc; | 2720 | return rc; |
2715 | } | 2721 | } |
2716 | 2722 | ||
2717 | static struct class_device_attribute ipr_diagnostics_attr = { | 2723 | static struct device_attribute ipr_diagnostics_attr = { |
2718 | .attr = { | 2724 | .attr = { |
2719 | .name = "run_diagnostics", | 2725 | .name = "run_diagnostics", |
2720 | .mode = S_IWUSR, | 2726 | .mode = S_IWUSR, |
@@ -2724,15 +2730,16 @@ static struct class_device_attribute ipr_diagnostics_attr = { | |||
2724 | 2730 | ||
2725 | /** | 2731 | /** |
2726 | * ipr_show_adapter_state - Show the adapter's state | 2732 | * ipr_show_adapter_state - Show the adapter's state |
2727 | * @class_dev: class device struct | 2733 | * @class_dev: device struct |
2728 | * @buf: buffer | 2734 | * @buf: buffer |
2729 | * | 2735 | * |
2730 | * Return value: | 2736 | * Return value: |
2731 | * number of bytes printed to buffer | 2737 | * number of bytes printed to buffer |
2732 | **/ | 2738 | **/ |
2733 | static ssize_t ipr_show_adapter_state(struct class_device *class_dev, char *buf) | 2739 | static ssize_t ipr_show_adapter_state(struct device *dev, |
2740 | struct device_attribute *attr, char *buf) | ||
2734 | { | 2741 | { |
2735 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2742 | struct Scsi_Host *shost = class_to_shost(dev); |
2736 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2743 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2737 | unsigned long lock_flags = 0; | 2744 | unsigned long lock_flags = 0; |
2738 | int len; | 2745 | int len; |
@@ -2748,19 +2755,20 @@ static ssize_t ipr_show_adapter_state(struct class_device *class_dev, char *buf) | |||
2748 | 2755 | ||
2749 | /** | 2756 | /** |
2750 | * ipr_store_adapter_state - Change adapter state | 2757 | * ipr_store_adapter_state - Change adapter state |
2751 | * @class_dev: class_device struct | 2758 | * @dev: device struct |
2752 | * @buf: buffer | 2759 | * @buf: buffer |
2753 | * @count: buffer size | 2760 | * @count: buffer size |
2754 | * | 2761 | * |
2755 | * This function will change the adapter's state. | 2762 | * This function will change the adapter's state. |
2756 | * | 2763 | * |
2757 | * Return value: | 2764 | * Return value: |
2758 | * count on success / other on failure | 2765 | * count on success / other on failure |
2759 | **/ | 2766 | **/ |
2760 | static ssize_t ipr_store_adapter_state(struct class_device *class_dev, | 2767 | static ssize_t ipr_store_adapter_state(struct device *dev, |
2768 | struct device_attribute *attr, | ||
2761 | const char *buf, size_t count) | 2769 | const char *buf, size_t count) |
2762 | { | 2770 | { |
2763 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2771 | struct Scsi_Host *shost = class_to_shost(dev); |
2764 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2772 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2765 | unsigned long lock_flags; | 2773 | unsigned long lock_flags; |
2766 | int result = count; | 2774 | int result = count; |
@@ -2781,7 +2789,7 @@ static ssize_t ipr_store_adapter_state(struct class_device *class_dev, | |||
2781 | return result; | 2789 | return result; |
2782 | } | 2790 | } |
2783 | 2791 | ||
2784 | static struct class_device_attribute ipr_ioa_state_attr = { | 2792 | static struct device_attribute ipr_ioa_state_attr = { |
2785 | .attr = { | 2793 | .attr = { |
2786 | .name = "state", | 2794 | .name = "state", |
2787 | .mode = S_IRUGO | S_IWUSR, | 2795 | .mode = S_IRUGO | S_IWUSR, |
@@ -2792,19 +2800,20 @@ static struct class_device_attribute ipr_ioa_state_attr = { | |||
2792 | 2800 | ||
2793 | /** | 2801 | /** |
2794 | * ipr_store_reset_adapter - Reset the adapter | 2802 | * ipr_store_reset_adapter - Reset the adapter |
2795 | * @class_dev: class_device struct | 2803 | * @dev: device struct |
2796 | * @buf: buffer | 2804 | * @buf: buffer |
2797 | * @count: buffer size | 2805 | * @count: buffer size |
2798 | * | 2806 | * |
2799 | * This function will reset the adapter. | 2807 | * This function will reset the adapter. |
2800 | * | 2808 | * |
2801 | * Return value: | 2809 | * Return value: |
2802 | * count on success / other on failure | 2810 | * count on success / other on failure |
2803 | **/ | 2811 | **/ |
2804 | static ssize_t ipr_store_reset_adapter(struct class_device *class_dev, | 2812 | static ssize_t ipr_store_reset_adapter(struct device *dev, |
2813 | struct device_attribute *attr, | ||
2805 | const char *buf, size_t count) | 2814 | const char *buf, size_t count) |
2806 | { | 2815 | { |
2807 | struct Scsi_Host *shost = class_to_shost(class_dev); | 2816 | struct Scsi_Host *shost = class_to_shost(dev); |
2808 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 2817 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
2809 | unsigned long lock_flags; | 2818 | unsigned long lock_flags; |
2810 | int result = count; | 2819 | int result = count; |
@@ -2821,7 +2830,7 @@ static ssize_t ipr_store_reset_adapter(struct class_device *class_dev, | |||
2821 | return result; | 2830 | return result; |
2822 | } | 2831 | } |
2823 | 2832 | ||
2824 | static struct class_device_attribute ipr_ioa_reset_attr = { | 2833 | static struct device_attribute ipr_ioa_reset_attr = { |
2825 | .attr = { | 2834 | .attr = { |
2826 | .name = "reset_host", | 2835 | .name = "reset_host", |
2827 | .mode = S_IWUSR, | 2836 | .mode = S_IWUSR, |
@@ -3054,19 +3063,20 @@ static int ipr_update_ioa_ucode(struct ipr_ioa_cfg *ioa_cfg, | |||
3054 | 3063 | ||
3055 | /** | 3064 | /** |
3056 | * ipr_store_update_fw - Update the firmware on the adapter | 3065 | * ipr_store_update_fw - Update the firmware on the adapter |
3057 | * @class_dev: class_device struct | 3066 | * @class_dev: device struct |
3058 | * @buf: buffer | 3067 | * @buf: buffer |
3059 | * @count: buffer size | 3068 | * @count: buffer size |
3060 | * | 3069 | * |
3061 | * This function will update the firmware on the adapter. | 3070 | * This function will update the firmware on the adapter. |
3062 | * | 3071 | * |
3063 | * Return value: | 3072 | * Return value: |
3064 | * count on success / other on failure | 3073 | * count on success / other on failure |
3065 | **/ | 3074 | **/ |
3066 | static ssize_t ipr_store_update_fw(struct class_device *class_dev, | 3075 | static ssize_t ipr_store_update_fw(struct device *dev, |
3067 | const char *buf, size_t count) | 3076 | struct device_attribute *attr, |
3077 | const char *buf, size_t count) | ||
3068 | { | 3078 | { |
3069 | struct Scsi_Host *shost = class_to_shost(class_dev); | 3079 | struct Scsi_Host *shost = class_to_shost(dev); |
3070 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 3080 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
3071 | struct ipr_ucode_image_header *image_hdr; | 3081 | struct ipr_ucode_image_header *image_hdr; |
3072 | const struct firmware *fw_entry; | 3082 | const struct firmware *fw_entry; |
@@ -3124,7 +3134,7 @@ out: | |||
3124 | return result; | 3134 | return result; |
3125 | } | 3135 | } |
3126 | 3136 | ||
3127 | static struct class_device_attribute ipr_update_fw_attr = { | 3137 | static struct device_attribute ipr_update_fw_attr = { |
3128 | .attr = { | 3138 | .attr = { |
3129 | .name = "update_fw", | 3139 | .name = "update_fw", |
3130 | .mode = S_IWUSR, | 3140 | .mode = S_IWUSR, |
@@ -3132,7 +3142,7 @@ static struct class_device_attribute ipr_update_fw_attr = { | |||
3132 | .store = ipr_store_update_fw | 3142 | .store = ipr_store_update_fw |
3133 | }; | 3143 | }; |
3134 | 3144 | ||
3135 | static struct class_device_attribute *ipr_ioa_attrs[] = { | 3145 | static struct device_attribute *ipr_ioa_attrs[] = { |
3136 | &ipr_fw_version_attr, | 3146 | &ipr_fw_version_attr, |
3137 | &ipr_log_level_attr, | 3147 | &ipr_log_level_attr, |
3138 | &ipr_diagnostics_attr, | 3148 | &ipr_diagnostics_attr, |
@@ -3159,7 +3169,7 @@ static ssize_t ipr_read_dump(struct kobject *kobj, | |||
3159 | struct bin_attribute *bin_attr, | 3169 | struct bin_attribute *bin_attr, |
3160 | char *buf, loff_t off, size_t count) | 3170 | char *buf, loff_t off, size_t count) |
3161 | { | 3171 | { |
3162 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 3172 | struct device *cdev = container_of(kobj, struct device, kobj); |
3163 | struct Scsi_Host *shost = class_to_shost(cdev); | 3173 | struct Scsi_Host *shost = class_to_shost(cdev); |
3164 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 3174 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
3165 | struct ipr_dump *dump; | 3175 | struct ipr_dump *dump; |
@@ -3322,7 +3332,7 @@ static ssize_t ipr_write_dump(struct kobject *kobj, | |||
3322 | struct bin_attribute *bin_attr, | 3332 | struct bin_attribute *bin_attr, |
3323 | char *buf, loff_t off, size_t count) | 3333 | char *buf, loff_t off, size_t count) |
3324 | { | 3334 | { |
3325 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 3335 | struct device *cdev = container_of(kobj, struct device, kobj); |
3326 | struct Scsi_Host *shost = class_to_shost(cdev); | 3336 | struct Scsi_Host *shost = class_to_shost(cdev); |
3327 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; | 3337 | struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata; |
3328 | int rc; | 3338 | int rc; |
@@ -7671,9 +7681,9 @@ static void ipr_remove(struct pci_dev *pdev) | |||
7671 | 7681 | ||
7672 | ENTER; | 7682 | ENTER; |
7673 | 7683 | ||
7674 | ipr_remove_trace_file(&ioa_cfg->host->shost_classdev.kobj, | 7684 | ipr_remove_trace_file(&ioa_cfg->host->shost_dev.kobj, |
7675 | &ipr_trace_attr); | 7685 | &ipr_trace_attr); |
7676 | ipr_remove_dump_file(&ioa_cfg->host->shost_classdev.kobj, | 7686 | ipr_remove_dump_file(&ioa_cfg->host->shost_dev.kobj, |
7677 | &ipr_dump_attr); | 7687 | &ipr_dump_attr); |
7678 | scsi_remove_host(ioa_cfg->host); | 7688 | scsi_remove_host(ioa_cfg->host); |
7679 | 7689 | ||
@@ -7714,7 +7724,7 @@ static int __devinit ipr_probe(struct pci_dev *pdev, | |||
7714 | return rc; | 7724 | return rc; |
7715 | } | 7725 | } |
7716 | 7726 | ||
7717 | rc = ipr_create_trace_file(&ioa_cfg->host->shost_classdev.kobj, | 7727 | rc = ipr_create_trace_file(&ioa_cfg->host->shost_dev.kobj, |
7718 | &ipr_trace_attr); | 7728 | &ipr_trace_attr); |
7719 | 7729 | ||
7720 | if (rc) { | 7730 | if (rc) { |
@@ -7723,11 +7733,11 @@ static int __devinit ipr_probe(struct pci_dev *pdev, | |||
7723 | return rc; | 7733 | return rc; |
7724 | } | 7734 | } |
7725 | 7735 | ||
7726 | rc = ipr_create_dump_file(&ioa_cfg->host->shost_classdev.kobj, | 7736 | rc = ipr_create_dump_file(&ioa_cfg->host->shost_dev.kobj, |
7727 | &ipr_dump_attr); | 7737 | &ipr_dump_attr); |
7728 | 7738 | ||
7729 | if (rc) { | 7739 | if (rc) { |
7730 | ipr_remove_trace_file(&ioa_cfg->host->shost_classdev.kobj, | 7740 | ipr_remove_trace_file(&ioa_cfg->host->shost_dev.kobj, |
7731 | &ipr_trace_attr); | 7741 | &ipr_trace_attr); |
7732 | scsi_remove_host(ioa_cfg->host); | 7742 | scsi_remove_host(ioa_cfg->host); |
7733 | __ipr_remove(pdev); | 7743 | __ipr_remove(pdev); |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 74c9fc204211..a9fbb3f88659 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -66,23 +66,26 @@ lpfc_jedec_to_ascii(int incr, char hdw[]) | |||
66 | } | 66 | } |
67 | 67 | ||
68 | static ssize_t | 68 | static ssize_t |
69 | lpfc_drvr_version_show(struct class_device *cdev, char *buf) | 69 | lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr, |
70 | char *buf) | ||
70 | { | 71 | { |
71 | return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); | 72 | return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); |
72 | } | 73 | } |
73 | 74 | ||
74 | static ssize_t | 75 | static ssize_t |
75 | lpfc_info_show(struct class_device *cdev, char *buf) | 76 | lpfc_info_show(struct device *dev, struct device_attribute *attr, |
77 | char *buf) | ||
76 | { | 78 | { |
77 | struct Scsi_Host *host = class_to_shost(cdev); | 79 | struct Scsi_Host *host = class_to_shost(dev); |
78 | 80 | ||
79 | return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host)); | 81 | return snprintf(buf, PAGE_SIZE, "%s\n",lpfc_info(host)); |
80 | } | 82 | } |
81 | 83 | ||
82 | static ssize_t | 84 | static ssize_t |
83 | lpfc_serialnum_show(struct class_device *cdev, char *buf) | 85 | lpfc_serialnum_show(struct device *dev, struct device_attribute *attr, |
86 | char *buf) | ||
84 | { | 87 | { |
85 | struct Scsi_Host *shost = class_to_shost(cdev); | 88 | struct Scsi_Host *shost = class_to_shost(dev); |
86 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 89 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
87 | struct lpfc_hba *phba = vport->phba; | 90 | struct lpfc_hba *phba = vport->phba; |
88 | 91 | ||
@@ -90,18 +93,20 @@ lpfc_serialnum_show(struct class_device *cdev, char *buf) | |||
90 | } | 93 | } |
91 | 94 | ||
92 | static ssize_t | 95 | static ssize_t |
93 | lpfc_temp_sensor_show(struct class_device *cdev, char *buf) | 96 | lpfc_temp_sensor_show(struct device *dev, struct device_attribute *attr, |
97 | char *buf) | ||
94 | { | 98 | { |
95 | struct Scsi_Host *shost = class_to_shost(cdev); | 99 | struct Scsi_Host *shost = class_to_shost(dev); |
96 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 100 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
97 | struct lpfc_hba *phba = vport->phba; | 101 | struct lpfc_hba *phba = vport->phba; |
98 | return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support); | 102 | return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support); |
99 | } | 103 | } |
100 | 104 | ||
101 | static ssize_t | 105 | static ssize_t |
102 | lpfc_modeldesc_show(struct class_device *cdev, char *buf) | 106 | lpfc_modeldesc_show(struct device *dev, struct device_attribute *attr, |
107 | char *buf) | ||
103 | { | 108 | { |
104 | struct Scsi_Host *shost = class_to_shost(cdev); | 109 | struct Scsi_Host *shost = class_to_shost(dev); |
105 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 110 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
106 | struct lpfc_hba *phba = vport->phba; | 111 | struct lpfc_hba *phba = vport->phba; |
107 | 112 | ||
@@ -109,9 +114,10 @@ lpfc_modeldesc_show(struct class_device *cdev, char *buf) | |||
109 | } | 114 | } |
110 | 115 | ||
111 | static ssize_t | 116 | static ssize_t |
112 | lpfc_modelname_show(struct class_device *cdev, char *buf) | 117 | lpfc_modelname_show(struct device *dev, struct device_attribute *attr, |
118 | char *buf) | ||
113 | { | 119 | { |
114 | struct Scsi_Host *shost = class_to_shost(cdev); | 120 | struct Scsi_Host *shost = class_to_shost(dev); |
115 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 121 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
116 | struct lpfc_hba *phba = vport->phba; | 122 | struct lpfc_hba *phba = vport->phba; |
117 | 123 | ||
@@ -119,9 +125,10 @@ lpfc_modelname_show(struct class_device *cdev, char *buf) | |||
119 | } | 125 | } |
120 | 126 | ||
121 | static ssize_t | 127 | static ssize_t |
122 | lpfc_programtype_show(struct class_device *cdev, char *buf) | 128 | lpfc_programtype_show(struct device *dev, struct device_attribute *attr, |
129 | char *buf) | ||
123 | { | 130 | { |
124 | struct Scsi_Host *shost = class_to_shost(cdev); | 131 | struct Scsi_Host *shost = class_to_shost(dev); |
125 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 132 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
126 | struct lpfc_hba *phba = vport->phba; | 133 | struct lpfc_hba *phba = vport->phba; |
127 | 134 | ||
@@ -129,9 +136,10 @@ lpfc_programtype_show(struct class_device *cdev, char *buf) | |||
129 | } | 136 | } |
130 | 137 | ||
131 | static ssize_t | 138 | static ssize_t |
132 | lpfc_vportnum_show(struct class_device *cdev, char *buf) | 139 | lpfc_vportnum_show(struct device *dev, struct device_attribute *attr, |
140 | char *buf) | ||
133 | { | 141 | { |
134 | struct Scsi_Host *shost = class_to_shost(cdev); | 142 | struct Scsi_Host *shost = class_to_shost(dev); |
135 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 143 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
136 | struct lpfc_hba *phba = vport->phba; | 144 | struct lpfc_hba *phba = vport->phba; |
137 | 145 | ||
@@ -139,9 +147,10 @@ lpfc_vportnum_show(struct class_device *cdev, char *buf) | |||
139 | } | 147 | } |
140 | 148 | ||
141 | static ssize_t | 149 | static ssize_t |
142 | lpfc_fwrev_show(struct class_device *cdev, char *buf) | 150 | lpfc_fwrev_show(struct device *dev, struct device_attribute *attr, |
151 | char *buf) | ||
143 | { | 152 | { |
144 | struct Scsi_Host *shost = class_to_shost(cdev); | 153 | struct Scsi_Host *shost = class_to_shost(dev); |
145 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 154 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
146 | struct lpfc_hba *phba = vport->phba; | 155 | struct lpfc_hba *phba = vport->phba; |
147 | char fwrev[32]; | 156 | char fwrev[32]; |
@@ -151,10 +160,10 @@ lpfc_fwrev_show(struct class_device *cdev, char *buf) | |||
151 | } | 160 | } |
152 | 161 | ||
153 | static ssize_t | 162 | static ssize_t |
154 | lpfc_hdw_show(struct class_device *cdev, char *buf) | 163 | lpfc_hdw_show(struct device *dev, struct device_attribute *attr, char *buf) |
155 | { | 164 | { |
156 | char hdw[9]; | 165 | char hdw[9]; |
157 | struct Scsi_Host *shost = class_to_shost(cdev); | 166 | struct Scsi_Host *shost = class_to_shost(dev); |
158 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 167 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
159 | struct lpfc_hba *phba = vport->phba; | 168 | struct lpfc_hba *phba = vport->phba; |
160 | lpfc_vpd_t *vp = &phba->vpd; | 169 | lpfc_vpd_t *vp = &phba->vpd; |
@@ -163,18 +172,20 @@ lpfc_hdw_show(struct class_device *cdev, char *buf) | |||
163 | return snprintf(buf, PAGE_SIZE, "%s\n", hdw); | 172 | return snprintf(buf, PAGE_SIZE, "%s\n", hdw); |
164 | } | 173 | } |
165 | static ssize_t | 174 | static ssize_t |
166 | lpfc_option_rom_version_show(struct class_device *cdev, char *buf) | 175 | lpfc_option_rom_version_show(struct device *dev, struct device_attribute *attr, |
176 | char *buf) | ||
167 | { | 177 | { |
168 | struct Scsi_Host *shost = class_to_shost(cdev); | 178 | struct Scsi_Host *shost = class_to_shost(dev); |
169 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 179 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
170 | struct lpfc_hba *phba = vport->phba; | 180 | struct lpfc_hba *phba = vport->phba; |
171 | 181 | ||
172 | return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); | 182 | return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); |
173 | } | 183 | } |
174 | static ssize_t | 184 | static ssize_t |
175 | lpfc_state_show(struct class_device *cdev, char *buf) | 185 | lpfc_state_show(struct device *dev, struct device_attribute *attr, |
186 | char *buf) | ||
176 | { | 187 | { |
177 | struct Scsi_Host *shost = class_to_shost(cdev); | 188 | struct Scsi_Host *shost = class_to_shost(dev); |
178 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 189 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
179 | struct lpfc_hba *phba = vport->phba; | 190 | struct lpfc_hba *phba = vport->phba; |
180 | int len = 0; | 191 | int len = 0; |
@@ -243,9 +254,10 @@ lpfc_state_show(struct class_device *cdev, char *buf) | |||
243 | } | 254 | } |
244 | 255 | ||
245 | static ssize_t | 256 | static ssize_t |
246 | lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) | 257 | lpfc_num_discovered_ports_show(struct device *dev, |
258 | struct device_attribute *attr, char *buf) | ||
247 | { | 259 | { |
248 | struct Scsi_Host *shost = class_to_shost(cdev); | 260 | struct Scsi_Host *shost = class_to_shost(dev); |
249 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 261 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
250 | 262 | ||
251 | return snprintf(buf, PAGE_SIZE, "%d\n", | 263 | return snprintf(buf, PAGE_SIZE, "%d\n", |
@@ -367,9 +379,10 @@ lpfc_selective_reset(struct lpfc_hba *phba) | |||
367 | } | 379 | } |
368 | 380 | ||
369 | static ssize_t | 381 | static ssize_t |
370 | lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count) | 382 | lpfc_issue_reset(struct device *dev, struct device_attribute *attr, |
383 | const char *buf, size_t count) | ||
371 | { | 384 | { |
372 | struct Scsi_Host *shost = class_to_shost(cdev); | 385 | struct Scsi_Host *shost = class_to_shost(dev); |
373 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 386 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
374 | struct lpfc_hba *phba = vport->phba; | 387 | struct lpfc_hba *phba = vport->phba; |
375 | 388 | ||
@@ -385,9 +398,10 @@ lpfc_issue_reset(struct class_device *cdev, const char *buf, size_t count) | |||
385 | } | 398 | } |
386 | 399 | ||
387 | static ssize_t | 400 | static ssize_t |
388 | lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) | 401 | lpfc_nport_evt_cnt_show(struct device *dev, struct device_attribute *attr, |
402 | char *buf) | ||
389 | { | 403 | { |
390 | struct Scsi_Host *shost = class_to_shost(cdev); | 404 | struct Scsi_Host *shost = class_to_shost(dev); |
391 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 405 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
392 | struct lpfc_hba *phba = vport->phba; | 406 | struct lpfc_hba *phba = vport->phba; |
393 | 407 | ||
@@ -395,9 +409,10 @@ lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) | |||
395 | } | 409 | } |
396 | 410 | ||
397 | static ssize_t | 411 | static ssize_t |
398 | lpfc_board_mode_show(struct class_device *cdev, char *buf) | 412 | lpfc_board_mode_show(struct device *dev, struct device_attribute *attr, |
413 | char *buf) | ||
399 | { | 414 | { |
400 | struct Scsi_Host *shost = class_to_shost(cdev); | 415 | struct Scsi_Host *shost = class_to_shost(dev); |
401 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 416 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
402 | struct lpfc_hba *phba = vport->phba; | 417 | struct lpfc_hba *phba = vport->phba; |
403 | char * state; | 418 | char * state; |
@@ -415,9 +430,10 @@ lpfc_board_mode_show(struct class_device *cdev, char *buf) | |||
415 | } | 430 | } |
416 | 431 | ||
417 | static ssize_t | 432 | static ssize_t |
418 | lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) | 433 | lpfc_board_mode_store(struct device *dev, struct device_attribute *attr, |
434 | const char *buf, size_t count) | ||
419 | { | 435 | { |
420 | struct Scsi_Host *shost = class_to_shost(cdev); | 436 | struct Scsi_Host *shost = class_to_shost(dev); |
421 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 437 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
422 | struct lpfc_hba *phba = vport->phba; | 438 | struct lpfc_hba *phba = vport->phba; |
423 | struct completion online_compl; | 439 | struct completion online_compl; |
@@ -509,9 +525,10 @@ lpfc_get_hba_info(struct lpfc_hba *phba, | |||
509 | } | 525 | } |
510 | 526 | ||
511 | static ssize_t | 527 | static ssize_t |
512 | lpfc_max_rpi_show(struct class_device *cdev, char *buf) | 528 | lpfc_max_rpi_show(struct device *dev, struct device_attribute *attr, |
529 | char *buf) | ||
513 | { | 530 | { |
514 | struct Scsi_Host *shost = class_to_shost(cdev); | 531 | struct Scsi_Host *shost = class_to_shost(dev); |
515 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 532 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
516 | struct lpfc_hba *phba = vport->phba; | 533 | struct lpfc_hba *phba = vport->phba; |
517 | uint32_t cnt; | 534 | uint32_t cnt; |
@@ -522,9 +539,10 @@ lpfc_max_rpi_show(struct class_device *cdev, char *buf) | |||
522 | } | 539 | } |
523 | 540 | ||
524 | static ssize_t | 541 | static ssize_t |
525 | lpfc_used_rpi_show(struct class_device *cdev, char *buf) | 542 | lpfc_used_rpi_show(struct device *dev, struct device_attribute *attr, |
543 | char *buf) | ||
526 | { | 544 | { |
527 | struct Scsi_Host *shost = class_to_shost(cdev); | 545 | struct Scsi_Host *shost = class_to_shost(dev); |
528 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 546 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
529 | struct lpfc_hba *phba = vport->phba; | 547 | struct lpfc_hba *phba = vport->phba; |
530 | uint32_t cnt, acnt; | 548 | uint32_t cnt, acnt; |
@@ -535,9 +553,10 @@ lpfc_used_rpi_show(struct class_device *cdev, char *buf) | |||
535 | } | 553 | } |
536 | 554 | ||
537 | static ssize_t | 555 | static ssize_t |
538 | lpfc_max_xri_show(struct class_device *cdev, char *buf) | 556 | lpfc_max_xri_show(struct device *dev, struct device_attribute *attr, |
557 | char *buf) | ||
539 | { | 558 | { |
540 | struct Scsi_Host *shost = class_to_shost(cdev); | 559 | struct Scsi_Host *shost = class_to_shost(dev); |
541 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 560 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
542 | struct lpfc_hba *phba = vport->phba; | 561 | struct lpfc_hba *phba = vport->phba; |
543 | uint32_t cnt; | 562 | uint32_t cnt; |
@@ -548,9 +567,10 @@ lpfc_max_xri_show(struct class_device *cdev, char *buf) | |||
548 | } | 567 | } |
549 | 568 | ||
550 | static ssize_t | 569 | static ssize_t |
551 | lpfc_used_xri_show(struct class_device *cdev, char *buf) | 570 | lpfc_used_xri_show(struct device *dev, struct device_attribute *attr, |
571 | char *buf) | ||
552 | { | 572 | { |
553 | struct Scsi_Host *shost = class_to_shost(cdev); | 573 | struct Scsi_Host *shost = class_to_shost(dev); |
554 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 574 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
555 | struct lpfc_hba *phba = vport->phba; | 575 | struct lpfc_hba *phba = vport->phba; |
556 | uint32_t cnt, acnt; | 576 | uint32_t cnt, acnt; |
@@ -561,9 +581,10 @@ lpfc_used_xri_show(struct class_device *cdev, char *buf) | |||
561 | } | 581 | } |
562 | 582 | ||
563 | static ssize_t | 583 | static ssize_t |
564 | lpfc_max_vpi_show(struct class_device *cdev, char *buf) | 584 | lpfc_max_vpi_show(struct device *dev, struct device_attribute *attr, |
585 | char *buf) | ||
565 | { | 586 | { |
566 | struct Scsi_Host *shost = class_to_shost(cdev); | 587 | struct Scsi_Host *shost = class_to_shost(dev); |
567 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 588 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
568 | struct lpfc_hba *phba = vport->phba; | 589 | struct lpfc_hba *phba = vport->phba; |
569 | uint32_t cnt; | 590 | uint32_t cnt; |
@@ -574,9 +595,10 @@ lpfc_max_vpi_show(struct class_device *cdev, char *buf) | |||
574 | } | 595 | } |
575 | 596 | ||
576 | static ssize_t | 597 | static ssize_t |
577 | lpfc_used_vpi_show(struct class_device *cdev, char *buf) | 598 | lpfc_used_vpi_show(struct device *dev, struct device_attribute *attr, |
599 | char *buf) | ||
578 | { | 600 | { |
579 | struct Scsi_Host *shost = class_to_shost(cdev); | 601 | struct Scsi_Host *shost = class_to_shost(dev); |
580 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 602 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
581 | struct lpfc_hba *phba = vport->phba; | 603 | struct lpfc_hba *phba = vport->phba; |
582 | uint32_t cnt, acnt; | 604 | uint32_t cnt, acnt; |
@@ -587,9 +609,10 @@ lpfc_used_vpi_show(struct class_device *cdev, char *buf) | |||
587 | } | 609 | } |
588 | 610 | ||
589 | static ssize_t | 611 | static ssize_t |
590 | lpfc_npiv_info_show(struct class_device *cdev, char *buf) | 612 | lpfc_npiv_info_show(struct device *dev, struct device_attribute *attr, |
613 | char *buf) | ||
591 | { | 614 | { |
592 | struct Scsi_Host *shost = class_to_shost(cdev); | 615 | struct Scsi_Host *shost = class_to_shost(dev); |
593 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 616 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
594 | struct lpfc_hba *phba = vport->phba; | 617 | struct lpfc_hba *phba = vport->phba; |
595 | 618 | ||
@@ -601,9 +624,10 @@ lpfc_npiv_info_show(struct class_device *cdev, char *buf) | |||
601 | } | 624 | } |
602 | 625 | ||
603 | static ssize_t | 626 | static ssize_t |
604 | lpfc_poll_show(struct class_device *cdev, char *buf) | 627 | lpfc_poll_show(struct device *dev, struct device_attribute *attr, |
628 | char *buf) | ||
605 | { | 629 | { |
606 | struct Scsi_Host *shost = class_to_shost(cdev); | 630 | struct Scsi_Host *shost = class_to_shost(dev); |
607 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 631 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
608 | struct lpfc_hba *phba = vport->phba; | 632 | struct lpfc_hba *phba = vport->phba; |
609 | 633 | ||
@@ -611,10 +635,10 @@ lpfc_poll_show(struct class_device *cdev, char *buf) | |||
611 | } | 635 | } |
612 | 636 | ||
613 | static ssize_t | 637 | static ssize_t |
614 | lpfc_poll_store(struct class_device *cdev, const char *buf, | 638 | lpfc_poll_store(struct device *dev, struct device_attribute *attr, |
615 | size_t count) | 639 | const char *buf, size_t count) |
616 | { | 640 | { |
617 | struct Scsi_Host *shost = class_to_shost(cdev); | 641 | struct Scsi_Host *shost = class_to_shost(dev); |
618 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 642 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
619 | struct lpfc_hba *phba = vport->phba; | 643 | struct lpfc_hba *phba = vport->phba; |
620 | uint32_t creg_val; | 644 | uint32_t creg_val; |
@@ -670,9 +694,10 @@ lpfc_poll_store(struct class_device *cdev, const char *buf, | |||
670 | 694 | ||
671 | #define lpfc_param_show(attr) \ | 695 | #define lpfc_param_show(attr) \ |
672 | static ssize_t \ | 696 | static ssize_t \ |
673 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | 697 | lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
698 | char *buf) \ | ||
674 | { \ | 699 | { \ |
675 | struct Scsi_Host *shost = class_to_shost(cdev);\ | 700 | struct Scsi_Host *shost = class_to_shost(dev);\ |
676 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | 701 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
677 | struct lpfc_hba *phba = vport->phba;\ | 702 | struct lpfc_hba *phba = vport->phba;\ |
678 | int val = 0;\ | 703 | int val = 0;\ |
@@ -683,9 +708,10 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | |||
683 | 708 | ||
684 | #define lpfc_param_hex_show(attr) \ | 709 | #define lpfc_param_hex_show(attr) \ |
685 | static ssize_t \ | 710 | static ssize_t \ |
686 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | 711 | lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
712 | char *buf) \ | ||
687 | { \ | 713 | { \ |
688 | struct Scsi_Host *shost = class_to_shost(cdev);\ | 714 | struct Scsi_Host *shost = class_to_shost(dev);\ |
689 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | 715 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
690 | struct lpfc_hba *phba = vport->phba;\ | 716 | struct lpfc_hba *phba = vport->phba;\ |
691 | int val = 0;\ | 717 | int val = 0;\ |
@@ -725,9 +751,10 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \ | |||
725 | 751 | ||
726 | #define lpfc_param_store(attr) \ | 752 | #define lpfc_param_store(attr) \ |
727 | static ssize_t \ | 753 | static ssize_t \ |
728 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | 754 | lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \ |
755 | const char *buf, size_t count) \ | ||
729 | { \ | 756 | { \ |
730 | struct Scsi_Host *shost = class_to_shost(cdev);\ | 757 | struct Scsi_Host *shost = class_to_shost(dev);\ |
731 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | 758 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
732 | struct lpfc_hba *phba = vport->phba;\ | 759 | struct lpfc_hba *phba = vport->phba;\ |
733 | int val=0;\ | 760 | int val=0;\ |
@@ -743,9 +770,10 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | |||
743 | 770 | ||
744 | #define lpfc_vport_param_show(attr) \ | 771 | #define lpfc_vport_param_show(attr) \ |
745 | static ssize_t \ | 772 | static ssize_t \ |
746 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | 773 | lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
774 | char *buf) \ | ||
747 | { \ | 775 | { \ |
748 | struct Scsi_Host *shost = class_to_shost(cdev);\ | 776 | struct Scsi_Host *shost = class_to_shost(dev);\ |
749 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | 777 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
750 | int val = 0;\ | 778 | int val = 0;\ |
751 | val = vport->cfg_##attr;\ | 779 | val = vport->cfg_##attr;\ |
@@ -754,9 +782,10 @@ lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | |||
754 | 782 | ||
755 | #define lpfc_vport_param_hex_show(attr) \ | 783 | #define lpfc_vport_param_hex_show(attr) \ |
756 | static ssize_t \ | 784 | static ssize_t \ |
757 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | 785 | lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \ |
786 | char *buf) \ | ||
758 | { \ | 787 | { \ |
759 | struct Scsi_Host *shost = class_to_shost(cdev);\ | 788 | struct Scsi_Host *shost = class_to_shost(dev);\ |
760 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | 789 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
761 | int val = 0;\ | 790 | int val = 0;\ |
762 | val = vport->cfg_##attr;\ | 791 | val = vport->cfg_##attr;\ |
@@ -794,9 +823,10 @@ lpfc_##attr##_set(struct lpfc_vport *vport, int val) \ | |||
794 | 823 | ||
795 | #define lpfc_vport_param_store(attr) \ | 824 | #define lpfc_vport_param_store(attr) \ |
796 | static ssize_t \ | 825 | static ssize_t \ |
797 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | 826 | lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \ |
827 | const char *buf, size_t count) \ | ||
798 | { \ | 828 | { \ |
799 | struct Scsi_Host *shost = class_to_shost(cdev);\ | 829 | struct Scsi_Host *shost = class_to_shost(dev);\ |
800 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ | 830 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\ |
801 | int val=0;\ | 831 | int val=0;\ |
802 | if (!isdigit(buf[0]))\ | 832 | if (!isdigit(buf[0]))\ |
@@ -822,7 +852,7 @@ module_param(lpfc_##name, int, 0);\ | |||
822 | MODULE_PARM_DESC(lpfc_##name, desc);\ | 852 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
823 | lpfc_param_show(name)\ | 853 | lpfc_param_show(name)\ |
824 | lpfc_param_init(name, defval, minval, maxval)\ | 854 | lpfc_param_init(name, defval, minval, maxval)\ |
825 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | 855 | static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) |
826 | 856 | ||
827 | #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \ | 857 | #define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \ |
828 | static int lpfc_##name = defval;\ | 858 | static int lpfc_##name = defval;\ |
@@ -832,8 +862,8 @@ lpfc_param_show(name)\ | |||
832 | lpfc_param_init(name, defval, minval, maxval)\ | 862 | lpfc_param_init(name, defval, minval, maxval)\ |
833 | lpfc_param_set(name, defval, minval, maxval)\ | 863 | lpfc_param_set(name, defval, minval, maxval)\ |
834 | lpfc_param_store(name)\ | 864 | lpfc_param_store(name)\ |
835 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 865 | static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
836 | lpfc_##name##_show, lpfc_##name##_store) | 866 | lpfc_##name##_show, lpfc_##name##_store) |
837 | 867 | ||
838 | #define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \ | 868 | #define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \ |
839 | static int lpfc_##name = defval;\ | 869 | static int lpfc_##name = defval;\ |
@@ -841,7 +871,7 @@ module_param(lpfc_##name, int, 0);\ | |||
841 | MODULE_PARM_DESC(lpfc_##name, desc);\ | 871 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
842 | lpfc_param_hex_show(name)\ | 872 | lpfc_param_hex_show(name)\ |
843 | lpfc_param_init(name, defval, minval, maxval)\ | 873 | lpfc_param_init(name, defval, minval, maxval)\ |
844 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | 874 | static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) |
845 | 875 | ||
846 | #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ | 876 | #define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ |
847 | static int lpfc_##name = defval;\ | 877 | static int lpfc_##name = defval;\ |
@@ -851,8 +881,8 @@ lpfc_param_hex_show(name)\ | |||
851 | lpfc_param_init(name, defval, minval, maxval)\ | 881 | lpfc_param_init(name, defval, minval, maxval)\ |
852 | lpfc_param_set(name, defval, minval, maxval)\ | 882 | lpfc_param_set(name, defval, minval, maxval)\ |
853 | lpfc_param_store(name)\ | 883 | lpfc_param_store(name)\ |
854 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 884 | static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
855 | lpfc_##name##_show, lpfc_##name##_store) | 885 | lpfc_##name##_show, lpfc_##name##_store) |
856 | 886 | ||
857 | #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ | 887 | #define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \ |
858 | static int lpfc_##name = defval;\ | 888 | static int lpfc_##name = defval;\ |
@@ -866,7 +896,7 @@ module_param(lpfc_##name, int, 0);\ | |||
866 | MODULE_PARM_DESC(lpfc_##name, desc);\ | 896 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
867 | lpfc_vport_param_show(name)\ | 897 | lpfc_vport_param_show(name)\ |
868 | lpfc_vport_param_init(name, defval, minval, maxval)\ | 898 | lpfc_vport_param_init(name, defval, minval, maxval)\ |
869 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | 899 | static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) |
870 | 900 | ||
871 | #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ | 901 | #define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \ |
872 | static int lpfc_##name = defval;\ | 902 | static int lpfc_##name = defval;\ |
@@ -876,8 +906,8 @@ lpfc_vport_param_show(name)\ | |||
876 | lpfc_vport_param_init(name, defval, minval, maxval)\ | 906 | lpfc_vport_param_init(name, defval, minval, maxval)\ |
877 | lpfc_vport_param_set(name, defval, minval, maxval)\ | 907 | lpfc_vport_param_set(name, defval, minval, maxval)\ |
878 | lpfc_vport_param_store(name)\ | 908 | lpfc_vport_param_store(name)\ |
879 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 909 | static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
880 | lpfc_##name##_show, lpfc_##name##_store) | 910 | lpfc_##name##_show, lpfc_##name##_store) |
881 | 911 | ||
882 | #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ | 912 | #define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \ |
883 | static int lpfc_##name = defval;\ | 913 | static int lpfc_##name = defval;\ |
@@ -885,7 +915,7 @@ module_param(lpfc_##name, int, 0);\ | |||
885 | MODULE_PARM_DESC(lpfc_##name, desc);\ | 915 | MODULE_PARM_DESC(lpfc_##name, desc);\ |
886 | lpfc_vport_param_hex_show(name)\ | 916 | lpfc_vport_param_hex_show(name)\ |
887 | lpfc_vport_param_init(name, defval, minval, maxval)\ | 917 | lpfc_vport_param_init(name, defval, minval, maxval)\ |
888 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) | 918 | static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL) |
889 | 919 | ||
890 | #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ | 920 | #define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \ |
891 | static int lpfc_##name = defval;\ | 921 | static int lpfc_##name = defval;\ |
@@ -895,46 +925,44 @@ lpfc_vport_param_hex_show(name)\ | |||
895 | lpfc_vport_param_init(name, defval, minval, maxval)\ | 925 | lpfc_vport_param_init(name, defval, minval, maxval)\ |
896 | lpfc_vport_param_set(name, defval, minval, maxval)\ | 926 | lpfc_vport_param_set(name, defval, minval, maxval)\ |
897 | lpfc_vport_param_store(name)\ | 927 | lpfc_vport_param_store(name)\ |
898 | static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 928 | static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
899 | lpfc_##name##_show, lpfc_##name##_store) | 929 | lpfc_##name##_show, lpfc_##name##_store) |
900 | 930 | ||
901 | static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); | 931 | static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); |
902 | static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); | 932 | static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); |
903 | static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); | 933 | static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); |
904 | static CLASS_DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL); | 934 | static DEVICE_ATTR(modelname, S_IRUGO, lpfc_modelname_show, NULL); |
905 | static CLASS_DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL); | 935 | static DEVICE_ATTR(programtype, S_IRUGO, lpfc_programtype_show, NULL); |
906 | static CLASS_DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL); | 936 | static DEVICE_ATTR(portnum, S_IRUGO, lpfc_vportnum_show, NULL); |
907 | static CLASS_DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL); | 937 | static DEVICE_ATTR(fwrev, S_IRUGO, lpfc_fwrev_show, NULL); |
908 | static CLASS_DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL); | 938 | static DEVICE_ATTR(hdw, S_IRUGO, lpfc_hdw_show, NULL); |
909 | static CLASS_DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL); | 939 | static DEVICE_ATTR(state, S_IRUGO, lpfc_state_show, NULL); |
910 | static CLASS_DEVICE_ATTR(option_rom_version, S_IRUGO, | 940 | static DEVICE_ATTR(option_rom_version, S_IRUGO, |
911 | lpfc_option_rom_version_show, NULL); | 941 | lpfc_option_rom_version_show, NULL); |
912 | static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO, | 942 | static DEVICE_ATTR(num_discovered_ports, S_IRUGO, |
913 | lpfc_num_discovered_ports_show, NULL); | 943 | lpfc_num_discovered_ports_show, NULL); |
914 | static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); | 944 | static DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); |
915 | static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, | 945 | static DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, NULL); |
916 | NULL); | 946 | static DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, |
917 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, | 947 | lpfc_board_mode_show, lpfc_board_mode_store); |
918 | lpfc_board_mode_show, lpfc_board_mode_store); | 948 | static DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); |
919 | static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); | 949 | static DEVICE_ATTR(max_vpi, S_IRUGO, lpfc_max_vpi_show, NULL); |
920 | static CLASS_DEVICE_ATTR(max_vpi, S_IRUGO, lpfc_max_vpi_show, NULL); | 950 | static DEVICE_ATTR(used_vpi, S_IRUGO, lpfc_used_vpi_show, NULL); |
921 | static CLASS_DEVICE_ATTR(used_vpi, S_IRUGO, lpfc_used_vpi_show, NULL); | 951 | static DEVICE_ATTR(max_rpi, S_IRUGO, lpfc_max_rpi_show, NULL); |
922 | static CLASS_DEVICE_ATTR(max_rpi, S_IRUGO, lpfc_max_rpi_show, NULL); | 952 | static DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL); |
923 | static CLASS_DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL); | 953 | static DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); |
924 | static CLASS_DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); | 954 | static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); |
925 | static CLASS_DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); | 955 | static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); |
926 | static CLASS_DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); | 956 | static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL); |
927 | static CLASS_DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, | ||
928 | NULL); | ||
929 | 957 | ||
930 | 958 | ||
931 | static char *lpfc_soft_wwn_key = "C99G71SL8032A"; | 959 | static char *lpfc_soft_wwn_key = "C99G71SL8032A"; |
932 | 960 | ||
933 | static ssize_t | 961 | static ssize_t |
934 | lpfc_soft_wwn_enable_store(struct class_device *cdev, const char *buf, | 962 | lpfc_soft_wwn_enable_store(struct device *dev, struct device_attribute *attr, |
935 | size_t count) | 963 | const char *buf, size_t count) |
936 | { | 964 | { |
937 | struct Scsi_Host *shost = class_to_shost(cdev); | 965 | struct Scsi_Host *shost = class_to_shost(dev); |
938 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 966 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
939 | struct lpfc_hba *phba = vport->phba; | 967 | struct lpfc_hba *phba = vport->phba; |
940 | unsigned int cnt = count; | 968 | unsigned int cnt = count; |
@@ -963,13 +991,14 @@ lpfc_soft_wwn_enable_store(struct class_device *cdev, const char *buf, | |||
963 | phba->soft_wwn_enable = 1; | 991 | phba->soft_wwn_enable = 1; |
964 | return count; | 992 | return count; |
965 | } | 993 | } |
966 | static CLASS_DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL, | 994 | static DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL, |
967 | lpfc_soft_wwn_enable_store); | 995 | lpfc_soft_wwn_enable_store); |
968 | 996 | ||
969 | static ssize_t | 997 | static ssize_t |
970 | lpfc_soft_wwpn_show(struct class_device *cdev, char *buf) | 998 | lpfc_soft_wwpn_show(struct device *dev, struct device_attribute *attr, |
999 | char *buf) | ||
971 | { | 1000 | { |
972 | struct Scsi_Host *shost = class_to_shost(cdev); | 1001 | struct Scsi_Host *shost = class_to_shost(dev); |
973 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1002 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
974 | struct lpfc_hba *phba = vport->phba; | 1003 | struct lpfc_hba *phba = vport->phba; |
975 | 1004 | ||
@@ -979,9 +1008,10 @@ lpfc_soft_wwpn_show(struct class_device *cdev, char *buf) | |||
979 | 1008 | ||
980 | 1009 | ||
981 | static ssize_t | 1010 | static ssize_t |
982 | lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) | 1011 | lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr, |
1012 | const char *buf, size_t count) | ||
983 | { | 1013 | { |
984 | struct Scsi_Host *shost = class_to_shost(cdev); | 1014 | struct Scsi_Host *shost = class_to_shost(dev); |
985 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1015 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
986 | struct lpfc_hba *phba = vport->phba; | 1016 | struct lpfc_hba *phba = vport->phba; |
987 | struct completion online_compl; | 1017 | struct completion online_compl; |
@@ -1047,13 +1077,14 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count) | |||
1047 | "reinit adapter - %d\n", stat2); | 1077 | "reinit adapter - %d\n", stat2); |
1048 | return (stat1 || stat2) ? -EIO : count; | 1078 | return (stat1 || stat2) ? -EIO : count; |
1049 | } | 1079 | } |
1050 | static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ | 1080 | static DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ |
1051 | lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); | 1081 | lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); |
1052 | 1082 | ||
1053 | static ssize_t | 1083 | static ssize_t |
1054 | lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) | 1084 | lpfc_soft_wwnn_show(struct device *dev, struct device_attribute *attr, |
1085 | char *buf) | ||
1055 | { | 1086 | { |
1056 | struct Scsi_Host *shost = class_to_shost(cdev); | 1087 | struct Scsi_Host *shost = class_to_shost(dev); |
1057 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; | 1088 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1058 | return snprintf(buf, PAGE_SIZE, "0x%llx\n", | 1089 | return snprintf(buf, PAGE_SIZE, "0x%llx\n", |
1059 | (unsigned long long)phba->cfg_soft_wwnn); | 1090 | (unsigned long long)phba->cfg_soft_wwnn); |
@@ -1061,9 +1092,10 @@ lpfc_soft_wwnn_show(struct class_device *cdev, char *buf) | |||
1061 | 1092 | ||
1062 | 1093 | ||
1063 | static ssize_t | 1094 | static ssize_t |
1064 | lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) | 1095 | lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr, |
1096 | const char *buf, size_t count) | ||
1065 | { | 1097 | { |
1066 | struct Scsi_Host *shost = class_to_shost(cdev); | 1098 | struct Scsi_Host *shost = class_to_shost(dev); |
1067 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; | 1099 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
1068 | unsigned int i, j, cnt=count; | 1100 | unsigned int i, j, cnt=count; |
1069 | u8 wwnn[8]; | 1101 | u8 wwnn[8]; |
@@ -1107,8 +1139,8 @@ lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count) | |||
1107 | 1139 | ||
1108 | return count; | 1140 | return count; |
1109 | } | 1141 | } |
1110 | static CLASS_DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\ | 1142 | static DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\ |
1111 | lpfc_soft_wwnn_show, lpfc_soft_wwnn_store); | 1143 | lpfc_soft_wwnn_show, lpfc_soft_wwnn_store); |
1112 | 1144 | ||
1113 | 1145 | ||
1114 | static int lpfc_poll = 0; | 1146 | static int lpfc_poll = 0; |
@@ -1118,8 +1150,8 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:" | |||
1118 | " 1 - poll with interrupts enabled" | 1150 | " 1 - poll with interrupts enabled" |
1119 | " 3 - poll and disable FCP ring interrupts"); | 1151 | " 3 - poll and disable FCP ring interrupts"); |
1120 | 1152 | ||
1121 | static CLASS_DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, | 1153 | static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, |
1122 | lpfc_poll_show, lpfc_poll_store); | 1154 | lpfc_poll_show, lpfc_poll_store); |
1123 | 1155 | ||
1124 | int lpfc_sli_mode = 0; | 1156 | int lpfc_sli_mode = 0; |
1125 | module_param(lpfc_sli_mode, int, 0); | 1157 | module_param(lpfc_sli_mode, int, 0); |
@@ -1133,7 +1165,7 @@ module_param(lpfc_enable_npiv, int, 0); | |||
1133 | MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality"); | 1165 | MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality"); |
1134 | lpfc_param_show(enable_npiv); | 1166 | lpfc_param_show(enable_npiv); |
1135 | lpfc_param_init(enable_npiv, 0, 0, 1); | 1167 | lpfc_param_init(enable_npiv, 0, 0, 1); |
1136 | static CLASS_DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, | 1168 | static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, |
1137 | lpfc_enable_npiv_show, NULL); | 1169 | lpfc_enable_npiv_show, NULL); |
1138 | 1170 | ||
1139 | /* | 1171 | /* |
@@ -1147,9 +1179,10 @@ MODULE_PARM_DESC(lpfc_nodev_tmo, | |||
1147 | "Seconds driver will hold I/O waiting " | 1179 | "Seconds driver will hold I/O waiting " |
1148 | "for a device to come back"); | 1180 | "for a device to come back"); |
1149 | static ssize_t | 1181 | static ssize_t |
1150 | lpfc_nodev_tmo_show(struct class_device *cdev, char *buf) | 1182 | lpfc_nodev_tmo_show(struct device *dev, struct device_attribute *attr, |
1183 | char *buf) | ||
1151 | { | 1184 | { |
1152 | struct Scsi_Host *shost = class_to_shost(cdev); | 1185 | struct Scsi_Host *shost = class_to_shost(dev); |
1153 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1186 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1154 | int val = 0; | 1187 | int val = 0; |
1155 | val = vport->cfg_devloss_tmo; | 1188 | val = vport->cfg_devloss_tmo; |
@@ -1221,8 +1254,8 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val) | |||
1221 | 1254 | ||
1222 | lpfc_vport_param_store(nodev_tmo) | 1255 | lpfc_vport_param_store(nodev_tmo) |
1223 | 1256 | ||
1224 | static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, | 1257 | static DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, |
1225 | lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); | 1258 | lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); |
1226 | 1259 | ||
1227 | /* | 1260 | /* |
1228 | # lpfc_devloss_tmo: If set, it will hold all I/O errors on devices that | 1261 | # lpfc_devloss_tmo: If set, it will hold all I/O errors on devices that |
@@ -1255,8 +1288,8 @@ lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val) | |||
1255 | } | 1288 | } |
1256 | 1289 | ||
1257 | lpfc_vport_param_store(devloss_tmo) | 1290 | lpfc_vport_param_store(devloss_tmo) |
1258 | static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, | 1291 | static DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, |
1259 | lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); | 1292 | lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); |
1260 | 1293 | ||
1261 | /* | 1294 | /* |
1262 | # lpfc_log_verbose: Only turn this flag on if you are willing to risk being | 1295 | # lpfc_log_verbose: Only turn this flag on if you are willing to risk being |
@@ -1374,8 +1407,8 @@ lpfc_restrict_login_set(struct lpfc_vport *vport, int val) | |||
1374 | return 0; | 1407 | return 0; |
1375 | } | 1408 | } |
1376 | lpfc_vport_param_store(restrict_login); | 1409 | lpfc_vport_param_store(restrict_login); |
1377 | static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, | 1410 | static DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, |
1378 | lpfc_restrict_login_show, lpfc_restrict_login_store); | 1411 | lpfc_restrict_login_show, lpfc_restrict_login_store); |
1379 | 1412 | ||
1380 | /* | 1413 | /* |
1381 | # Some disk devices have a "select ID" or "select Target" capability. | 1414 | # Some disk devices have a "select ID" or "select Target" capability. |
@@ -1433,7 +1466,7 @@ MODULE_PARM_DESC(lpfc_topology, "Select Fibre Channel topology"); | |||
1433 | lpfc_param_show(topology) | 1466 | lpfc_param_show(topology) |
1434 | lpfc_param_init(topology, 0, 0, 6) | 1467 | lpfc_param_init(topology, 0, 0, 6) |
1435 | lpfc_param_store(topology) | 1468 | lpfc_param_store(topology) |
1436 | static CLASS_DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, | 1469 | static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, |
1437 | lpfc_topology_show, lpfc_topology_store); | 1470 | lpfc_topology_show, lpfc_topology_store); |
1438 | 1471 | ||
1439 | /* | 1472 | /* |
@@ -1497,7 +1530,7 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val) | |||
1497 | } | 1530 | } |
1498 | 1531 | ||
1499 | lpfc_param_store(link_speed) | 1532 | lpfc_param_store(link_speed) |
1500 | static CLASS_DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, | 1533 | static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, |
1501 | lpfc_link_speed_show, lpfc_link_speed_store); | 1534 | lpfc_link_speed_show, lpfc_link_speed_store); |
1502 | 1535 | ||
1503 | /* | 1536 | /* |
@@ -1623,82 +1656,81 @@ LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); | |||
1623 | LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, | 1656 | LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, |
1624 | LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); | 1657 | LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); |
1625 | 1658 | ||
1626 | struct class_device_attribute *lpfc_hba_attrs[] = { | 1659 | struct device_attribute *lpfc_hba_attrs[] = { |
1627 | &class_device_attr_info, | 1660 | &dev_attr_info, |
1628 | &class_device_attr_serialnum, | 1661 | &dev_attr_serialnum, |
1629 | &class_device_attr_modeldesc, | 1662 | &dev_attr_modeldesc, |
1630 | &class_device_attr_modelname, | 1663 | &dev_attr_modelname, |
1631 | &class_device_attr_programtype, | 1664 | &dev_attr_programtype, |
1632 | &class_device_attr_portnum, | 1665 | &dev_attr_portnum, |
1633 | &class_device_attr_fwrev, | 1666 | &dev_attr_fwrev, |
1634 | &class_device_attr_hdw, | 1667 | &dev_attr_hdw, |
1635 | &class_device_attr_option_rom_version, | 1668 | &dev_attr_option_rom_version, |
1636 | &class_device_attr_state, | 1669 | &dev_attr_state, |
1637 | &class_device_attr_num_discovered_ports, | 1670 | &dev_attr_num_discovered_ports, |
1638 | &class_device_attr_lpfc_drvr_version, | 1671 | &dev_attr_lpfc_drvr_version, |
1639 | &class_device_attr_lpfc_temp_sensor, | 1672 | &dev_attr_lpfc_temp_sensor, |
1640 | &class_device_attr_lpfc_log_verbose, | 1673 | &dev_attr_lpfc_log_verbose, |
1641 | &class_device_attr_lpfc_lun_queue_depth, | 1674 | &dev_attr_lpfc_lun_queue_depth, |
1642 | &class_device_attr_lpfc_hba_queue_depth, | 1675 | &dev_attr_lpfc_hba_queue_depth, |
1643 | &class_device_attr_lpfc_peer_port_login, | 1676 | &dev_attr_lpfc_peer_port_login, |
1644 | &class_device_attr_lpfc_nodev_tmo, | 1677 | &dev_attr_lpfc_nodev_tmo, |
1645 | &class_device_attr_lpfc_devloss_tmo, | 1678 | &dev_attr_lpfc_devloss_tmo, |
1646 | &class_device_attr_lpfc_fcp_class, | 1679 | &dev_attr_lpfc_fcp_class, |
1647 | &class_device_attr_lpfc_use_adisc, | 1680 | &dev_attr_lpfc_use_adisc, |
1648 | &class_device_attr_lpfc_ack0, | 1681 | &dev_attr_lpfc_ack0, |
1649 | &class_device_attr_lpfc_topology, | 1682 | &dev_attr_lpfc_topology, |
1650 | &class_device_attr_lpfc_scan_down, | 1683 | &dev_attr_lpfc_scan_down, |
1651 | &class_device_attr_lpfc_link_speed, | 1684 | &dev_attr_lpfc_link_speed, |
1652 | &class_device_attr_lpfc_cr_delay, | 1685 | &dev_attr_lpfc_cr_delay, |
1653 | &class_device_attr_lpfc_cr_count, | 1686 | &dev_attr_lpfc_cr_count, |
1654 | &class_device_attr_lpfc_multi_ring_support, | 1687 | &dev_attr_lpfc_multi_ring_support, |
1655 | &class_device_attr_lpfc_multi_ring_rctl, | 1688 | &dev_attr_lpfc_multi_ring_rctl, |
1656 | &class_device_attr_lpfc_multi_ring_type, | 1689 | &dev_attr_lpfc_multi_ring_type, |
1657 | &class_device_attr_lpfc_fdmi_on, | 1690 | &dev_attr_lpfc_fdmi_on, |
1658 | &class_device_attr_lpfc_max_luns, | 1691 | &dev_attr_lpfc_max_luns, |
1659 | &class_device_attr_lpfc_enable_npiv, | 1692 | &dev_attr_lpfc_enable_npiv, |
1660 | &class_device_attr_nport_evt_cnt, | 1693 | &dev_attr_nport_evt_cnt, |
1661 | &class_device_attr_board_mode, | 1694 | &dev_attr_board_mode, |
1662 | &class_device_attr_max_vpi, | 1695 | &dev_attr_max_vpi, |
1663 | &class_device_attr_used_vpi, | 1696 | &dev_attr_used_vpi, |
1664 | &class_device_attr_max_rpi, | 1697 | &dev_attr_max_rpi, |
1665 | &class_device_attr_used_rpi, | 1698 | &dev_attr_used_rpi, |
1666 | &class_device_attr_max_xri, | 1699 | &dev_attr_max_xri, |
1667 | &class_device_attr_used_xri, | 1700 | &dev_attr_used_xri, |
1668 | &class_device_attr_npiv_info, | 1701 | &dev_attr_npiv_info, |
1669 | &class_device_attr_issue_reset, | 1702 | &dev_attr_issue_reset, |
1670 | &class_device_attr_lpfc_poll, | 1703 | &dev_attr_lpfc_poll, |
1671 | &class_device_attr_lpfc_poll_tmo, | 1704 | &dev_attr_lpfc_poll_tmo, |
1672 | &class_device_attr_lpfc_use_msi, | 1705 | &dev_attr_lpfc_use_msi, |
1673 | &class_device_attr_lpfc_soft_wwnn, | 1706 | &dev_attr_lpfc_soft_wwnn, |
1674 | &class_device_attr_lpfc_soft_wwpn, | 1707 | &dev_attr_lpfc_soft_wwpn, |
1675 | &class_device_attr_lpfc_soft_wwn_enable, | 1708 | &dev_attr_lpfc_soft_wwn_enable, |
1676 | &class_device_attr_lpfc_enable_hba_reset, | 1709 | &dev_attr_lpfc_enable_hba_reset, |
1677 | &class_device_attr_lpfc_enable_hba_heartbeat, | 1710 | &dev_attr_lpfc_enable_hba_heartbeat, |
1678 | &class_device_attr_lpfc_sg_seg_cnt, | 1711 | &dev_attr_lpfc_sg_seg_cnt, |
1679 | NULL, | 1712 | NULL, |
1680 | }; | 1713 | }; |
1681 | 1714 | ||
1682 | struct class_device_attribute *lpfc_vport_attrs[] = { | 1715 | struct device_attribute *lpfc_vport_attrs[] = { |
1683 | &class_device_attr_info, | 1716 | &dev_attr_info, |
1684 | &class_device_attr_state, | 1717 | &dev_attr_state, |
1685 | &class_device_attr_num_discovered_ports, | 1718 | &dev_attr_num_discovered_ports, |
1686 | &class_device_attr_lpfc_drvr_version, | 1719 | &dev_attr_lpfc_drvr_version, |
1687 | 1720 | &dev_attr_lpfc_log_verbose, | |
1688 | &class_device_attr_lpfc_log_verbose, | 1721 | &dev_attr_lpfc_lun_queue_depth, |
1689 | &class_device_attr_lpfc_lun_queue_depth, | 1722 | &dev_attr_lpfc_nodev_tmo, |
1690 | &class_device_attr_lpfc_nodev_tmo, | 1723 | &dev_attr_lpfc_devloss_tmo, |
1691 | &class_device_attr_lpfc_devloss_tmo, | 1724 | &dev_attr_lpfc_hba_queue_depth, |
1692 | &class_device_attr_lpfc_hba_queue_depth, | 1725 | &dev_attr_lpfc_peer_port_login, |
1693 | &class_device_attr_lpfc_peer_port_login, | 1726 | &dev_attr_lpfc_restrict_login, |
1694 | &class_device_attr_lpfc_restrict_login, | 1727 | &dev_attr_lpfc_fcp_class, |
1695 | &class_device_attr_lpfc_fcp_class, | 1728 | &dev_attr_lpfc_use_adisc, |
1696 | &class_device_attr_lpfc_use_adisc, | 1729 | &dev_attr_lpfc_fdmi_on, |
1697 | &class_device_attr_lpfc_fdmi_on, | 1730 | &dev_attr_lpfc_max_luns, |
1698 | &class_device_attr_lpfc_max_luns, | 1731 | &dev_attr_nport_evt_cnt, |
1699 | &class_device_attr_nport_evt_cnt, | 1732 | &dev_attr_npiv_info, |
1700 | &class_device_attr_npiv_info, | 1733 | &dev_attr_lpfc_enable_da_id, |
1701 | &class_device_attr_lpfc_enable_da_id, | ||
1702 | NULL, | 1734 | NULL, |
1703 | }; | 1735 | }; |
1704 | 1736 | ||
@@ -1707,9 +1739,8 @@ sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
1707 | char *buf, loff_t off, size_t count) | 1739 | char *buf, loff_t off, size_t count) |
1708 | { | 1740 | { |
1709 | size_t buf_off; | 1741 | size_t buf_off; |
1710 | struct class_device *cdev = container_of(kobj, struct class_device, | 1742 | struct device *dev = container_of(kobj, struct device, kobj); |
1711 | kobj); | 1743 | struct Scsi_Host *shost = class_to_shost(dev); |
1712 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
1713 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1744 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1714 | struct lpfc_hba *phba = vport->phba; | 1745 | struct lpfc_hba *phba = vport->phba; |
1715 | 1746 | ||
@@ -1741,9 +1772,8 @@ sysfs_ctlreg_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
1741 | { | 1772 | { |
1742 | size_t buf_off; | 1773 | size_t buf_off; |
1743 | uint32_t * tmp_ptr; | 1774 | uint32_t * tmp_ptr; |
1744 | struct class_device *cdev = container_of(kobj, struct class_device, | 1775 | struct device *dev = container_of(kobj, struct device, kobj); |
1745 | kobj); | 1776 | struct Scsi_Host *shost = class_to_shost(dev); |
1746 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
1747 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1777 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1748 | struct lpfc_hba *phba = vport->phba; | 1778 | struct lpfc_hba *phba = vport->phba; |
1749 | 1779 | ||
@@ -1798,9 +1828,8 @@ static ssize_t | |||
1798 | sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, | 1828 | sysfs_mbox_write(struct kobject *kobj, struct bin_attribute *bin_attr, |
1799 | char *buf, loff_t off, size_t count) | 1829 | char *buf, loff_t off, size_t count) |
1800 | { | 1830 | { |
1801 | struct class_device *cdev = container_of(kobj, struct class_device, | 1831 | struct device *dev = container_of(kobj, struct device, kobj); |
1802 | kobj); | 1832 | struct Scsi_Host *shost = class_to_shost(dev); |
1803 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
1804 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1833 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1805 | struct lpfc_hba *phba = vport->phba; | 1834 | struct lpfc_hba *phba = vport->phba; |
1806 | struct lpfcMboxq *mbox = NULL; | 1835 | struct lpfcMboxq *mbox = NULL; |
@@ -1853,9 +1882,8 @@ static ssize_t | |||
1853 | sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, | 1882 | sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr, |
1854 | char *buf, loff_t off, size_t count) | 1883 | char *buf, loff_t off, size_t count) |
1855 | { | 1884 | { |
1856 | struct class_device *cdev = container_of(kobj, struct class_device, | 1885 | struct device *dev = container_of(kobj, struct device, kobj); |
1857 | kobj); | 1886 | struct Scsi_Host *shost = class_to_shost(dev); |
1858 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
1859 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 1887 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
1860 | struct lpfc_hba *phba = vport->phba; | 1888 | struct lpfc_hba *phba = vport->phba; |
1861 | int rc; | 1889 | int rc; |
@@ -2038,19 +2066,19 @@ lpfc_alloc_sysfs_attr(struct lpfc_vport *vport) | |||
2038 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 2066 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
2039 | int error; | 2067 | int error; |
2040 | 2068 | ||
2041 | error = sysfs_create_bin_file(&shost->shost_classdev.kobj, | 2069 | error = sysfs_create_bin_file(&shost->shost_dev.kobj, |
2042 | &sysfs_ctlreg_attr); | 2070 | &sysfs_ctlreg_attr); |
2043 | if (error) | 2071 | if (error) |
2044 | goto out; | 2072 | goto out; |
2045 | 2073 | ||
2046 | error = sysfs_create_bin_file(&shost->shost_classdev.kobj, | 2074 | error = sysfs_create_bin_file(&shost->shost_dev.kobj, |
2047 | &sysfs_mbox_attr); | 2075 | &sysfs_mbox_attr); |
2048 | if (error) | 2076 | if (error) |
2049 | goto out_remove_ctlreg_attr; | 2077 | goto out_remove_ctlreg_attr; |
2050 | 2078 | ||
2051 | return 0; | 2079 | return 0; |
2052 | out_remove_ctlreg_attr: | 2080 | out_remove_ctlreg_attr: |
2053 | sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_ctlreg_attr); | 2081 | sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); |
2054 | out: | 2082 | out: |
2055 | return error; | 2083 | return error; |
2056 | } | 2084 | } |
@@ -2060,8 +2088,8 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport) | |||
2060 | { | 2088 | { |
2061 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 2089 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
2062 | 2090 | ||
2063 | sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_mbox_attr); | 2091 | sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); |
2064 | sysfs_remove_bin_file(&shost->shost_classdev.kobj, &sysfs_ctlreg_attr); | 2092 | sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); |
2065 | } | 2093 | } |
2066 | 2094 | ||
2067 | 2095 | ||
@@ -2443,9 +2471,11 @@ lpfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) | |||
2443 | 2471 | ||
2444 | #define lpfc_rport_show_function(field, format_string, sz, cast) \ | 2472 | #define lpfc_rport_show_function(field, format_string, sz, cast) \ |
2445 | static ssize_t \ | 2473 | static ssize_t \ |
2446 | lpfc_show_rport_##field (struct class_device *cdev, char *buf) \ | 2474 | lpfc_show_rport_##field (struct device *dev, \ |
2475 | struct device_attribute *attr, \ | ||
2476 | char *buf) \ | ||
2447 | { \ | 2477 | { \ |
2448 | struct fc_rport *rport = transport_class_to_rport(cdev); \ | 2478 | struct fc_rport *rport = transport_class_to_rport(dev); \ |
2449 | struct lpfc_rport_data *rdata = rport->hostdata; \ | 2479 | struct lpfc_rport_data *rdata = rport->hostdata; \ |
2450 | return snprintf(buf, sz, format_string, \ | 2480 | return snprintf(buf, sz, format_string, \ |
2451 | (rdata->target) ? cast rdata->target->field : 0); \ | 2481 | (rdata->target) ? cast rdata->target->field : 0); \ |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 0819f5f39de5..7c9f8317d972 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -253,8 +253,8 @@ void lpfc_get_cfgparam(struct lpfc_hba *); | |||
253 | void lpfc_get_vport_cfgparam(struct lpfc_vport *); | 253 | void lpfc_get_vport_cfgparam(struct lpfc_vport *); |
254 | int lpfc_alloc_sysfs_attr(struct lpfc_vport *); | 254 | int lpfc_alloc_sysfs_attr(struct lpfc_vport *); |
255 | void lpfc_free_sysfs_attr(struct lpfc_vport *); | 255 | void lpfc_free_sysfs_attr(struct lpfc_vport *); |
256 | extern struct class_device_attribute *lpfc_hba_attrs[]; | 256 | extern struct device_attribute *lpfc_hba_attrs[]; |
257 | extern struct class_device_attribute *lpfc_vport_attrs[]; | 257 | extern struct device_attribute *lpfc_vport_attrs[]; |
258 | extern struct scsi_host_template lpfc_template; | 258 | extern struct scsi_host_template lpfc_template; |
259 | extern struct scsi_host_template lpfc_vport_template; | 259 | extern struct scsi_host_template lpfc_vport_template; |
260 | extern struct fc_function_template lpfc_transport_functions; | 260 | extern struct fc_function_template lpfc_transport_functions; |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 9f041929aca5..820f91fb63ba 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -125,7 +125,7 @@ static irqreturn_t megaraid_isr(int, void *); | |||
125 | 125 | ||
126 | static void megaraid_mbox_dpc(unsigned long); | 126 | static void megaraid_mbox_dpc(unsigned long); |
127 | 127 | ||
128 | static ssize_t megaraid_sysfs_show_app_hndl(struct class_device *, char *); | 128 | static ssize_t megaraid_sysfs_show_app_hndl(struct device *, struct device_attribute *attr, char *); |
129 | static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *); | 129 | static ssize_t megaraid_sysfs_show_ldnum(struct device *, struct device_attribute *attr, char *); |
130 | 130 | ||
131 | static int megaraid_cmm_register(adapter_t *); | 131 | static int megaraid_cmm_register(adapter_t *); |
@@ -313,12 +313,12 @@ static struct pci_driver megaraid_pci_driver = { | |||
313 | // definitions for the device attributes for exporting logical drive number | 313 | // definitions for the device attributes for exporting logical drive number |
314 | // for a scsi address (Host, Channel, Id, Lun) | 314 | // for a scsi address (Host, Channel, Id, Lun) |
315 | 315 | ||
316 | CLASS_DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl, | 316 | DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl, |
317 | NULL); | 317 | NULL); |
318 | 318 | ||
319 | // Host template initializer for megaraid mbox sysfs device attributes | 319 | // Host template initializer for megaraid mbox sysfs device attributes |
320 | static struct class_device_attribute *megaraid_shost_attrs[] = { | 320 | static struct device_attribute *megaraid_shost_attrs[] = { |
321 | &class_device_attr_megaraid_mbox_app_hndl, | 321 | &dev_attr_megaraid_mbox_app_hndl, |
322 | NULL, | 322 | NULL, |
323 | }; | 323 | }; |
324 | 324 | ||
@@ -4063,9 +4063,10 @@ megaraid_sysfs_get_ldmap(adapter_t *adapter) | |||
4063 | * handle, since we do not interface with applications directly. | 4063 | * handle, since we do not interface with applications directly. |
4064 | */ | 4064 | */ |
4065 | static ssize_t | 4065 | static ssize_t |
4066 | megaraid_sysfs_show_app_hndl(struct class_device *cdev, char *buf) | 4066 | megaraid_sysfs_show_app_hndl(struct device *dev, struct device_attribute *attr, |
4067 | char *buf) | ||
4067 | { | 4068 | { |
4068 | struct Scsi_Host *shost = class_to_shost(cdev); | 4069 | struct Scsi_Host *shost = class_to_shost(dev); |
4069 | adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(shost); | 4070 | adapter_t *adapter = (adapter_t *)SCSIHOST2ADAP(shost); |
4070 | uint32_t app_hndl; | 4071 | uint32_t app_hndl; |
4071 | 4072 | ||
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c index c5ebf018b378..d89289400425 100644 --- a/drivers/scsi/ncr53c8xx.c +++ b/drivers/scsi/ncr53c8xx.c | |||
@@ -8243,7 +8243,8 @@ static void process_waiting_list(struct ncb *np, int sts) | |||
8243 | 8243 | ||
8244 | #undef next_wcmd | 8244 | #undef next_wcmd |
8245 | 8245 | ||
8246 | static ssize_t show_ncr53c8xx_revision(struct class_device *dev, char *buf) | 8246 | static ssize_t show_ncr53c8xx_revision(struct device *dev, |
8247 | struct device_attribute *attr, char *buf) | ||
8247 | { | 8248 | { |
8248 | struct Scsi_Host *host = class_to_shost(dev); | 8249 | struct Scsi_Host *host = class_to_shost(dev); |
8249 | struct host_data *host_data = (struct host_data *)host->hostdata; | 8250 | struct host_data *host_data = (struct host_data *)host->hostdata; |
@@ -8251,12 +8252,12 @@ static ssize_t show_ncr53c8xx_revision(struct class_device *dev, char *buf) | |||
8251 | return snprintf(buf, 20, "0x%x\n", host_data->ncb->revision_id); | 8252 | return snprintf(buf, 20, "0x%x\n", host_data->ncb->revision_id); |
8252 | } | 8253 | } |
8253 | 8254 | ||
8254 | static struct class_device_attribute ncr53c8xx_revision_attr = { | 8255 | static struct device_attribute ncr53c8xx_revision_attr = { |
8255 | .attr = { .name = "revision", .mode = S_IRUGO, }, | 8256 | .attr = { .name = "revision", .mode = S_IRUGO, }, |
8256 | .show = show_ncr53c8xx_revision, | 8257 | .show = show_ncr53c8xx_revision, |
8257 | }; | 8258 | }; |
8258 | 8259 | ||
8259 | static struct class_device_attribute *ncr53c8xx_host_attrs[] = { | 8260 | static struct device_attribute *ncr53c8xx_host_attrs[] = { |
8260 | &ncr53c8xx_revision_attr, | 8261 | &ncr53c8xx_revision_attr, |
8261 | NULL | 8262 | NULL |
8262 | }; | 8263 | }; |
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index abef7048f25b..31f7aec44d90 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -5591,9 +5591,10 @@ static void osst_remove_sysfs_files(struct device_driver *sysfs) | |||
5591 | * sysfs support for accessing ADR header information | 5591 | * sysfs support for accessing ADR header information |
5592 | */ | 5592 | */ |
5593 | 5593 | ||
5594 | static ssize_t osst_adr_rev_show(struct class_device *class_dev, char *buf) | 5594 | static ssize_t osst_adr_rev_show(struct device *dev, |
5595 | struct device_attribute *attr, char *buf) | ||
5595 | { | 5596 | { |
5596 | struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); | 5597 | struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); |
5597 | ssize_t l = 0; | 5598 | ssize_t l = 0; |
5598 | 5599 | ||
5599 | if (STp && STp->header_ok && STp->linux_media) | 5600 | if (STp && STp->header_ok && STp->linux_media) |
@@ -5601,11 +5602,13 @@ static ssize_t osst_adr_rev_show(struct class_device *class_dev, char *buf) | |||
5601 | return l; | 5602 | return l; |
5602 | } | 5603 | } |
5603 | 5604 | ||
5604 | CLASS_DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL); | 5605 | DEVICE_ATTR(ADR_rev, S_IRUGO, osst_adr_rev_show, NULL); |
5605 | 5606 | ||
5606 | static ssize_t osst_linux_media_version_show(struct class_device *class_dev, char *buf) | 5607 | static ssize_t osst_linux_media_version_show(struct device *dev, |
5608 | struct device_attribute *attr, | ||
5609 | char *buf) | ||
5607 | { | 5610 | { |
5608 | struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); | 5611 | struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); |
5609 | ssize_t l = 0; | 5612 | ssize_t l = 0; |
5610 | 5613 | ||
5611 | if (STp && STp->header_ok && STp->linux_media) | 5614 | if (STp && STp->header_ok && STp->linux_media) |
@@ -5613,11 +5616,12 @@ static ssize_t osst_linux_media_version_show(struct class_device *class_dev, cha | |||
5613 | return l; | 5616 | return l; |
5614 | } | 5617 | } |
5615 | 5618 | ||
5616 | CLASS_DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL); | 5619 | DEVICE_ATTR(media_version, S_IRUGO, osst_linux_media_version_show, NULL); |
5617 | 5620 | ||
5618 | static ssize_t osst_capacity_show(struct class_device *class_dev, char *buf) | 5621 | static ssize_t osst_capacity_show(struct device *dev, |
5622 | struct device_attribute *attr, char *buf) | ||
5619 | { | 5623 | { |
5620 | struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); | 5624 | struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); |
5621 | ssize_t l = 0; | 5625 | ssize_t l = 0; |
5622 | 5626 | ||
5623 | if (STp && STp->header_ok && STp->linux_media) | 5627 | if (STp && STp->header_ok && STp->linux_media) |
@@ -5625,11 +5629,13 @@ static ssize_t osst_capacity_show(struct class_device *class_dev, char *buf) | |||
5625 | return l; | 5629 | return l; |
5626 | } | 5630 | } |
5627 | 5631 | ||
5628 | CLASS_DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL); | 5632 | DEVICE_ATTR(capacity, S_IRUGO, osst_capacity_show, NULL); |
5629 | 5633 | ||
5630 | static ssize_t osst_first_data_ppos_show(struct class_device *class_dev, char *buf) | 5634 | static ssize_t osst_first_data_ppos_show(struct device *dev, |
5635 | struct device_attribute *attr, | ||
5636 | char *buf) | ||
5631 | { | 5637 | { |
5632 | struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); | 5638 | struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); |
5633 | ssize_t l = 0; | 5639 | ssize_t l = 0; |
5634 | 5640 | ||
5635 | if (STp && STp->header_ok && STp->linux_media) | 5641 | if (STp && STp->header_ok && STp->linux_media) |
@@ -5637,11 +5643,13 @@ static ssize_t osst_first_data_ppos_show(struct class_device *class_dev, char *b | |||
5637 | return l; | 5643 | return l; |
5638 | } | 5644 | } |
5639 | 5645 | ||
5640 | CLASS_DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL); | 5646 | DEVICE_ATTR(BOT_frame, S_IRUGO, osst_first_data_ppos_show, NULL); |
5641 | 5647 | ||
5642 | static ssize_t osst_eod_frame_ppos_show(struct class_device *class_dev, char *buf) | 5648 | static ssize_t osst_eod_frame_ppos_show(struct device *dev, |
5649 | struct device_attribute *attr, | ||
5650 | char *buf) | ||
5643 | { | 5651 | { |
5644 | struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); | 5652 | struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); |
5645 | ssize_t l = 0; | 5653 | ssize_t l = 0; |
5646 | 5654 | ||
5647 | if (STp && STp->header_ok && STp->linux_media) | 5655 | if (STp && STp->header_ok && STp->linux_media) |
@@ -5649,11 +5657,12 @@ static ssize_t osst_eod_frame_ppos_show(struct class_device *class_dev, char *bu | |||
5649 | return l; | 5657 | return l; |
5650 | } | 5658 | } |
5651 | 5659 | ||
5652 | CLASS_DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL); | 5660 | DEVICE_ATTR(EOD_frame, S_IRUGO, osst_eod_frame_ppos_show, NULL); |
5653 | 5661 | ||
5654 | static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf) | 5662 | static ssize_t osst_filemark_cnt_show(struct device *dev, |
5663 | struct device_attribute *attr, char *buf) | ||
5655 | { | 5664 | { |
5656 | struct osst_tape * STp = (struct osst_tape *) class_get_devdata (class_dev); | 5665 | struct osst_tape * STp = (struct osst_tape *) dev_get_drvdata (dev); |
5657 | ssize_t l = 0; | 5666 | ssize_t l = 0; |
5658 | 5667 | ||
5659 | if (STp && STp->header_ok && STp->linux_media) | 5668 | if (STp && STp->header_ok && STp->linux_media) |
@@ -5661,7 +5670,7 @@ static ssize_t osst_filemark_cnt_show(struct class_device *class_dev, char *buf) | |||
5661 | return l; | 5670 | return l; |
5662 | } | 5671 | } |
5663 | 5672 | ||
5664 | CLASS_DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); | 5673 | DEVICE_ATTR(file_count, S_IRUGO, osst_filemark_cnt_show, NULL); |
5665 | 5674 | ||
5666 | static struct class *osst_sysfs_class; | 5675 | static struct class *osst_sysfs_class; |
5667 | 5676 | ||
@@ -5678,44 +5687,37 @@ static int osst_sysfs_init(void) | |||
5678 | 5687 | ||
5679 | static void osst_sysfs_destroy(dev_t dev) | 5688 | static void osst_sysfs_destroy(dev_t dev) |
5680 | { | 5689 | { |
5681 | class_device_destroy(osst_sysfs_class, dev); | 5690 | device_destroy(osst_sysfs_class, dev); |
5682 | } | 5691 | } |
5683 | 5692 | ||
5684 | static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * STp, char * name) | 5693 | static int osst_sysfs_add(dev_t dev, struct device *device, struct osst_tape * STp, char * name) |
5685 | { | 5694 | { |
5686 | struct class_device *osst_class_member; | 5695 | struct device *osst_member; |
5687 | int err; | 5696 | int err; |
5688 | 5697 | ||
5689 | osst_class_member = class_device_create(osst_sysfs_class, NULL, dev, | 5698 | osst_member = device_create(osst_sysfs_class, device, dev, "%s", name); |
5690 | device, "%s", name); | 5699 | if (IS_ERR(osst_member)) { |
5691 | if (IS_ERR(osst_class_member)) { | ||
5692 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); | 5700 | printk(KERN_WARNING "osst :W: Unable to add sysfs class member %s\n", name); |
5693 | return PTR_ERR(osst_class_member); | 5701 | return PTR_ERR(osst_member); |
5694 | } | 5702 | } |
5695 | 5703 | ||
5696 | class_set_devdata(osst_class_member, STp); | 5704 | dev_set_drvdata(osst_member, STp); |
5697 | err = class_device_create_file(osst_class_member, | 5705 | err = device_create_file(osst_member, &dev_attr_ADR_rev); |
5698 | &class_device_attr_ADR_rev); | ||
5699 | if (err) | 5706 | if (err) |
5700 | goto err_out; | 5707 | goto err_out; |
5701 | err = class_device_create_file(osst_class_member, | 5708 | err = device_create_file(osst_member, &dev_attr_media_version); |
5702 | &class_device_attr_media_version); | ||
5703 | if (err) | 5709 | if (err) |
5704 | goto err_out; | 5710 | goto err_out; |
5705 | err = class_device_create_file(osst_class_member, | 5711 | err = device_create_file(osst_member, &dev_attr_capacity); |
5706 | &class_device_attr_capacity); | ||
5707 | if (err) | 5712 | if (err) |
5708 | goto err_out; | 5713 | goto err_out; |
5709 | err = class_device_create_file(osst_class_member, | 5714 | err = device_create_file(osst_member, &dev_attr_BOT_frame); |
5710 | &class_device_attr_BOT_frame); | ||
5711 | if (err) | 5715 | if (err) |
5712 | goto err_out; | 5716 | goto err_out; |
5713 | err = class_device_create_file(osst_class_member, | 5717 | err = device_create_file(osst_member, &dev_attr_EOD_frame); |
5714 | &class_device_attr_EOD_frame); | ||
5715 | if (err) | 5718 | if (err) |
5716 | goto err_out; | 5719 | goto err_out; |
5717 | err = class_device_create_file(osst_class_member, | 5720 | err = device_create_file(osst_member, &dev_attr_file_count); |
5718 | &class_device_attr_file_count); | ||
5719 | if (err) | 5721 | if (err) |
5720 | goto err_out; | 5722 | goto err_out; |
5721 | 5723 | ||
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 3454a5714749..0be232b58ffb 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -632,9 +632,10 @@ SYM53C500_biosparm(struct scsi_device *disk, | |||
632 | } | 632 | } |
633 | 633 | ||
634 | static ssize_t | 634 | static ssize_t |
635 | SYM53C500_show_pio(struct class_device *cdev, char *buf) | 635 | SYM53C500_show_pio(struct device *dev, struct device_attribute *attr, |
636 | char *buf) | ||
636 | { | 637 | { |
637 | struct Scsi_Host *SHp = class_to_shost(cdev); | 638 | struct Scsi_Host *SHp = class_to_shost(dev); |
638 | struct sym53c500_data *data = | 639 | struct sym53c500_data *data = |
639 | (struct sym53c500_data *)SHp->hostdata; | 640 | (struct sym53c500_data *)SHp->hostdata; |
640 | 641 | ||
@@ -642,10 +643,11 @@ SYM53C500_show_pio(struct class_device *cdev, char *buf) | |||
642 | } | 643 | } |
643 | 644 | ||
644 | static ssize_t | 645 | static ssize_t |
645 | SYM53C500_store_pio(struct class_device *cdev, const char *buf, size_t count) | 646 | SYM53C500_store_pio(struct device *dev, struct device_attribute *attr, |
647 | const char *buf, size_t count) | ||
646 | { | 648 | { |
647 | int pio; | 649 | int pio; |
648 | struct Scsi_Host *SHp = class_to_shost(cdev); | 650 | struct Scsi_Host *SHp = class_to_shost(dev); |
649 | struct sym53c500_data *data = | 651 | struct sym53c500_data *data = |
650 | (struct sym53c500_data *)SHp->hostdata; | 652 | (struct sym53c500_data *)SHp->hostdata; |
651 | 653 | ||
@@ -662,7 +664,7 @@ SYM53C500_store_pio(struct class_device *cdev, const char *buf, size_t count) | |||
662 | * SCSI HBA device attributes we want to | 664 | * SCSI HBA device attributes we want to |
663 | * make available via sysfs. | 665 | * make available via sysfs. |
664 | */ | 666 | */ |
665 | static struct class_device_attribute SYM53C500_pio_attr = { | 667 | static struct device_attribute SYM53C500_pio_attr = { |
666 | .attr = { | 668 | .attr = { |
667 | .name = "fast_pio", | 669 | .name = "fast_pio", |
668 | .mode = (S_IRUGO | S_IWUSR), | 670 | .mode = (S_IRUGO | S_IWUSR), |
@@ -671,7 +673,7 @@ static struct class_device_attribute SYM53C500_pio_attr = { | |||
671 | .store = SYM53C500_store_pio, | 673 | .store = SYM53C500_store_pio, |
672 | }; | 674 | }; |
673 | 675 | ||
674 | static struct class_device_attribute *SYM53C500_shost_attrs[] = { | 676 | static struct device_attribute *SYM53C500_shost_attrs[] = { |
675 | &SYM53C500_pio_attr, | 677 | &SYM53C500_pio_attr, |
676 | NULL, | 678 | NULL, |
677 | }; | 679 | }; |
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 413d8cd6a324..d61df036910c 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c | |||
@@ -530,15 +530,17 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) | |||
530 | /* Scsi_Host attributes. */ | 530 | /* Scsi_Host attributes. */ |
531 | 531 | ||
532 | static ssize_t | 532 | static ssize_t |
533 | qla2x00_drvr_version_show(struct class_device *cdev, char *buf) | 533 | qla2x00_drvr_version_show(struct device *dev, |
534 | struct device_attribute *attr, char *buf) | ||
534 | { | 535 | { |
535 | return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); | 536 | return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); |
536 | } | 537 | } |
537 | 538 | ||
538 | static ssize_t | 539 | static ssize_t |
539 | qla2x00_fw_version_show(struct class_device *cdev, char *buf) | 540 | qla2x00_fw_version_show(struct device *dev, |
541 | struct device_attribute *attr, char *buf) | ||
540 | { | 542 | { |
541 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 543 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
542 | char fw_str[30]; | 544 | char fw_str[30]; |
543 | 545 | ||
544 | return snprintf(buf, PAGE_SIZE, "%s\n", | 546 | return snprintf(buf, PAGE_SIZE, "%s\n", |
@@ -546,9 +548,10 @@ qla2x00_fw_version_show(struct class_device *cdev, char *buf) | |||
546 | } | 548 | } |
547 | 549 | ||
548 | static ssize_t | 550 | static ssize_t |
549 | qla2x00_serial_num_show(struct class_device *cdev, char *buf) | 551 | qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr, |
552 | char *buf) | ||
550 | { | 553 | { |
551 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 554 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
552 | uint32_t sn; | 555 | uint32_t sn; |
553 | 556 | ||
554 | if (IS_FWI2_CAPABLE(ha)) | 557 | if (IS_FWI2_CAPABLE(ha)) |
@@ -560,40 +563,45 @@ qla2x00_serial_num_show(struct class_device *cdev, char *buf) | |||
560 | } | 563 | } |
561 | 564 | ||
562 | static ssize_t | 565 | static ssize_t |
563 | qla2x00_isp_name_show(struct class_device *cdev, char *buf) | 566 | qla2x00_isp_name_show(struct device *dev, struct device_attribute *attr, |
567 | char *buf) | ||
564 | { | 568 | { |
565 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 569 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
566 | return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); | 570 | return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); |
567 | } | 571 | } |
568 | 572 | ||
569 | static ssize_t | 573 | static ssize_t |
570 | qla2x00_isp_id_show(struct class_device *cdev, char *buf) | 574 | qla2x00_isp_id_show(struct device *dev, struct device_attribute *attr, |
575 | char *buf) | ||
571 | { | 576 | { |
572 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 577 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
573 | return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", | 578 | return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", |
574 | ha->product_id[0], ha->product_id[1], ha->product_id[2], | 579 | ha->product_id[0], ha->product_id[1], ha->product_id[2], |
575 | ha->product_id[3]); | 580 | ha->product_id[3]); |
576 | } | 581 | } |
577 | 582 | ||
578 | static ssize_t | 583 | static ssize_t |
579 | qla2x00_model_name_show(struct class_device *cdev, char *buf) | 584 | qla2x00_model_name_show(struct device *dev, struct device_attribute *attr, |
585 | char *buf) | ||
580 | { | 586 | { |
581 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 587 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
582 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); | 588 | return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); |
583 | } | 589 | } |
584 | 590 | ||
585 | static ssize_t | 591 | static ssize_t |
586 | qla2x00_model_desc_show(struct class_device *cdev, char *buf) | 592 | qla2x00_model_desc_show(struct device *dev, struct device_attribute *attr, |
593 | char *buf) | ||
587 | { | 594 | { |
588 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 595 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
589 | return snprintf(buf, PAGE_SIZE, "%s\n", | 596 | return snprintf(buf, PAGE_SIZE, "%s\n", |
590 | ha->model_desc ? ha->model_desc: ""); | 597 | ha->model_desc ? ha->model_desc: ""); |
591 | } | 598 | } |
592 | 599 | ||
593 | static ssize_t | 600 | static ssize_t |
594 | qla2x00_pci_info_show(struct class_device *cdev, char *buf) | 601 | qla2x00_pci_info_show(struct device *dev, struct device_attribute *attr, |
602 | char *buf) | ||
595 | { | 603 | { |
596 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 604 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
597 | char pci_info[30]; | 605 | char pci_info[30]; |
598 | 606 | ||
599 | return snprintf(buf, PAGE_SIZE, "%s\n", | 607 | return snprintf(buf, PAGE_SIZE, "%s\n", |
@@ -601,9 +609,10 @@ qla2x00_pci_info_show(struct class_device *cdev, char *buf) | |||
601 | } | 609 | } |
602 | 610 | ||
603 | static ssize_t | 611 | static ssize_t |
604 | qla2x00_state_show(struct class_device *cdev, char *buf) | 612 | qla2x00_state_show(struct device *dev, struct device_attribute *attr, |
613 | char *buf) | ||
605 | { | 614 | { |
606 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 615 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
607 | int len = 0; | 616 | int len = 0; |
608 | 617 | ||
609 | if (atomic_read(&ha->loop_state) == LOOP_DOWN || | 618 | if (atomic_read(&ha->loop_state) == LOOP_DOWN || |
@@ -639,9 +648,10 @@ qla2x00_state_show(struct class_device *cdev, char *buf) | |||
639 | } | 648 | } |
640 | 649 | ||
641 | static ssize_t | 650 | static ssize_t |
642 | qla2x00_zio_show(struct class_device *cdev, char *buf) | 651 | qla2x00_zio_show(struct device *dev, struct device_attribute *attr, |
652 | char *buf) | ||
643 | { | 653 | { |
644 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 654 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
645 | int len = 0; | 655 | int len = 0; |
646 | 656 | ||
647 | switch (ha->zio_mode) { | 657 | switch (ha->zio_mode) { |
@@ -656,9 +666,10 @@ qla2x00_zio_show(struct class_device *cdev, char *buf) | |||
656 | } | 666 | } |
657 | 667 | ||
658 | static ssize_t | 668 | static ssize_t |
659 | qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) | 669 | qla2x00_zio_store(struct device *dev, struct device_attribute *attr, |
670 | const char *buf, size_t count) | ||
660 | { | 671 | { |
661 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 672 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
662 | int val = 0; | 673 | int val = 0; |
663 | uint16_t zio_mode; | 674 | uint16_t zio_mode; |
664 | 675 | ||
@@ -682,18 +693,19 @@ qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) | |||
682 | } | 693 | } |
683 | 694 | ||
684 | static ssize_t | 695 | static ssize_t |
685 | qla2x00_zio_timer_show(struct class_device *cdev, char *buf) | 696 | qla2x00_zio_timer_show(struct device *dev, struct device_attribute *attr, |
697 | char *buf) | ||
686 | { | 698 | { |
687 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 699 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
688 | 700 | ||
689 | return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); | 701 | return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); |
690 | } | 702 | } |
691 | 703 | ||
692 | static ssize_t | 704 | static ssize_t |
693 | qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | 705 | qla2x00_zio_timer_store(struct device *dev, struct device_attribute *attr, |
694 | size_t count) | 706 | const char *buf, size_t count) |
695 | { | 707 | { |
696 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 708 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
697 | int val = 0; | 709 | int val = 0; |
698 | uint16_t zio_timer; | 710 | uint16_t zio_timer; |
699 | 711 | ||
@@ -709,9 +721,10 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, | |||
709 | } | 721 | } |
710 | 722 | ||
711 | static ssize_t | 723 | static ssize_t |
712 | qla2x00_beacon_show(struct class_device *cdev, char *buf) | 724 | qla2x00_beacon_show(struct device *dev, struct device_attribute *attr, |
725 | char *buf) | ||
713 | { | 726 | { |
714 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 727 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
715 | int len = 0; | 728 | int len = 0; |
716 | 729 | ||
717 | if (ha->beacon_blink_led) | 730 | if (ha->beacon_blink_led) |
@@ -722,10 +735,10 @@ qla2x00_beacon_show(struct class_device *cdev, char *buf) | |||
722 | } | 735 | } |
723 | 736 | ||
724 | static ssize_t | 737 | static ssize_t |
725 | qla2x00_beacon_store(struct class_device *cdev, const char *buf, | 738 | qla2x00_beacon_store(struct device *dev, struct device_attribute *attr, |
726 | size_t count) | 739 | const char *buf, size_t count) |
727 | { | 740 | { |
728 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 741 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
729 | int val = 0; | 742 | int val = 0; |
730 | int rval; | 743 | int rval; |
731 | 744 | ||
@@ -753,84 +766,86 @@ qla2x00_beacon_store(struct class_device *cdev, const char *buf, | |||
753 | } | 766 | } |
754 | 767 | ||
755 | static ssize_t | 768 | static ssize_t |
756 | qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) | 769 | qla2x00_optrom_bios_version_show(struct device *dev, |
770 | struct device_attribute *attr, char *buf) | ||
757 | { | 771 | { |
758 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 772 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
759 | 773 | ||
760 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], | 774 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], |
761 | ha->bios_revision[0]); | 775 | ha->bios_revision[0]); |
762 | } | 776 | } |
763 | 777 | ||
764 | static ssize_t | 778 | static ssize_t |
765 | qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) | 779 | qla2x00_optrom_efi_version_show(struct device *dev, |
780 | struct device_attribute *attr, char *buf) | ||
766 | { | 781 | { |
767 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 782 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
768 | 783 | ||
769 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], | 784 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], |
770 | ha->efi_revision[0]); | 785 | ha->efi_revision[0]); |
771 | } | 786 | } |
772 | 787 | ||
773 | static ssize_t | 788 | static ssize_t |
774 | qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) | 789 | qla2x00_optrom_fcode_version_show(struct device *dev, |
790 | struct device_attribute *attr, char *buf) | ||
775 | { | 791 | { |
776 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 792 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
777 | 793 | ||
778 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], | 794 | return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], |
779 | ha->fcode_revision[0]); | 795 | ha->fcode_revision[0]); |
780 | } | 796 | } |
781 | 797 | ||
782 | static ssize_t | 798 | static ssize_t |
783 | qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) | 799 | qla2x00_optrom_fw_version_show(struct device *dev, |
800 | struct device_attribute *attr, char *buf) | ||
784 | { | 801 | { |
785 | scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); | 802 | scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); |
786 | 803 | ||
787 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", | 804 | return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", |
788 | ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], | 805 | ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], |
789 | ha->fw_revision[3]); | 806 | ha->fw_revision[3]); |
790 | } | 807 | } |
791 | 808 | ||
792 | static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, | 809 | static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); |
793 | NULL); | 810 | static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); |
794 | static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); | 811 | static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); |
795 | static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); | 812 | static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); |
796 | static CLASS_DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); | 813 | static DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); |
797 | static CLASS_DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); | 814 | static DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); |
798 | static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); | 815 | static DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); |
799 | static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); | 816 | static DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); |
800 | static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); | 817 | static DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); |
801 | static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); | 818 | static DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, qla2x00_zio_store); |
802 | static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, | 819 | static DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, |
803 | qla2x00_zio_store); | 820 | qla2x00_zio_timer_store); |
804 | static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, | 821 | static DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, |
805 | qla2x00_zio_timer_store); | 822 | qla2x00_beacon_store); |
806 | static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, | 823 | static DEVICE_ATTR(optrom_bios_version, S_IRUGO, |
807 | qla2x00_beacon_store); | 824 | qla2x00_optrom_bios_version_show, NULL); |
808 | static CLASS_DEVICE_ATTR(optrom_bios_version, S_IRUGO, | 825 | static DEVICE_ATTR(optrom_efi_version, S_IRUGO, |
809 | qla2x00_optrom_bios_version_show, NULL); | 826 | qla2x00_optrom_efi_version_show, NULL); |
810 | static CLASS_DEVICE_ATTR(optrom_efi_version, S_IRUGO, | 827 | static DEVICE_ATTR(optrom_fcode_version, S_IRUGO, |
811 | qla2x00_optrom_efi_version_show, NULL); | 828 | qla2x00_optrom_fcode_version_show, NULL); |
812 | static CLASS_DEVICE_ATTR(optrom_fcode_version, S_IRUGO, | 829 | static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show, |
813 | qla2x00_optrom_fcode_version_show, NULL); | 830 | NULL); |
814 | static CLASS_DEVICE_ATTR(optrom_fw_version, S_IRUGO, | 831 | |
815 | qla2x00_optrom_fw_version_show, NULL); | 832 | struct device_attribute *qla2x00_host_attrs[] = { |
816 | 833 | &dev_attr_driver_version, | |
817 | struct class_device_attribute *qla2x00_host_attrs[] = { | 834 | &dev_attr_fw_version, |
818 | &class_device_attr_driver_version, | 835 | &dev_attr_serial_num, |
819 | &class_device_attr_fw_version, | 836 | &dev_attr_isp_name, |
820 | &class_device_attr_serial_num, | 837 | &dev_attr_isp_id, |
821 | &class_device_attr_isp_name, | 838 | &dev_attr_model_name, |
822 | &class_device_attr_isp_id, | 839 | &dev_attr_model_desc, |
823 | &class_device_attr_model_name, | 840 | &dev_attr_pci_info, |
824 | &class_device_attr_model_desc, | 841 | &dev_attr_state, |
825 | &class_device_attr_pci_info, | 842 | &dev_attr_zio, |
826 | &class_device_attr_state, | 843 | &dev_attr_zio_timer, |
827 | &class_device_attr_zio, | 844 | &dev_attr_beacon, |
828 | &class_device_attr_zio_timer, | 845 | &dev_attr_optrom_bios_version, |
829 | &class_device_attr_beacon, | 846 | &dev_attr_optrom_efi_version, |
830 | &class_device_attr_optrom_bios_version, | 847 | &dev_attr_optrom_fcode_version, |
831 | &class_device_attr_optrom_efi_version, | 848 | &dev_attr_optrom_fw_version, |
832 | &class_device_attr_optrom_fcode_version, | ||
833 | &class_device_attr_optrom_fw_version, | ||
834 | NULL, | 849 | NULL, |
835 | }; | 850 | }; |
836 | 851 | ||
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index a9571c214a9e..76eb4fecce65 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h | |||
@@ -347,8 +347,8 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *); | |||
347 | /* | 347 | /* |
348 | * Global Function Prototypes in qla_attr.c source file. | 348 | * Global Function Prototypes in qla_attr.c source file. |
349 | */ | 349 | */ |
350 | struct class_device_attribute; | 350 | struct device_attribute; |
351 | extern struct class_device_attribute *qla2x00_host_attrs[]; | 351 | extern struct device_attribute *qla2x00_host_attrs[]; |
352 | struct fc_function_template; | 352 | struct fc_function_template; |
353 | extern struct fc_function_template qla2xxx_transport_functions; | 353 | extern struct fc_function_template qla2xxx_transport_functions; |
354 | extern struct fc_function_template qla2xxx_transport_vport_functions; | 354 | extern struct fc_function_template qla2xxx_transport_vport_functions; |
diff --git a/drivers/scsi/raid_class.c b/drivers/scsi/raid_class.c index 52182a744ba6..913a931176ef 100644 --- a/drivers/scsi/raid_class.c +++ b/drivers/scsi/raid_class.c | |||
@@ -24,15 +24,15 @@ struct raid_internal { | |||
24 | struct raid_template r; | 24 | struct raid_template r; |
25 | struct raid_function_template *f; | 25 | struct raid_function_template *f; |
26 | /* The actual attributes */ | 26 | /* The actual attributes */ |
27 | struct class_device_attribute private_attrs[RAID_NUM_ATTRS]; | 27 | struct device_attribute private_attrs[RAID_NUM_ATTRS]; |
28 | /* The array of null terminated pointers to attributes | 28 | /* The array of null terminated pointers to attributes |
29 | * needed by scsi_sysfs.c */ | 29 | * needed by scsi_sysfs.c */ |
30 | struct class_device_attribute *attrs[RAID_NUM_ATTRS + 1]; | 30 | struct device_attribute *attrs[RAID_NUM_ATTRS + 1]; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | struct raid_component { | 33 | struct raid_component { |
34 | struct list_head node; | 34 | struct list_head node; |
35 | struct class_device cdev; | 35 | struct device dev; |
36 | int num; | 36 | int num; |
37 | }; | 37 | }; |
38 | 38 | ||
@@ -50,9 +50,9 @@ struct raid_component { | |||
50 | tc_to_raid_internal(tc); \ | 50 | tc_to_raid_internal(tc); \ |
51 | }) | 51 | }) |
52 | 52 | ||
53 | #define class_device_to_raid_internal(cdev) ({ \ | 53 | #define device_to_raid_internal(dev) ({ \ |
54 | struct attribute_container *ac = \ | 54 | struct attribute_container *ac = \ |
55 | attribute_container_classdev_to_container(cdev); \ | 55 | attribute_container_classdev_to_container(dev); \ |
56 | ac_to_raid_internal(ac); \ | 56 | ac_to_raid_internal(ac); \ |
57 | }) | 57 | }) |
58 | 58 | ||
@@ -76,33 +76,33 @@ static int raid_match(struct attribute_container *cont, struct device *dev) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | static int raid_setup(struct transport_container *tc, struct device *dev, | 78 | static int raid_setup(struct transport_container *tc, struct device *dev, |
79 | struct class_device *cdev) | 79 | struct device *cdev) |
80 | { | 80 | { |
81 | struct raid_data *rd; | 81 | struct raid_data *rd; |
82 | 82 | ||
83 | BUG_ON(class_get_devdata(cdev)); | 83 | BUG_ON(dev_get_drvdata(cdev)); |
84 | 84 | ||
85 | rd = kzalloc(sizeof(*rd), GFP_KERNEL); | 85 | rd = kzalloc(sizeof(*rd), GFP_KERNEL); |
86 | if (!rd) | 86 | if (!rd) |
87 | return -ENOMEM; | 87 | return -ENOMEM; |
88 | 88 | ||
89 | INIT_LIST_HEAD(&rd->component_list); | 89 | INIT_LIST_HEAD(&rd->component_list); |
90 | class_set_devdata(cdev, rd); | 90 | dev_set_drvdata(cdev, rd); |
91 | 91 | ||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static int raid_remove(struct transport_container *tc, struct device *dev, | 95 | static int raid_remove(struct transport_container *tc, struct device *dev, |
96 | struct class_device *cdev) | 96 | struct device *cdev) |
97 | { | 97 | { |
98 | struct raid_data *rd = class_get_devdata(cdev); | 98 | struct raid_data *rd = dev_get_drvdata(cdev); |
99 | struct raid_component *rc, *next; | 99 | struct raid_component *rc, *next; |
100 | dev_printk(KERN_ERR, dev, "RAID REMOVE\n"); | 100 | dev_printk(KERN_ERR, dev, "RAID REMOVE\n"); |
101 | class_set_devdata(cdev, NULL); | 101 | dev_set_drvdata(cdev, NULL); |
102 | list_for_each_entry_safe(rc, next, &rd->component_list, node) { | 102 | list_for_each_entry_safe(rc, next, &rd->component_list, node) { |
103 | list_del(&rc->node); | 103 | list_del(&rc->node); |
104 | dev_printk(KERN_ERR, rc->cdev.dev, "RAID COMPONENT REMOVE\n"); | 104 | dev_printk(KERN_ERR, rc->dev.parent, "RAID COMPONENT REMOVE\n"); |
105 | class_device_unregister(&rc->cdev); | 105 | device_unregister(&rc->dev); |
106 | } | 106 | } |
107 | dev_printk(KERN_ERR, dev, "RAID REMOVE DONE\n"); | 107 | dev_printk(KERN_ERR, dev, "RAID REMOVE DONE\n"); |
108 | kfree(rd); | 108 | kfree(rd); |
@@ -171,9 +171,11 @@ static const char *raid_level_name(enum raid_level level) | |||
171 | } | 171 | } |
172 | 172 | ||
173 | #define raid_attr_show_internal(attr, fmt, var, code) \ | 173 | #define raid_attr_show_internal(attr, fmt, var, code) \ |
174 | static ssize_t raid_show_##attr(struct class_device *cdev, char *buf) \ | 174 | static ssize_t raid_show_##attr(struct device *dev, \ |
175 | struct device_attribute *attr, \ | ||
176 | char *buf) \ | ||
175 | { \ | 177 | { \ |
176 | struct raid_data *rd = class_get_devdata(cdev); \ | 178 | struct raid_data *rd = dev_get_drvdata(dev); \ |
177 | code \ | 179 | code \ |
178 | return snprintf(buf, 20, #fmt "\n", var); \ | 180 | return snprintf(buf, 20, #fmt "\n", var); \ |
179 | } | 181 | } |
@@ -184,17 +186,17 @@ raid_attr_show_internal(attr, %s, name, \ | |||
184 | code \ | 186 | code \ |
185 | name = raid_##states##_name(rd->attr); \ | 187 | name = raid_##states##_name(rd->attr); \ |
186 | ) \ | 188 | ) \ |
187 | static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) | 189 | static DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) |
188 | 190 | ||
189 | 191 | ||
190 | #define raid_attr_ro_internal(attr, code) \ | 192 | #define raid_attr_ro_internal(attr, code) \ |
191 | raid_attr_show_internal(attr, %d, rd->attr, code) \ | 193 | raid_attr_show_internal(attr, %d, rd->attr, code) \ |
192 | static CLASS_DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) | 194 | static DEVICE_ATTR(attr, S_IRUGO, raid_show_##attr, NULL) |
193 | 195 | ||
194 | #define ATTR_CODE(attr) \ | 196 | #define ATTR_CODE(attr) \ |
195 | struct raid_internal *i = class_device_to_raid_internal(cdev); \ | 197 | struct raid_internal *i = device_to_raid_internal(dev); \ |
196 | if (i->f->get_##attr) \ | 198 | if (i->f->get_##attr) \ |
197 | i->f->get_##attr(cdev->dev); | 199 | i->f->get_##attr(dev->parent); |
198 | 200 | ||
199 | #define raid_attr_ro(attr) raid_attr_ro_internal(attr, ) | 201 | #define raid_attr_ro(attr) raid_attr_ro_internal(attr, ) |
200 | #define raid_attr_ro_fn(attr) raid_attr_ro_internal(attr, ATTR_CODE(attr)) | 202 | #define raid_attr_ro_fn(attr) raid_attr_ro_internal(attr, ATTR_CODE(attr)) |
@@ -206,23 +208,23 @@ raid_attr_ro_state(level); | |||
206 | raid_attr_ro_fn(resync); | 208 | raid_attr_ro_fn(resync); |
207 | raid_attr_ro_state_fn(state); | 209 | raid_attr_ro_state_fn(state); |
208 | 210 | ||
209 | static void raid_component_release(struct class_device *cdev) | 211 | static void raid_component_release(struct device *dev) |
210 | { | 212 | { |
211 | struct raid_component *rc = container_of(cdev, struct raid_component, | 213 | struct raid_component *rc = |
212 | cdev); | 214 | container_of(dev, struct raid_component, dev); |
213 | dev_printk(KERN_ERR, rc->cdev.dev, "COMPONENT RELEASE\n"); | 215 | dev_printk(KERN_ERR, rc->dev.parent, "COMPONENT RELEASE\n"); |
214 | put_device(rc->cdev.dev); | 216 | put_device(rc->dev.parent); |
215 | kfree(rc); | 217 | kfree(rc); |
216 | } | 218 | } |
217 | 219 | ||
218 | int raid_component_add(struct raid_template *r,struct device *raid_dev, | 220 | int raid_component_add(struct raid_template *r,struct device *raid_dev, |
219 | struct device *component_dev) | 221 | struct device *component_dev) |
220 | { | 222 | { |
221 | struct class_device *cdev = | 223 | struct device *cdev = |
222 | attribute_container_find_class_device(&r->raid_attrs.ac, | 224 | attribute_container_find_class_device(&r->raid_attrs.ac, |
223 | raid_dev); | 225 | raid_dev); |
224 | struct raid_component *rc; | 226 | struct raid_component *rc; |
225 | struct raid_data *rd = class_get_devdata(cdev); | 227 | struct raid_data *rd = dev_get_drvdata(cdev); |
226 | int err; | 228 | int err; |
227 | 229 | ||
228 | rc = kzalloc(sizeof(*rc), GFP_KERNEL); | 230 | rc = kzalloc(sizeof(*rc), GFP_KERNEL); |
@@ -230,17 +232,16 @@ int raid_component_add(struct raid_template *r,struct device *raid_dev, | |||
230 | return -ENOMEM; | 232 | return -ENOMEM; |
231 | 233 | ||
232 | INIT_LIST_HEAD(&rc->node); | 234 | INIT_LIST_HEAD(&rc->node); |
233 | class_device_initialize(&rc->cdev); | 235 | device_initialize(&rc->dev); |
234 | rc->cdev.release = raid_component_release; | 236 | rc->dev.release = raid_component_release; |
235 | rc->cdev.dev = get_device(component_dev); | 237 | rc->dev.parent = get_device(component_dev); |
236 | rc->num = rd->component_count++; | 238 | rc->num = rd->component_count++; |
237 | 239 | ||
238 | snprintf(rc->cdev.class_id, sizeof(rc->cdev.class_id), | 240 | snprintf(rc->dev.bus_id, sizeof(rc->dev.bus_id), |
239 | "component-%d", rc->num); | 241 | "component-%d", rc->num); |
240 | list_add_tail(&rc->node, &rd->component_list); | 242 | list_add_tail(&rc->node, &rd->component_list); |
241 | rc->cdev.parent = cdev; | 243 | rc->dev.class = &raid_class.class; |
242 | rc->cdev.class = &raid_class.class; | 244 | err = device_add(&rc->dev); |
243 | err = class_device_add(&rc->cdev); | ||
244 | if (err) | 245 | if (err) |
245 | goto err_out; | 246 | goto err_out; |
246 | 247 | ||
@@ -273,9 +274,9 @@ raid_class_attach(struct raid_function_template *ft) | |||
273 | 274 | ||
274 | attribute_container_register(&i->r.raid_attrs.ac); | 275 | attribute_container_register(&i->r.raid_attrs.ac); |
275 | 276 | ||
276 | i->attrs[count++] = &class_device_attr_level; | 277 | i->attrs[count++] = &dev_attr_level; |
277 | i->attrs[count++] = &class_device_attr_resync; | 278 | i->attrs[count++] = &dev_attr_resync; |
278 | i->attrs[count++] = &class_device_attr_state; | 279 | i->attrs[count++] = &dev_attr_state; |
279 | 280 | ||
280 | i->attrs[count] = NULL; | 281 | i->attrs[count] = NULL; |
281 | BUG_ON(count > RAID_NUM_ATTRS); | 282 | BUG_ON(count > RAID_NUM_ATTRS); |
diff --git a/drivers/scsi/scsi_sas_internal.h b/drivers/scsi/scsi_sas_internal.h index e1edab45a37b..998cb5be6833 100644 --- a/drivers/scsi/scsi_sas_internal.h +++ b/drivers/scsi/scsi_sas_internal.h | |||
@@ -13,12 +13,12 @@ struct sas_internal { | |||
13 | struct sas_function_template *f; | 13 | struct sas_function_template *f; |
14 | struct sas_domain_function_template *dft; | 14 | struct sas_domain_function_template *dft; |
15 | 15 | ||
16 | struct class_device_attribute private_host_attrs[SAS_HOST_ATTRS]; | 16 | struct device_attribute private_host_attrs[SAS_HOST_ATTRS]; |
17 | struct class_device_attribute private_phy_attrs[SAS_PHY_ATTRS]; | 17 | struct device_attribute private_phy_attrs[SAS_PHY_ATTRS]; |
18 | struct class_device_attribute private_port_attrs[SAS_PORT_ATTRS]; | 18 | struct device_attribute private_port_attrs[SAS_PORT_ATTRS]; |
19 | struct class_device_attribute private_rphy_attrs[SAS_RPORT_ATTRS]; | 19 | struct device_attribute private_rphy_attrs[SAS_RPORT_ATTRS]; |
20 | struct class_device_attribute private_end_dev_attrs[SAS_END_DEV_ATTRS]; | 20 | struct device_attribute private_end_dev_attrs[SAS_END_DEV_ATTRS]; |
21 | struct class_device_attribute private_expander_attrs[SAS_EXPANDER_ATTRS]; | 21 | struct device_attribute private_expander_attrs[SAS_EXPANDER_ATTRS]; |
22 | 22 | ||
23 | struct transport_container phy_attr_cont; | 23 | struct transport_container phy_attr_cont; |
24 | struct transport_container port_attr_cont; | 24 | struct transport_container port_attr_cont; |
@@ -30,12 +30,12 @@ struct sas_internal { | |||
30 | * The array of null terminated pointers to attributes | 30 | * The array of null terminated pointers to attributes |
31 | * needed by scsi_sysfs.c | 31 | * needed by scsi_sysfs.c |
32 | */ | 32 | */ |
33 | struct class_device_attribute *host_attrs[SAS_HOST_ATTRS + 1]; | 33 | struct device_attribute *host_attrs[SAS_HOST_ATTRS + 1]; |
34 | struct class_device_attribute *phy_attrs[SAS_PHY_ATTRS + 1]; | 34 | struct device_attribute *phy_attrs[SAS_PHY_ATTRS + 1]; |
35 | struct class_device_attribute *port_attrs[SAS_PORT_ATTRS + 1]; | 35 | struct device_attribute *port_attrs[SAS_PORT_ATTRS + 1]; |
36 | struct class_device_attribute *rphy_attrs[SAS_RPORT_ATTRS + 1]; | 36 | struct device_attribute *rphy_attrs[SAS_RPORT_ATTRS + 1]; |
37 | struct class_device_attribute *end_dev_attrs[SAS_END_DEV_ATTRS + 1]; | 37 | struct device_attribute *end_dev_attrs[SAS_END_DEV_ATTRS + 1]; |
38 | struct class_device_attribute *expander_attrs[SAS_EXPANDER_ATTRS + 1]; | 38 | struct device_attribute *expander_attrs[SAS_EXPANDER_ATTRS + 1]; |
39 | }; | 39 | }; |
40 | #define to_sas_internal(tmpl) container_of(tmpl, struct sas_internal, t) | 40 | #define to_sas_internal(tmpl) container_of(tmpl, struct sas_internal, t) |
41 | 41 | ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index ed83cdb6e67d..67bb20ed45d2 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c | |||
@@ -119,9 +119,10 @@ static int scsi_scan(struct Scsi_Host *shost, const char *str) | |||
119 | */ | 119 | */ |
120 | #define shost_show_function(name, field, format_string) \ | 120 | #define shost_show_function(name, field, format_string) \ |
121 | static ssize_t \ | 121 | static ssize_t \ |
122 | show_##name (struct class_device *class_dev, char *buf) \ | 122 | show_##name (struct device *dev, struct device_attribute *attr, \ |
123 | char *buf) \ | ||
123 | { \ | 124 | { \ |
124 | struct Scsi_Host *shost = class_to_shost(class_dev); \ | 125 | struct Scsi_Host *shost = class_to_shost(dev); \ |
125 | return snprintf (buf, 20, format_string, shost->field); \ | 126 | return snprintf (buf, 20, format_string, shost->field); \ |
126 | } | 127 | } |
127 | 128 | ||
@@ -131,7 +132,7 @@ show_##name (struct class_device *class_dev, char *buf) \ | |||
131 | */ | 132 | */ |
132 | #define shost_rd_attr2(name, field, format_string) \ | 133 | #define shost_rd_attr2(name, field, format_string) \ |
133 | shost_show_function(name, field, format_string) \ | 134 | shost_show_function(name, field, format_string) \ |
134 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); | 135 | static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL); |
135 | 136 | ||
136 | #define shost_rd_attr(field, format_string) \ | 137 | #define shost_rd_attr(field, format_string) \ |
137 | shost_rd_attr2(field, field, format_string) | 138 | shost_rd_attr2(field, field, format_string) |
@@ -140,10 +141,11 @@ shost_rd_attr2(field, field, format_string) | |||
140 | * Create the actual show/store functions and data structures. | 141 | * Create the actual show/store functions and data structures. |
141 | */ | 142 | */ |
142 | 143 | ||
143 | static ssize_t store_scan(struct class_device *class_dev, const char *buf, | 144 | static ssize_t |
144 | size_t count) | 145 | store_scan(struct device *dev, struct device_attribute *attr, |
146 | const char *buf, size_t count) | ||
145 | { | 147 | { |
146 | struct Scsi_Host *shost = class_to_shost(class_dev); | 148 | struct Scsi_Host *shost = class_to_shost(dev); |
147 | int res; | 149 | int res; |
148 | 150 | ||
149 | res = scsi_scan(shost, buf); | 151 | res = scsi_scan(shost, buf); |
@@ -151,13 +153,14 @@ static ssize_t store_scan(struct class_device *class_dev, const char *buf, | |||
151 | res = count; | 153 | res = count; |
152 | return res; | 154 | return res; |
153 | }; | 155 | }; |
154 | static CLASS_DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); | 156 | static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan); |
155 | 157 | ||
156 | static ssize_t | 158 | static ssize_t |
157 | store_shost_state(struct class_device *class_dev, const char *buf, size_t count) | 159 | store_shost_state(struct device *dev, struct device_attribute *attr, |
160 | const char *buf, size_t count) | ||
158 | { | 161 | { |
159 | int i; | 162 | int i; |
160 | struct Scsi_Host *shost = class_to_shost(class_dev); | 163 | struct Scsi_Host *shost = class_to_shost(dev); |
161 | enum scsi_host_state state = 0; | 164 | enum scsi_host_state state = 0; |
162 | 165 | ||
163 | for (i = 0; i < ARRAY_SIZE(shost_states); i++) { | 166 | for (i = 0; i < ARRAY_SIZE(shost_states); i++) { |
@@ -177,9 +180,9 @@ store_shost_state(struct class_device *class_dev, const char *buf, size_t count) | |||
177 | } | 180 | } |
178 | 181 | ||
179 | static ssize_t | 182 | static ssize_t |
180 | show_shost_state(struct class_device *class_dev, char *buf) | 183 | show_shost_state(struct device *dev, struct device_attribute *attr, char *buf) |
181 | { | 184 | { |
182 | struct Scsi_Host *shost = class_to_shost(class_dev); | 185 | struct Scsi_Host *shost = class_to_shost(dev); |
183 | const char *name = scsi_host_state_name(shost->shost_state); | 186 | const char *name = scsi_host_state_name(shost->shost_state); |
184 | 187 | ||
185 | if (!name) | 188 | if (!name) |
@@ -188,7 +191,9 @@ show_shost_state(struct class_device *class_dev, char *buf) | |||
188 | return snprintf(buf, 20, "%s\n", name); | 191 | return snprintf(buf, 20, "%s\n", name); |
189 | } | 192 | } |
190 | 193 | ||
191 | static CLASS_DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); | 194 | /* DEVICE_ATTR(state) clashes with dev_attr_state for sdev */ |
195 | struct device_attribute dev_attr_hstate = | ||
196 | __ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state); | ||
192 | 197 | ||
193 | static ssize_t | 198 | static ssize_t |
194 | show_shost_mode(unsigned int mode, char *buf) | 199 | show_shost_mode(unsigned int mode, char *buf) |
@@ -206,9 +211,11 @@ show_shost_mode(unsigned int mode, char *buf) | |||
206 | return len; | 211 | return len; |
207 | } | 212 | } |
208 | 213 | ||
209 | static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *buf) | 214 | static ssize_t |
215 | show_shost_supported_mode(struct device *dev, struct device_attribute *attr, | ||
216 | char *buf) | ||
210 | { | 217 | { |
211 | struct Scsi_Host *shost = class_to_shost(class_dev); | 218 | struct Scsi_Host *shost = class_to_shost(dev); |
212 | unsigned int supported_mode = shost->hostt->supported_mode; | 219 | unsigned int supported_mode = shost->hostt->supported_mode; |
213 | 220 | ||
214 | if (supported_mode == MODE_UNKNOWN) | 221 | if (supported_mode == MODE_UNKNOWN) |
@@ -218,11 +225,13 @@ static ssize_t show_shost_supported_mode(struct class_device *class_dev, char *b | |||
218 | return show_shost_mode(supported_mode, buf); | 225 | return show_shost_mode(supported_mode, buf); |
219 | } | 226 | } |
220 | 227 | ||
221 | static CLASS_DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); | 228 | static DEVICE_ATTR(supported_mode, S_IRUGO | S_IWUSR, show_shost_supported_mode, NULL); |
222 | 229 | ||
223 | static ssize_t show_shost_active_mode(struct class_device *class_dev, char *buf) | 230 | static ssize_t |
231 | show_shost_active_mode(struct device *dev, | ||
232 | struct device_attribute *attr, char *buf) | ||
224 | { | 233 | { |
225 | struct Scsi_Host *shost = class_to_shost(class_dev); | 234 | struct Scsi_Host *shost = class_to_shost(dev); |
226 | 235 | ||
227 | if (shost->active_mode == MODE_UNKNOWN) | 236 | if (shost->active_mode == MODE_UNKNOWN) |
228 | return snprintf(buf, 20, "unknown\n"); | 237 | return snprintf(buf, 20, "unknown\n"); |
@@ -230,7 +239,7 @@ static ssize_t show_shost_active_mode(struct class_device *class_dev, char *buf) | |||
230 | return show_shost_mode(shost->active_mode, buf); | 239 | return show_shost_mode(shost->active_mode, buf); |
231 | } | 240 | } |
232 | 241 | ||
233 | static CLASS_DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); | 242 | static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); |
234 | 243 | ||
235 | shost_rd_attr(unique_id, "%u\n"); | 244 | shost_rd_attr(unique_id, "%u\n"); |
236 | shost_rd_attr(host_busy, "%hu\n"); | 245 | shost_rd_attr(host_busy, "%hu\n"); |
@@ -240,22 +249,22 @@ shost_rd_attr(sg_tablesize, "%hu\n"); | |||
240 | shost_rd_attr(unchecked_isa_dma, "%d\n"); | 249 | shost_rd_attr(unchecked_isa_dma, "%d\n"); |
241 | shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); | 250 | shost_rd_attr2(proc_name, hostt->proc_name, "%s\n"); |
242 | 251 | ||
243 | static struct class_device_attribute *scsi_sysfs_shost_attrs[] = { | 252 | static struct device_attribute *scsi_sysfs_shost_attrs[] = { |
244 | &class_device_attr_unique_id, | 253 | &dev_attr_unique_id, |
245 | &class_device_attr_host_busy, | 254 | &dev_attr_host_busy, |
246 | &class_device_attr_cmd_per_lun, | 255 | &dev_attr_cmd_per_lun, |
247 | &class_device_attr_can_queue, | 256 | &dev_attr_can_queue, |
248 | &class_device_attr_sg_tablesize, | 257 | &dev_attr_sg_tablesize, |
249 | &class_device_attr_unchecked_isa_dma, | 258 | &dev_attr_unchecked_isa_dma, |
250 | &class_device_attr_proc_name, | 259 | &dev_attr_proc_name, |
251 | &class_device_attr_scan, | 260 | &dev_attr_scan, |
252 | &class_device_attr_state, | 261 | &dev_attr_hstate, |
253 | &class_device_attr_supported_mode, | 262 | &dev_attr_supported_mode, |
254 | &class_device_attr_active_mode, | 263 | &dev_attr_active_mode, |
255 | NULL | 264 | NULL |
256 | }; | 265 | }; |
257 | 266 | ||
258 | static void scsi_device_cls_release(struct class_device *class_dev) | 267 | static void scsi_device_cls_release(struct device *class_dev) |
259 | { | 268 | { |
260 | struct scsi_device *sdev; | 269 | struct scsi_device *sdev; |
261 | 270 | ||
@@ -320,7 +329,7 @@ static void scsi_device_dev_release(struct device *dev) | |||
320 | 329 | ||
321 | static struct class sdev_class = { | 330 | static struct class sdev_class = { |
322 | .name = "scsi_device", | 331 | .name = "scsi_device", |
323 | .release = scsi_device_cls_release, | 332 | .dev_release = scsi_device_cls_release, |
324 | }; | 333 | }; |
325 | 334 | ||
326 | /* all probing is done in the individual ->probe routines */ | 335 | /* all probing is done in the individual ->probe routines */ |
@@ -424,7 +433,8 @@ void scsi_sysfs_unregister(void) | |||
424 | */ | 433 | */ |
425 | #define sdev_show_function(field, format_string) \ | 434 | #define sdev_show_function(field, format_string) \ |
426 | static ssize_t \ | 435 | static ssize_t \ |
427 | sdev_show_##field (struct device *dev, struct device_attribute *attr, char *buf) \ | 436 | sdev_show_##field (struct device *dev, struct device_attribute *attr, \ |
437 | char *buf) \ | ||
428 | { \ | 438 | { \ |
429 | struct scsi_device *sdev; \ | 439 | struct scsi_device *sdev; \ |
430 | sdev = to_scsi_device(dev); \ | 440 | sdev = to_scsi_device(dev); \ |
@@ -448,7 +458,8 @@ static DEVICE_ATTR(field, S_IRUGO, sdev_show_##field, NULL); | |||
448 | sdev_show_function(field, format_string) \ | 458 | sdev_show_function(field, format_string) \ |
449 | \ | 459 | \ |
450 | static ssize_t \ | 460 | static ssize_t \ |
451 | sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ | 461 | sdev_store_##field (struct device *dev, struct device_attribute *attr, \ |
462 | const char *buf, size_t count) \ | ||
452 | { \ | 463 | { \ |
453 | struct scsi_device *sdev; \ | 464 | struct scsi_device *sdev; \ |
454 | sdev = to_scsi_device(dev); \ | 465 | sdev = to_scsi_device(dev); \ |
@@ -468,7 +479,8 @@ static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##fie | |||
468 | sdev_show_function(field, "%d\n") \ | 479 | sdev_show_function(field, "%d\n") \ |
469 | \ | 480 | \ |
470 | static ssize_t \ | 481 | static ssize_t \ |
471 | sdev_store_##field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \ | 482 | sdev_store_##field (struct device *dev, struct device_attribute *attr, \ |
483 | const char *buf, size_t count) \ | ||
472 | { \ | 484 | { \ |
473 | int ret; \ | 485 | int ret; \ |
474 | struct scsi_device *sdev; \ | 486 | struct scsi_device *sdev; \ |
@@ -519,7 +531,8 @@ sdev_show_timeout (struct device *dev, struct device_attribute *attr, char *buf) | |||
519 | } | 531 | } |
520 | 532 | ||
521 | static ssize_t | 533 | static ssize_t |
522 | sdev_store_timeout (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 534 | sdev_store_timeout (struct device *dev, struct device_attribute *attr, |
535 | const char *buf, size_t count) | ||
523 | { | 536 | { |
524 | struct scsi_device *sdev; | 537 | struct scsi_device *sdev; |
525 | int timeout; | 538 | int timeout; |
@@ -531,7 +544,8 @@ sdev_store_timeout (struct device *dev, struct device_attribute *attr, const cha | |||
531 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); | 544 | static DEVICE_ATTR(timeout, S_IRUGO | S_IWUSR, sdev_show_timeout, sdev_store_timeout); |
532 | 545 | ||
533 | static ssize_t | 546 | static ssize_t |
534 | store_rescan_field (struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 547 | store_rescan_field (struct device *dev, struct device_attribute *attr, |
548 | const char *buf, size_t count) | ||
535 | { | 549 | { |
536 | scsi_rescan_device(dev); | 550 | scsi_rescan_device(dev); |
537 | return count; | 551 | return count; |
@@ -543,8 +557,9 @@ static void sdev_store_delete_callback(struct device *dev) | |||
543 | scsi_remove_device(to_scsi_device(dev)); | 557 | scsi_remove_device(to_scsi_device(dev)); |
544 | } | 558 | } |
545 | 559 | ||
546 | static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *attr, const char *buf, | 560 | static ssize_t |
547 | size_t count) | 561 | sdev_store_delete(struct device *dev, struct device_attribute *attr, |
562 | const char *buf, size_t count) | ||
548 | { | 563 | { |
549 | int rc; | 564 | int rc; |
550 | 565 | ||
@@ -559,7 +574,8 @@ static ssize_t sdev_store_delete(struct device *dev, struct device_attribute *at | |||
559 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); | 574 | static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete); |
560 | 575 | ||
561 | static ssize_t | 576 | static ssize_t |
562 | store_state_field(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 577 | store_state_field(struct device *dev, struct device_attribute *attr, |
578 | const char *buf, size_t count) | ||
563 | { | 579 | { |
564 | int i; | 580 | int i; |
565 | struct scsi_device *sdev = to_scsi_device(dev); | 581 | struct scsi_device *sdev = to_scsi_device(dev); |
@@ -596,7 +612,8 @@ show_state_field(struct device *dev, struct device_attribute *attr, char *buf) | |||
596 | static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); | 612 | static DEVICE_ATTR(state, S_IRUGO | S_IWUSR, show_state_field, store_state_field); |
597 | 613 | ||
598 | static ssize_t | 614 | static ssize_t |
599 | show_queue_type_field(struct device *dev, struct device_attribute *attr, char *buf) | 615 | show_queue_type_field(struct device *dev, struct device_attribute *attr, |
616 | char *buf) | ||
600 | { | 617 | { |
601 | struct scsi_device *sdev = to_scsi_device(dev); | 618 | struct scsi_device *sdev = to_scsi_device(dev); |
602 | const char *name = "none"; | 619 | const char *name = "none"; |
@@ -612,7 +629,7 @@ show_queue_type_field(struct device *dev, struct device_attribute *attr, char *b | |||
612 | static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); | 629 | static DEVICE_ATTR(queue_type, S_IRUGO, show_queue_type_field, NULL); |
613 | 630 | ||
614 | static ssize_t | 631 | static ssize_t |
615 | show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf) | 632 | show_iostat_counterbits(struct device *dev, struct device_attribute *attr, char *buf) |
616 | { | 633 | { |
617 | return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8); | 634 | return snprintf(buf, 20, "%d\n", (int)sizeof(atomic_t) * 8); |
618 | } | 635 | } |
@@ -621,7 +638,8 @@ static DEVICE_ATTR(iocounterbits, S_IRUGO, show_iostat_counterbits, NULL); | |||
621 | 638 | ||
622 | #define show_sdev_iostat(field) \ | 639 | #define show_sdev_iostat(field) \ |
623 | static ssize_t \ | 640 | static ssize_t \ |
624 | show_iostat_##field(struct device *dev, struct device_attribute *attr, char *buf) \ | 641 | show_iostat_##field(struct device *dev, struct device_attribute *attr, \ |
642 | char *buf) \ | ||
625 | { \ | 643 | { \ |
626 | struct scsi_device *sdev = to_scsi_device(dev); \ | 644 | struct scsi_device *sdev = to_scsi_device(dev); \ |
627 | unsigned long long count = atomic_read(&sdev->field); \ | 645 | unsigned long long count = atomic_read(&sdev->field); \ |
@@ -645,7 +663,7 @@ static DEVICE_ATTR(modalias, S_IRUGO, sdev_show_modalias, NULL); | |||
645 | #define DECLARE_EVT_SHOW(name, Cap_name) \ | 663 | #define DECLARE_EVT_SHOW(name, Cap_name) \ |
646 | static ssize_t \ | 664 | static ssize_t \ |
647 | sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ | 665 | sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ |
648 | char *buf) \ | 666 | char *buf) \ |
649 | { \ | 667 | { \ |
650 | struct scsi_device *sdev = to_scsi_device(dev); \ | 668 | struct scsi_device *sdev = to_scsi_device(dev); \ |
651 | int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ | 669 | int val = test_bit(SDEV_EVT_##Cap_name, sdev->supported_events);\ |
@@ -654,7 +672,7 @@ sdev_show_evt_##name(struct device *dev, struct device_attribute *attr, \ | |||
654 | 672 | ||
655 | #define DECLARE_EVT_STORE(name, Cap_name) \ | 673 | #define DECLARE_EVT_STORE(name, Cap_name) \ |
656 | static ssize_t \ | 674 | static ssize_t \ |
657 | sdev_store_evt_##name(struct device *dev, struct device_attribute *attr, \ | 675 | sdev_store_evt_##name(struct device *dev, struct device_attribute *attr,\ |
658 | const char *buf, size_t count) \ | 676 | const char *buf, size_t count) \ |
659 | { \ | 677 | { \ |
660 | struct scsi_device *sdev = to_scsi_device(dev); \ | 678 | struct scsi_device *sdev = to_scsi_device(dev); \ |
@@ -707,8 +725,9 @@ static struct attribute_group *scsi_sdev_attr_groups[] = { | |||
707 | NULL | 725 | NULL |
708 | }; | 726 | }; |
709 | 727 | ||
710 | static ssize_t sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, const char *buf, | 728 | static ssize_t |
711 | size_t count) | 729 | sdev_store_queue_depth_rw(struct device *dev, struct device_attribute *attr, |
730 | const char *buf, size_t count) | ||
712 | { | 731 | { |
713 | int depth, retval; | 732 | int depth, retval; |
714 | struct scsi_device *sdev = to_scsi_device(dev); | 733 | struct scsi_device *sdev = to_scsi_device(dev); |
@@ -733,8 +752,9 @@ static struct device_attribute sdev_attr_queue_depth_rw = | |||
733 | __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth, | 752 | __ATTR(queue_depth, S_IRUGO | S_IWUSR, sdev_show_queue_depth, |
734 | sdev_store_queue_depth_rw); | 753 | sdev_store_queue_depth_rw); |
735 | 754 | ||
736 | static ssize_t sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr, const char *buf, | 755 | static ssize_t |
737 | size_t count) | 756 | sdev_store_queue_type_rw(struct device *dev, struct device_attribute *attr, |
757 | const char *buf, size_t count) | ||
738 | { | 758 | { |
739 | struct scsi_device *sdev = to_scsi_device(dev); | 759 | struct scsi_device *sdev = to_scsi_device(dev); |
740 | struct scsi_host_template *sht = sdev->host->hostt; | 760 | struct scsi_host_template *sht = sdev->host->hostt; |
@@ -786,13 +806,13 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) | |||
786 | printk(KERN_INFO "error 1\n"); | 806 | printk(KERN_INFO "error 1\n"); |
787 | return error; | 807 | return error; |
788 | } | 808 | } |
789 | error = class_device_add(&sdev->sdev_classdev); | 809 | error = device_add(&sdev->sdev_dev); |
790 | if (error) { | 810 | if (error) { |
791 | printk(KERN_INFO "error 2\n"); | 811 | printk(KERN_INFO "error 2\n"); |
792 | goto clean_device; | 812 | goto clean_device; |
793 | } | 813 | } |
794 | 814 | ||
795 | /* take a reference for the sdev_classdev; this is | 815 | /* take a reference for the sdev_dev; this is |
796 | * released by the sdev_class .release */ | 816 | * released by the sdev_class .release */ |
797 | get_device(&sdev->sdev_gendev); | 817 | get_device(&sdev->sdev_gendev); |
798 | 818 | ||
@@ -858,7 +878,7 @@ void __scsi_remove_device(struct scsi_device *sdev) | |||
858 | return; | 878 | return; |
859 | 879 | ||
860 | bsg_unregister_queue(sdev->request_queue); | 880 | bsg_unregister_queue(sdev->request_queue); |
861 | class_device_unregister(&sdev->sdev_classdev); | 881 | device_unregister(&sdev->sdev_dev); |
862 | transport_remove_device(dev); | 882 | transport_remove_device(dev); |
863 | device_del(dev); | 883 | device_del(dev); |
864 | scsi_device_set_state(sdev, SDEV_DEL); | 884 | scsi_device_set_state(sdev, SDEV_DEL); |
@@ -952,9 +972,9 @@ int scsi_register_interface(struct class_interface *intf) | |||
952 | EXPORT_SYMBOL(scsi_register_interface); | 972 | EXPORT_SYMBOL(scsi_register_interface); |
953 | 973 | ||
954 | 974 | ||
955 | static struct class_device_attribute *class_attr_overridden( | 975 | static struct device_attribute *class_attr_overridden( |
956 | struct class_device_attribute **attrs, | 976 | struct device_attribute **attrs, |
957 | struct class_device_attribute *attr) | 977 | struct device_attribute *attr) |
958 | { | 978 | { |
959 | int i; | 979 | int i; |
960 | 980 | ||
@@ -966,10 +986,10 @@ static struct class_device_attribute *class_attr_overridden( | |||
966 | return NULL; | 986 | return NULL; |
967 | } | 987 | } |
968 | 988 | ||
969 | static int class_attr_add(struct class_device *classdev, | 989 | static int class_attr_add(struct device *classdev, |
970 | struct class_device_attribute *attr) | 990 | struct device_attribute *attr) |
971 | { | 991 | { |
972 | struct class_device_attribute *base_attr; | 992 | struct device_attribute *base_attr; |
973 | 993 | ||
974 | /* | 994 | /* |
975 | * Spare the caller from having to copy things it's not interested in. | 995 | * Spare the caller from having to copy things it's not interested in. |
@@ -986,7 +1006,7 @@ static int class_attr_add(struct class_device *classdev, | |||
986 | attr->store = base_attr->store; | 1006 | attr->store = base_attr->store; |
987 | } | 1007 | } |
988 | 1008 | ||
989 | return class_device_create_file(classdev, attr); | 1009 | return device_create_file(classdev, attr); |
990 | } | 1010 | } |
991 | 1011 | ||
992 | /** | 1012 | /** |
@@ -1000,7 +1020,7 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost) | |||
1000 | 1020 | ||
1001 | if (shost->hostt->shost_attrs) { | 1021 | if (shost->hostt->shost_attrs) { |
1002 | for (i = 0; shost->hostt->shost_attrs[i]; i++) { | 1022 | for (i = 0; shost->hostt->shost_attrs[i]; i++) { |
1003 | error = class_attr_add(&shost->shost_classdev, | 1023 | error = class_attr_add(&shost->shost_dev, |
1004 | shost->hostt->shost_attrs[i]); | 1024 | shost->hostt->shost_attrs[i]); |
1005 | if (error) | 1025 | if (error) |
1006 | return error; | 1026 | return error; |
@@ -1010,7 +1030,7 @@ int scsi_sysfs_add_host(struct Scsi_Host *shost) | |||
1010 | for (i = 0; scsi_sysfs_shost_attrs[i]; i++) { | 1030 | for (i = 0; scsi_sysfs_shost_attrs[i]; i++) { |
1011 | if (!class_attr_overridden(shost->hostt->shost_attrs, | 1031 | if (!class_attr_overridden(shost->hostt->shost_attrs, |
1012 | scsi_sysfs_shost_attrs[i])) { | 1032 | scsi_sysfs_shost_attrs[i])) { |
1013 | error = class_device_create_file(&shost->shost_classdev, | 1033 | error = device_create_file(&shost->shost_dev, |
1014 | scsi_sysfs_shost_attrs[i]); | 1034 | scsi_sysfs_shost_attrs[i]); |
1015 | if (error) | 1035 | if (error) |
1016 | return error; | 1036 | return error; |
@@ -1041,10 +1061,10 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev) | |||
1041 | sdev->host->host_no, sdev->channel, sdev->id, | 1061 | sdev->host->host_no, sdev->channel, sdev->id, |
1042 | sdev->lun); | 1062 | sdev->lun); |
1043 | 1063 | ||
1044 | class_device_initialize(&sdev->sdev_classdev); | 1064 | device_initialize(&sdev->sdev_dev); |
1045 | sdev->sdev_classdev.dev = &sdev->sdev_gendev; | 1065 | sdev->sdev_dev.parent = &sdev->sdev_gendev; |
1046 | sdev->sdev_classdev.class = &sdev_class; | 1066 | sdev->sdev_dev.class = &sdev_class; |
1047 | snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE, | 1067 | snprintf(sdev->sdev_dev.bus_id, BUS_ID_SIZE, |
1048 | "%d:%d:%d:%d", sdev->host->host_no, | 1068 | "%d:%d:%d:%d", sdev->host->host_no, |
1049 | sdev->channel, sdev->id, sdev->lun); | 1069 | sdev->channel, sdev->id, sdev->lun); |
1050 | sdev->scsi_level = starget->scsi_level; | 1070 | sdev->scsi_level = starget->scsi_level; |
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) \ |
76 | struct class_device_attribute class_device_attr_##_prefix##_##_name = \ | 76 | struct 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 | ||
347 | static int fc_target_setup(struct transport_container *tc, struct device *dev, | 347 | static 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 | ||
377 | static int fc_host_setup(struct transport_container *tc, struct device *dev, | 377 | static 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) \ |
684 | static ssize_t \ | 684 | static ssize_t \ |
685 | show_fc_rport_##field (struct class_device *cdev, char *buf) \ | 685 | show_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) \ |
699 | static ssize_t \ | 700 | static ssize_t \ |
700 | store_fc_rport_##field(struct class_device *cdev, const char *buf, \ | 701 | store_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, ) \ |
721 | static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ | 723 | static 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)) \ |
726 | static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ | 728 | static 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) \ |
732 | static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO | S_IWUSR, \ | 734 | static 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) \ |
738 | static ssize_t \ | 740 | static ssize_t \ |
739 | show_fc_rport_##field (struct class_device *cdev, char *buf) \ | 741 | show_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, ) \ |
747 | static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ | 750 | static 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)) \ |
752 | static FC_CLASS_DEVICE_ATTR(rport, field, S_IRUGO, \ | 755 | static 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) \ |
757 | static ssize_t \ | 760 | static ssize_t \ |
758 | show_fc_rport_##title (struct class_device *cdev, char *buf) \ | 761 | show_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 | } \ |
767 | static FC_CLASS_DEVICE_ATTR(rport, title, S_IRUGO, \ | 771 | static 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, \ | |||
808 | fc_private_rport_rd_attr(maxframe_size, "%u bytes\n", 20); | 812 | fc_private_rport_rd_attr(maxframe_size, "%u bytes\n", 20); |
809 | 813 | ||
810 | static ssize_t | 814 | static ssize_t |
811 | show_fc_rport_supported_classes (struct class_device *cdev, char *buf) | 815 | show_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 | } |
818 | static FC_CLASS_DEVICE_ATTR(rport, supported_classes, S_IRUGO, | 823 | static 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 | */ |
826 | fc_rport_show_function(dev_loss_tmo, "%d\n", 20, ) | 831 | fc_rport_show_function(dev_loss_tmo, "%d\n", 20, ) |
827 | static ssize_t | 832 | static ssize_t |
828 | store_fc_rport_dev_loss_tmo(struct class_device *cdev, const char *buf, | 833 | store_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 | } |
847 | static FC_CLASS_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR, | 852 | static 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); | |||
855 | fc_private_rport_rd_attr(port_id, "0x%06x\n", 20); | 860 | fc_private_rport_rd_attr(port_id, "0x%06x\n", 20); |
856 | 861 | ||
857 | static ssize_t | 862 | static ssize_t |
858 | show_fc_rport_roles (struct class_device *cdev, char *buf) | 863 | show_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 | } |
886 | static FC_CLASS_DEVICE_ATTR(rport, roles, S_IRUGO, | 892 | static FC_DEVICE_ATTR(rport, roles, S_IRUGO, |
887 | show_fc_rport_roles, NULL); | 893 | show_fc_rport_roles, NULL); |
888 | 894 | ||
889 | fc_private_rport_rd_enum_attr(port_state, FC_PORTSTATE_MAX_NAMELEN); | 895 | 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); | |||
893 | * fast_io_fail_tmo attribute | 899 | * fast_io_fail_tmo attribute |
894 | */ | 900 | */ |
895 | static ssize_t | 901 | static ssize_t |
896 | show_fc_rport_fast_io_fail_tmo (struct class_device *cdev, char *buf) | 902 | show_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 | ||
905 | static ssize_t | 912 | static ssize_t |
906 | store_fc_rport_fast_io_fail_tmo(struct class_device *cdev, const char *buf, | 913 | store_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 | } |
928 | static FC_CLASS_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, | 936 | static 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) \ |
943 | static ssize_t \ | 951 | static ssize_t \ |
944 | show_fc_starget_##field (struct class_device *cdev, char *buf) \ | 952 | show_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, ) \ |
960 | static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ | 969 | static 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)) \ |
965 | static FC_CLASS_DEVICE_ATTR(starget, field, S_IRUGO, \ | 974 | static 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) \ |
997 | static ssize_t \ | 1006 | static ssize_t \ |
998 | show_fc_vport_##field (struct class_device *cdev, char *buf) \ | 1007 | show_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) \ |
1010 | static ssize_t \ | 1020 | static ssize_t \ |
1011 | store_fc_vport_##field(struct class_device *cdev, const char *buf, \ | 1021 | store_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) \ |
1029 | static ssize_t \ | 1040 | static ssize_t \ |
1030 | store_fc_vport_##field(struct class_device *cdev, const char *buf, \ | 1041 | store_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, ) \ |
1050 | static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ | 1062 | static 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)) \ |
1055 | static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ | 1067 | static 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) \ |
1061 | static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ | 1073 | static 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) \ |
1066 | static ssize_t \ | 1078 | static ssize_t \ |
1067 | show_fc_vport_##field (struct class_device *cdev, char *buf) \ | 1079 | show_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) \ |
1074 | static ssize_t \ | 1087 | static ssize_t \ |
1075 | store_fc_vport_##field(struct class_device *cdev, const char *buf, \ | 1088 | store_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, ) \ |
1093 | static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ | 1107 | static 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)) \ |
1098 | static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO, \ | 1112 | static 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) \ |
1104 | static FC_CLASS_DEVICE_ATTR(vport, field, S_IRUGO | S_IWUSR, \ | 1118 | static 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) \ |
1110 | static ssize_t \ | 1124 | static ssize_t \ |
1111 | show_fc_vport_##title (struct class_device *cdev, char *buf) \ | 1125 | show_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 | } \ |
1120 | static FC_CLASS_DEVICE_ATTR(vport, title, S_IRUGO, \ | 1136 | static 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); | |||
1176 | fc_private_vport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); | 1192 | fc_private_vport_rd_attr_cast(port_name, "0x%llx\n", 20, unsigned long long); |
1177 | 1193 | ||
1178 | static ssize_t | 1194 | static ssize_t |
1179 | show_fc_vport_roles (struct class_device *cdev, char *buf) | 1195 | show_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 | } |
1187 | static FC_CLASS_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); | 1204 | static FC_DEVICE_ATTR(vport, roles, S_IRUGO, show_fc_vport_roles, NULL); |
1188 | 1205 | ||
1189 | fc_private_vport_rd_enum_attr(vport_type, FC_PORTTYPE_MAX_NAMELEN); | 1206 | fc_private_vport_rd_enum_attr(vport_type, FC_PORTTYPE_MAX_NAMELEN); |
1190 | 1207 | ||
1191 | fc_private_vport_show_function(symbolic_name, "%s\n", | 1208 | fc_private_vport_show_function(symbolic_name, "%s\n", |
1192 | FC_VPORT_SYMBOLIC_NAMELEN + 1, ) | 1209 | FC_VPORT_SYMBOLIC_NAMELEN + 1, ) |
1193 | fc_vport_store_str_function(symbolic_name, FC_VPORT_SYMBOLIC_NAMELEN) | 1210 | fc_vport_store_str_function(symbolic_name, FC_VPORT_SYMBOLIC_NAMELEN) |
1194 | static FC_CLASS_DEVICE_ATTR(vport, symbolic_name, S_IRUGO | S_IWUSR, | 1211 | static 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 | ||
1197 | static ssize_t | 1214 | static ssize_t |
1198 | store_fc_vport_delete(struct class_device *cdev, const char *buf, | 1215 | store_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 | } |
1207 | static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, | 1224 | static 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 | */ |
1215 | static ssize_t | 1232 | static ssize_t |
1216 | store_fc_vport_disable(struct class_device *cdev, const char *buf, | 1233 | store_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 | } |
1239 | static FC_CLASS_DEVICE_ATTR(vport, vport_disable, S_IWUSR, | 1257 | static 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) \ |
1248 | static ssize_t \ | 1266 | static ssize_t \ |
1249 | show_fc_host_##field (struct class_device *cdev, char *buf) \ | 1267 | show_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) \ |
1259 | static ssize_t \ | 1278 | static ssize_t \ |
1260 | store_fc_host_##field(struct class_device *cdev, const char *buf, \ | 1279 | store_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) \ |
1276 | static ssize_t \ | 1296 | static ssize_t \ |
1277 | store_fc_host_##field(struct class_device *cdev, const char *buf, \ | 1297 | store_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, ) \ |
1296 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ | 1317 | static 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)) \ |
1301 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ | 1322 | static 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) \ |
1307 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO | S_IWUSR, \ | 1328 | static 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) \ |
1312 | static ssize_t \ | 1333 | static ssize_t \ |
1313 | show_fc_host_##title (struct class_device *cdev, char *buf) \ | 1334 | show_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 | } \ |
1325 | static FC_CLASS_DEVICE_ATTR(host, title, S_IRUGO, show_fc_host_##title, NULL) | 1347 | static 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) \ |
1354 | static ssize_t \ | 1376 | static ssize_t \ |
1355 | show_fc_host_##field (struct class_device *cdev, char *buf) \ | 1377 | show_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, ) \ |
1363 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ | 1386 | static 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)) \ |
1368 | static FC_CLASS_DEVICE_ATTR(host, field, S_IRUGO, \ | 1391 | static 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 | ||
1388 | static ssize_t | 1411 | static ssize_t |
1389 | show_fc_host_supported_classes (struct class_device *cdev, char *buf) | 1412 | show_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 | } |
1398 | static FC_CLASS_DEVICE_ATTR(host, supported_classes, S_IRUGO, | 1422 | static FC_DEVICE_ATTR(host, supported_classes, S_IRUGO, |
1399 | show_fc_host_supported_classes, NULL); | 1423 | show_fc_host_supported_classes, NULL); |
1400 | 1424 | ||
1401 | static ssize_t | 1425 | static ssize_t |
1402 | show_fc_host_supported_fc4s (struct class_device *cdev, char *buf) | 1426 | show_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 | } |
1407 | static FC_CLASS_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, | 1432 | static FC_DEVICE_ATTR(host, supported_fc4s, S_IRUGO, |
1408 | show_fc_host_supported_fc4s, NULL); | 1433 | show_fc_host_supported_fc4s, NULL); |
1409 | 1434 | ||
1410 | static ssize_t | 1435 | static ssize_t |
1411 | show_fc_host_supported_speeds (struct class_device *cdev, char *buf) | 1436 | show_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 | } |
1420 | static FC_CLASS_DEVICE_ATTR(host, supported_speeds, S_IRUGO, | 1446 | static 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 | ||
1435 | static ssize_t | 1461 | static ssize_t |
1436 | show_fc_host_active_fc4s (struct class_device *cdev, char *buf) | 1462 | show_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 | } |
1446 | static FC_CLASS_DEVICE_ATTR(host, active_fc4s, S_IRUGO, | 1473 | static FC_DEVICE_ATTR(host, active_fc4s, S_IRUGO, |
1447 | show_fc_host_active_fc4s, NULL); | 1474 | show_fc_host_active_fc4s, NULL); |
1448 | 1475 | ||
1449 | static ssize_t | 1476 | static ssize_t |
1450 | show_fc_host_speed (struct class_device *cdev, char *buf) | 1477 | show_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 | } |
1463 | static FC_CLASS_DEVICE_ATTR(host, speed, S_IRUGO, | 1491 | static 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); | |||
1473 | fc_private_host_show_function(system_hostname, "%s\n", | 1501 | fc_private_host_show_function(system_hostname, "%s\n", |
1474 | FC_SYMBOLIC_NAME_SIZE + 1, ) | 1502 | FC_SYMBOLIC_NAME_SIZE + 1, ) |
1475 | fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE) | 1503 | fc_host_store_str_function(system_hostname, FC_SYMBOLIC_NAME_SIZE) |
1476 | static FC_CLASS_DEVICE_ATTR(host, system_hostname, S_IRUGO | S_IWUSR, | 1504 | static 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 | ||
1482 | static ssize_t | 1510 | static ssize_t |
1483 | show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) | 1511 | show_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 | ||
1497 | static ssize_t | 1526 | static ssize_t |
1498 | store_fc_private_host_tgtid_bind_type(struct class_device *cdev, | 1527 | store_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 | ||
1526 | static FC_CLASS_DEVICE_ATTR(host, tgtid_bind_type, S_IRUGO | S_IWUSR, | 1555 | static 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 | ||
1530 | static ssize_t | 1559 | static ssize_t |
1531 | store_fc_private_host_issue_lip(struct class_device *cdev, | 1560 | store_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 | ||
1547 | static FC_CLASS_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL, | 1576 | static 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 | ||
1550 | fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20); | 1579 | 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); | |||
1556 | 1585 | ||
1557 | /* Show a given an attribute in the statistics group */ | 1586 | /* Show a given an attribute in the statistics group */ |
1558 | static ssize_t | 1587 | static ssize_t |
1559 | fc_stat_show(const struct class_device *cdev, char *buf, unsigned long offset) | 1588 | fc_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) \ |
1582 | static ssize_t show_fcstat_##name(struct class_device *cd, char *buf) \ | 1611 | static 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 | } \ |
1587 | static FC_CLASS_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) | 1618 | static FC_DEVICE_ATTR(host, name, S_IRUGO, show_fcstat_##name, NULL) |
1588 | 1619 | ||
1589 | fc_host_statistic(seconds_since_last_reset); | 1620 | fc_host_statistic(seconds_since_last_reset); |
1590 | fc_host_statistic(tx_frames); | 1621 | fc_host_statistic(tx_frames); |
@@ -1608,10 +1639,10 @@ fc_host_statistic(fcp_input_megabytes); | |||
1608 | fc_host_statistic(fcp_output_megabytes); | 1639 | fc_host_statistic(fcp_output_megabytes); |
1609 | 1640 | ||
1610 | static ssize_t | 1641 | static ssize_t |
1611 | fc_reset_statistics(struct class_device *cdev, const char *buf, | 1642 | fc_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 | } |
1625 | static FC_CLASS_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, | 1656 | static FC_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL, |
1626 | fc_reset_statistics); | 1657 | fc_reset_statistics); |
1627 | 1658 | ||
1628 | static struct attribute *fc_statistics_attrs[] = { | 1659 | static 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 | */ |
1697 | static ssize_t | 1728 | static ssize_t |
1698 | store_fc_host_vport_create(struct class_device *cdev, const char *buf, | 1729 | store_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 | } |
1734 | static FC_CLASS_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, | 1765 | static 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 | */ |
1744 | static ssize_t | 1775 | static ssize_t |
1745 | store_fc_host_vport_delete(struct class_device *cdev, const char *buf, | 1776 | store_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 | } |
1790 | static FC_CLASS_DEVICE_ATTR(host, vport_delete, S_IWUSR, NULL, | 1821 | static 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 | ||
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index ca7bb6f63bde..65d1737eb664 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -40,13 +40,13 @@ struct iscsi_internal { | |||
40 | struct scsi_transport_template t; | 40 | struct scsi_transport_template t; |
41 | struct iscsi_transport *iscsi_transport; | 41 | struct iscsi_transport *iscsi_transport; |
42 | struct list_head list; | 42 | struct list_head list; |
43 | struct class_device cdev; | 43 | struct device dev; |
44 | 44 | ||
45 | struct class_device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1]; | 45 | struct device_attribute *host_attrs[ISCSI_HOST_ATTRS + 1]; |
46 | struct transport_container conn_cont; | 46 | struct transport_container conn_cont; |
47 | struct class_device_attribute *conn_attrs[ISCSI_CONN_ATTRS + 1]; | 47 | struct device_attribute *conn_attrs[ISCSI_CONN_ATTRS + 1]; |
48 | struct transport_container session_cont; | 48 | struct transport_container session_cont; |
49 | struct class_device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1]; | 49 | struct device_attribute *session_attrs[ISCSI_SESSION_ATTRS + 1]; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ | 52 | static atomic_t iscsi_session_nr; /* sysfs session id for next new session */ |
@@ -63,12 +63,12 @@ static DEFINE_SPINLOCK(iscsi_transport_lock); | |||
63 | #define to_iscsi_internal(tmpl) \ | 63 | #define to_iscsi_internal(tmpl) \ |
64 | container_of(tmpl, struct iscsi_internal, t) | 64 | container_of(tmpl, struct iscsi_internal, t) |
65 | 65 | ||
66 | #define cdev_to_iscsi_internal(_cdev) \ | 66 | #define dev_to_iscsi_internal(_dev) \ |
67 | container_of(_cdev, struct iscsi_internal, cdev) | 67 | container_of(_dev, struct iscsi_internal, dev) |
68 | 68 | ||
69 | static void iscsi_transport_release(struct class_device *cdev) | 69 | static void iscsi_transport_release(struct device *dev) |
70 | { | 70 | { |
71 | struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); | 71 | struct iscsi_internal *priv = dev_to_iscsi_internal(dev); |
72 | kfree(priv); | 72 | kfree(priv); |
73 | } | 73 | } |
74 | 74 | ||
@@ -78,25 +78,27 @@ static void iscsi_transport_release(struct class_device *cdev) | |||
78 | */ | 78 | */ |
79 | static struct class iscsi_transport_class = { | 79 | static struct class iscsi_transport_class = { |
80 | .name = "iscsi_transport", | 80 | .name = "iscsi_transport", |
81 | .release = iscsi_transport_release, | 81 | .dev_release = iscsi_transport_release, |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static ssize_t | 84 | static ssize_t |
85 | show_transport_handle(struct class_device *cdev, char *buf) | 85 | show_transport_handle(struct device *dev, struct device_attribute *attr, |
86 | char *buf) | ||
86 | { | 87 | { |
87 | struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); | 88 | struct iscsi_internal *priv = dev_to_iscsi_internal(dev); |
88 | return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->iscsi_transport)); | 89 | return sprintf(buf, "%llu\n", (unsigned long long)iscsi_handle(priv->iscsi_transport)); |
89 | } | 90 | } |
90 | static CLASS_DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); | 91 | static DEVICE_ATTR(handle, S_IRUGO, show_transport_handle, NULL); |
91 | 92 | ||
92 | #define show_transport_attr(name, format) \ | 93 | #define show_transport_attr(name, format) \ |
93 | static ssize_t \ | 94 | static ssize_t \ |
94 | show_transport_##name(struct class_device *cdev, char *buf) \ | 95 | show_transport_##name(struct device *dev, \ |
96 | struct device_attribute *attr,char *buf) \ | ||
95 | { \ | 97 | { \ |
96 | struct iscsi_internal *priv = cdev_to_iscsi_internal(cdev); \ | 98 | struct iscsi_internal *priv = dev_to_iscsi_internal(dev); \ |
97 | return sprintf(buf, format"\n", priv->iscsi_transport->name); \ | 99 | return sprintf(buf, format"\n", priv->iscsi_transport->name); \ |
98 | } \ | 100 | } \ |
99 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL); | 101 | static DEVICE_ATTR(name, S_IRUGO, show_transport_##name, NULL); |
100 | 102 | ||
101 | show_transport_attr(caps, "0x%x"); | 103 | show_transport_attr(caps, "0x%x"); |
102 | show_transport_attr(max_lun, "%d"); | 104 | show_transport_attr(max_lun, "%d"); |
@@ -104,11 +106,11 @@ show_transport_attr(max_conn, "%d"); | |||
104 | show_transport_attr(max_cmd_len, "%d"); | 106 | show_transport_attr(max_cmd_len, "%d"); |
105 | 107 | ||
106 | static struct attribute *iscsi_transport_attrs[] = { | 108 | static struct attribute *iscsi_transport_attrs[] = { |
107 | &class_device_attr_handle.attr, | 109 | &dev_attr_handle.attr, |
108 | &class_device_attr_caps.attr, | 110 | &dev_attr_caps.attr, |
109 | &class_device_attr_max_lun.attr, | 111 | &dev_attr_max_lun.attr, |
110 | &class_device_attr_max_conn.attr, | 112 | &dev_attr_max_conn.attr, |
111 | &class_device_attr_max_cmd_len.attr, | 113 | &dev_attr_max_cmd_len.attr, |
112 | NULL, | 114 | NULL, |
113 | }; | 115 | }; |
114 | 116 | ||
@@ -119,7 +121,7 @@ static struct attribute_group iscsi_transport_group = { | |||
119 | 121 | ||
120 | 122 | ||
121 | static int iscsi_setup_host(struct transport_container *tc, struct device *dev, | 123 | static int iscsi_setup_host(struct transport_container *tc, struct device *dev, |
122 | struct class_device *cdev) | 124 | struct device *cdev) |
123 | { | 125 | { |
124 | struct Scsi_Host *shost = dev_to_shost(dev); | 126 | struct Scsi_Host *shost = dev_to_shost(dev); |
125 | struct iscsi_host *ihost = shost->shost_data; | 127 | struct iscsi_host *ihost = shost->shost_data; |
@@ -139,7 +141,7 @@ static int iscsi_setup_host(struct transport_container *tc, struct device *dev, | |||
139 | } | 141 | } |
140 | 142 | ||
141 | static int iscsi_remove_host(struct transport_container *tc, struct device *dev, | 143 | static int iscsi_remove_host(struct transport_container *tc, struct device *dev, |
142 | struct class_device *cdev) | 144 | struct device *cdev) |
143 | { | 145 | { |
144 | struct Scsi_Host *shost = dev_to_shost(dev); | 146 | struct Scsi_Host *shost = dev_to_shost(dev); |
145 | struct iscsi_host *ihost = shost->shost_data; | 147 | struct iscsi_host *ihost = shost->shost_data; |
@@ -1337,11 +1339,8 @@ iscsi_if_rx(struct sk_buff *skb) | |||
1337 | mutex_unlock(&rx_queue_mutex); | 1339 | mutex_unlock(&rx_queue_mutex); |
1338 | } | 1340 | } |
1339 | 1341 | ||
1340 | #define iscsi_cdev_to_conn(_cdev) \ | ||
1341 | iscsi_dev_to_conn(_cdev->dev) | ||
1342 | |||
1343 | #define ISCSI_CLASS_ATTR(_prefix,_name,_mode,_show,_store) \ | 1342 | #define ISCSI_CLASS_ATTR(_prefix,_name,_mode,_show,_store) \ |
1344 | struct class_device_attribute class_device_attr_##_prefix##_##_name = \ | 1343 | struct device_attribute dev_attr_##_prefix##_##_name = \ |
1345 | __ATTR(_name,_mode,_show,_store) | 1344 | __ATTR(_name,_mode,_show,_store) |
1346 | 1345 | ||
1347 | /* | 1346 | /* |
@@ -1349,9 +1348,10 @@ struct class_device_attribute class_device_attr_##_prefix##_##_name = \ | |||
1349 | */ | 1348 | */ |
1350 | #define iscsi_conn_attr_show(param) \ | 1349 | #define iscsi_conn_attr_show(param) \ |
1351 | static ssize_t \ | 1350 | static ssize_t \ |
1352 | show_conn_param_##param(struct class_device *cdev, char *buf) \ | 1351 | show_conn_param_##param(struct device *dev, \ |
1352 | struct device_attribute *attr, char *buf) \ | ||
1353 | { \ | 1353 | { \ |
1354 | struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \ | 1354 | struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev->parent); \ |
1355 | struct iscsi_transport *t = conn->transport; \ | 1355 | struct iscsi_transport *t = conn->transport; \ |
1356 | return t->get_conn_param(conn, param, buf); \ | 1356 | return t->get_conn_param(conn, param, buf); \ |
1357 | } | 1357 | } |
@@ -1375,17 +1375,16 @@ iscsi_conn_attr(address, ISCSI_PARAM_CONN_ADDRESS); | |||
1375 | iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO); | 1375 | iscsi_conn_attr(ping_tmo, ISCSI_PARAM_PING_TMO); |
1376 | iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO); | 1376 | iscsi_conn_attr(recv_tmo, ISCSI_PARAM_RECV_TMO); |
1377 | 1377 | ||
1378 | #define iscsi_cdev_to_session(_cdev) \ | ||
1379 | iscsi_dev_to_session(_cdev->dev) | ||
1380 | |||
1381 | /* | 1378 | /* |
1382 | * iSCSI session attrs | 1379 | * iSCSI session attrs |
1383 | */ | 1380 | */ |
1384 | #define iscsi_session_attr_show(param, perm) \ | 1381 | #define iscsi_session_attr_show(param, perm) \ |
1385 | static ssize_t \ | 1382 | static ssize_t \ |
1386 | show_session_param_##param(struct class_device *cdev, char *buf) \ | 1383 | show_session_param_##param(struct device *dev, \ |
1384 | struct device_attribute *attr, char *buf) \ | ||
1387 | { \ | 1385 | { \ |
1388 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ | 1386 | struct iscsi_cls_session *session = \ |
1387 | iscsi_dev_to_session(dev->parent); \ | ||
1389 | struct iscsi_transport *t = session->transport; \ | 1388 | struct iscsi_transport *t = session->transport; \ |
1390 | \ | 1389 | \ |
1391 | if (perm && !capable(CAP_SYS_ADMIN)) \ | 1390 | if (perm && !capable(CAP_SYS_ADMIN)) \ |
@@ -1417,9 +1416,10 @@ iscsi_session_attr(abort_tmo, ISCSI_PARAM_ABORT_TMO, 0); | |||
1417 | iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0); | 1416 | iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0); |
1418 | 1417 | ||
1419 | static ssize_t | 1418 | static ssize_t |
1420 | show_priv_session_state(struct class_device *cdev, char *buf) | 1419 | show_priv_session_state(struct device *dev, struct device_attribute *attr, |
1420 | char *buf) | ||
1421 | { | 1421 | { |
1422 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); | 1422 | struct iscsi_cls_session *session = iscsi_dev_to_session(dev->parent); |
1423 | return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); | 1423 | return sprintf(buf, "%s\n", iscsi_session_state_name(session->state)); |
1424 | } | 1424 | } |
1425 | static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, | 1425 | static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, |
@@ -1427,9 +1427,11 @@ static ISCSI_CLASS_ATTR(priv_sess, state, S_IRUGO, show_priv_session_state, | |||
1427 | 1427 | ||
1428 | #define iscsi_priv_session_attr_show(field, format) \ | 1428 | #define iscsi_priv_session_attr_show(field, format) \ |
1429 | static ssize_t \ | 1429 | static ssize_t \ |
1430 | show_priv_session_##field(struct class_device *cdev, char *buf) \ | 1430 | show_priv_session_##field(struct device *dev, \ |
1431 | struct device_attribute *attr, char *buf) \ | ||
1431 | { \ | 1432 | { \ |
1432 | struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev);\ | 1433 | struct iscsi_cls_session *session = \ |
1434 | iscsi_dev_to_session(dev->parent); \ | ||
1433 | return sprintf(buf, format"\n", session->field); \ | 1435 | return sprintf(buf, format"\n", session->field); \ |
1434 | } | 1436 | } |
1435 | 1437 | ||
@@ -1444,9 +1446,10 @@ iscsi_priv_session_attr(recovery_tmo, "%d"); | |||
1444 | */ | 1446 | */ |
1445 | #define iscsi_host_attr_show(param) \ | 1447 | #define iscsi_host_attr_show(param) \ |
1446 | static ssize_t \ | 1448 | static ssize_t \ |
1447 | show_host_param_##param(struct class_device *cdev, char *buf) \ | 1449 | show_host_param_##param(struct device *dev, \ |
1450 | struct device_attribute *attr, char *buf) \ | ||
1448 | { \ | 1451 | { \ |
1449 | struct Scsi_Host *shost = transport_class_to_shost(cdev); \ | 1452 | struct Scsi_Host *shost = transport_class_to_shost(dev); \ |
1450 | struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ | 1453 | struct iscsi_internal *priv = to_iscsi_internal(shost->transportt); \ |
1451 | return priv->iscsi_transport->get_host_param(shost, param, buf); \ | 1454 | return priv->iscsi_transport->get_host_param(shost, param, buf); \ |
1452 | } | 1455 | } |
@@ -1463,7 +1466,7 @@ iscsi_host_attr(initiatorname, ISCSI_HOST_PARAM_INITIATOR_NAME); | |||
1463 | 1466 | ||
1464 | #define SETUP_PRIV_SESSION_RD_ATTR(field) \ | 1467 | #define SETUP_PRIV_SESSION_RD_ATTR(field) \ |
1465 | do { \ | 1468 | do { \ |
1466 | priv->session_attrs[count] = &class_device_attr_priv_sess_##field; \ | 1469 | priv->session_attrs[count] = &dev_attr_priv_sess_##field; \ |
1467 | count++; \ | 1470 | count++; \ |
1468 | } while (0) | 1471 | } while (0) |
1469 | 1472 | ||
@@ -1471,7 +1474,7 @@ do { \ | |||
1471 | #define SETUP_SESSION_RD_ATTR(field, param_flag) \ | 1474 | #define SETUP_SESSION_RD_ATTR(field, param_flag) \ |
1472 | do { \ | 1475 | do { \ |
1473 | if (tt->param_mask & param_flag) { \ | 1476 | if (tt->param_mask & param_flag) { \ |
1474 | priv->session_attrs[count] = &class_device_attr_sess_##field; \ | 1477 | priv->session_attrs[count] = &dev_attr_sess_##field; \ |
1475 | count++; \ | 1478 | count++; \ |
1476 | } \ | 1479 | } \ |
1477 | } while (0) | 1480 | } while (0) |
@@ -1479,7 +1482,7 @@ do { \ | |||
1479 | #define SETUP_CONN_RD_ATTR(field, param_flag) \ | 1482 | #define SETUP_CONN_RD_ATTR(field, param_flag) \ |
1480 | do { \ | 1483 | do { \ |
1481 | if (tt->param_mask & param_flag) { \ | 1484 | if (tt->param_mask & param_flag) { \ |
1482 | priv->conn_attrs[count] = &class_device_attr_conn_##field; \ | 1485 | priv->conn_attrs[count] = &dev_attr_conn_##field; \ |
1483 | count++; \ | 1486 | count++; \ |
1484 | } \ | 1487 | } \ |
1485 | } while (0) | 1488 | } while (0) |
@@ -1487,7 +1490,7 @@ do { \ | |||
1487 | #define SETUP_HOST_RD_ATTR(field, param_flag) \ | 1490 | #define SETUP_HOST_RD_ATTR(field, param_flag) \ |
1488 | do { \ | 1491 | do { \ |
1489 | if (tt->host_param_mask & param_flag) { \ | 1492 | if (tt->host_param_mask & param_flag) { \ |
1490 | priv->host_attrs[count] = &class_device_attr_host_##field; \ | 1493 | priv->host_attrs[count] = &dev_attr_host_##field; \ |
1491 | count++; \ | 1494 | count++; \ |
1492 | } \ | 1495 | } \ |
1493 | } while (0) | 1496 | } while (0) |
@@ -1578,15 +1581,15 @@ iscsi_register_transport(struct iscsi_transport *tt) | |||
1578 | priv->iscsi_transport = tt; | 1581 | priv->iscsi_transport = tt; |
1579 | priv->t.user_scan = iscsi_user_scan; | 1582 | priv->t.user_scan = iscsi_user_scan; |
1580 | 1583 | ||
1581 | priv->cdev.class = &iscsi_transport_class; | 1584 | priv->dev.class = &iscsi_transport_class; |
1582 | snprintf(priv->cdev.class_id, BUS_ID_SIZE, "%s", tt->name); | 1585 | snprintf(priv->dev.bus_id, BUS_ID_SIZE, "%s", tt->name); |
1583 | err = class_device_register(&priv->cdev); | 1586 | err = device_register(&priv->dev); |
1584 | if (err) | 1587 | if (err) |
1585 | goto free_priv; | 1588 | goto free_priv; |
1586 | 1589 | ||
1587 | err = sysfs_create_group(&priv->cdev.kobj, &iscsi_transport_group); | 1590 | err = sysfs_create_group(&priv->dev.kobj, &iscsi_transport_group); |
1588 | if (err) | 1591 | if (err) |
1589 | goto unregister_cdev; | 1592 | goto unregister_dev; |
1590 | 1593 | ||
1591 | /* host parameters */ | 1594 | /* host parameters */ |
1592 | priv->t.host_attrs.ac.attrs = &priv->host_attrs[0]; | 1595 | priv->t.host_attrs.ac.attrs = &priv->host_attrs[0]; |
@@ -1663,8 +1666,8 @@ iscsi_register_transport(struct iscsi_transport *tt) | |||
1663 | printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name); | 1666 | printk(KERN_NOTICE "iscsi: registered transport (%s)\n", tt->name); |
1664 | return &priv->t; | 1667 | return &priv->t; |
1665 | 1668 | ||
1666 | unregister_cdev: | 1669 | unregister_dev: |
1667 | class_device_unregister(&priv->cdev); | 1670 | device_unregister(&priv->dev); |
1668 | free_priv: | 1671 | free_priv: |
1669 | kfree(priv); | 1672 | kfree(priv); |
1670 | return NULL; | 1673 | return NULL; |
@@ -1691,8 +1694,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt) | |||
1691 | transport_container_unregister(&priv->session_cont); | 1694 | transport_container_unregister(&priv->session_cont); |
1692 | transport_container_unregister(&priv->t.host_attrs); | 1695 | transport_container_unregister(&priv->t.host_attrs); |
1693 | 1696 | ||
1694 | sysfs_remove_group(&priv->cdev.kobj, &iscsi_transport_group); | 1697 | sysfs_remove_group(&priv->dev.kobj, &iscsi_transport_group); |
1695 | class_device_unregister(&priv->cdev); | 1698 | device_unregister(&priv->dev); |
1696 | mutex_unlock(&rx_queue_mutex); | 1699 | mutex_unlock(&rx_queue_mutex); |
1697 | 1700 | ||
1698 | return 0; | 1701 | return 0; |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 43a964d635b4..27ec625ab771 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -53,8 +53,8 @@ struct sas_host_attrs { | |||
53 | /* | 53 | /* |
54 | * Hack to allow attributes of the same name in different objects. | 54 | * Hack to allow attributes of the same name in different objects. |
55 | */ | 55 | */ |
56 | #define SAS_CLASS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ | 56 | #define SAS_DEVICE_ATTR(_prefix,_name,_mode,_show,_store) \ |
57 | struct class_device_attribute class_device_attr_##_prefix##_##_name = \ | 57 | struct device_attribute dev_attr_##_prefix##_##_name = \ |
58 | __ATTR(_name,_mode,_show,_store) | 58 | __ATTR(_name,_mode,_show,_store) |
59 | 59 | ||
60 | 60 | ||
@@ -261,7 +261,7 @@ static void sas_bsg_remove(struct Scsi_Host *shost, struct sas_rphy *rphy) | |||
261 | */ | 261 | */ |
262 | 262 | ||
263 | static int sas_host_setup(struct transport_container *tc, struct device *dev, | 263 | static int sas_host_setup(struct transport_container *tc, struct device *dev, |
264 | struct class_device *cdev) | 264 | struct device *cdev) |
265 | { | 265 | { |
266 | struct Scsi_Host *shost = dev_to_shost(dev); | 266 | struct Scsi_Host *shost = dev_to_shost(dev); |
267 | struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); | 267 | struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); |
@@ -280,7 +280,7 @@ static int sas_host_setup(struct transport_container *tc, struct device *dev, | |||
280 | } | 280 | } |
281 | 281 | ||
282 | static int sas_host_remove(struct transport_container *tc, struct device *dev, | 282 | static int sas_host_remove(struct transport_container *tc, struct device *dev, |
283 | struct class_device *cdev) | 283 | struct device *cdev) |
284 | { | 284 | { |
285 | struct Scsi_Host *shost = dev_to_shost(dev); | 285 | struct Scsi_Host *shost = dev_to_shost(dev); |
286 | 286 | ||
@@ -356,22 +356,24 @@ EXPORT_SYMBOL(sas_remove_host); | |||
356 | 356 | ||
357 | #define sas_phy_show_simple(field, name, format_string, cast) \ | 357 | #define sas_phy_show_simple(field, name, format_string, cast) \ |
358 | static ssize_t \ | 358 | static ssize_t \ |
359 | show_sas_phy_##name(struct class_device *cdev, char *buf) \ | 359 | show_sas_phy_##name(struct device *dev, \ |
360 | struct device_attribute *attr, char *buf) \ | ||
360 | { \ | 361 | { \ |
361 | struct sas_phy *phy = transport_class_to_phy(cdev); \ | 362 | struct sas_phy *phy = transport_class_to_phy(dev); \ |
362 | \ | 363 | \ |
363 | return snprintf(buf, 20, format_string, cast phy->field); \ | 364 | return snprintf(buf, 20, format_string, cast phy->field); \ |
364 | } | 365 | } |
365 | 366 | ||
366 | #define sas_phy_simple_attr(field, name, format_string, type) \ | 367 | #define sas_phy_simple_attr(field, name, format_string, type) \ |
367 | sas_phy_show_simple(field, name, format_string, (type)) \ | 368 | sas_phy_show_simple(field, name, format_string, (type)) \ |
368 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) | 369 | static DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) |
369 | 370 | ||
370 | #define sas_phy_show_protocol(field, name) \ | 371 | #define sas_phy_show_protocol(field, name) \ |
371 | static ssize_t \ | 372 | static ssize_t \ |
372 | show_sas_phy_##name(struct class_device *cdev, char *buf) \ | 373 | show_sas_phy_##name(struct device *dev, \ |
374 | struct device_attribute *attr, char *buf) \ | ||
373 | { \ | 375 | { \ |
374 | struct sas_phy *phy = transport_class_to_phy(cdev); \ | 376 | struct sas_phy *phy = transport_class_to_phy(dev); \ |
375 | \ | 377 | \ |
376 | if (!phy->field) \ | 378 | if (!phy->field) \ |
377 | return snprintf(buf, 20, "none\n"); \ | 379 | return snprintf(buf, 20, "none\n"); \ |
@@ -380,13 +382,14 @@ show_sas_phy_##name(struct class_device *cdev, char *buf) \ | |||
380 | 382 | ||
381 | #define sas_phy_protocol_attr(field, name) \ | 383 | #define sas_phy_protocol_attr(field, name) \ |
382 | sas_phy_show_protocol(field, name) \ | 384 | sas_phy_show_protocol(field, name) \ |
383 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) | 385 | static DEVICE_ATTR(name, S_IRUGO, show_sas_phy_##name, NULL) |
384 | 386 | ||
385 | #define sas_phy_show_linkspeed(field) \ | 387 | #define sas_phy_show_linkspeed(field) \ |
386 | static ssize_t \ | 388 | static ssize_t \ |
387 | show_sas_phy_##field(struct class_device *cdev, char *buf) \ | 389 | show_sas_phy_##field(struct device *dev, \ |
390 | struct device_attribute *attr, char *buf) \ | ||
388 | { \ | 391 | { \ |
389 | struct sas_phy *phy = transport_class_to_phy(cdev); \ | 392 | struct sas_phy *phy = transport_class_to_phy(dev); \ |
390 | \ | 393 | \ |
391 | return get_sas_linkspeed_names(phy->field, buf); \ | 394 | return get_sas_linkspeed_names(phy->field, buf); \ |
392 | } | 395 | } |
@@ -394,10 +397,11 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \ | |||
394 | /* Fudge to tell if we're minimum or maximum */ | 397 | /* Fudge to tell if we're minimum or maximum */ |
395 | #define sas_phy_store_linkspeed(field) \ | 398 | #define sas_phy_store_linkspeed(field) \ |
396 | static ssize_t \ | 399 | static ssize_t \ |
397 | store_sas_phy_##field(struct class_device *cdev, const char *buf, \ | 400 | store_sas_phy_##field(struct device *dev, \ |
398 | size_t count) \ | 401 | struct device_attribute *attr, \ |
402 | const char *buf, size_t count) \ | ||
399 | { \ | 403 | { \ |
400 | struct sas_phy *phy = transport_class_to_phy(cdev); \ | 404 | struct sas_phy *phy = transport_class_to_phy(dev); \ |
401 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ | 405 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ |
402 | struct sas_internal *i = to_sas_internal(shost->transportt); \ | 406 | struct sas_internal *i = to_sas_internal(shost->transportt); \ |
403 | u32 value; \ | 407 | u32 value; \ |
@@ -416,19 +420,20 @@ store_sas_phy_##field(struct class_device *cdev, const char *buf, \ | |||
416 | #define sas_phy_linkspeed_rw_attr(field) \ | 420 | #define sas_phy_linkspeed_rw_attr(field) \ |
417 | sas_phy_show_linkspeed(field) \ | 421 | sas_phy_show_linkspeed(field) \ |
418 | sas_phy_store_linkspeed(field) \ | 422 | sas_phy_store_linkspeed(field) \ |
419 | static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, \ | 423 | static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, \ |
420 | store_sas_phy_##field) | 424 | store_sas_phy_##field) |
421 | 425 | ||
422 | #define sas_phy_linkspeed_attr(field) \ | 426 | #define sas_phy_linkspeed_attr(field) \ |
423 | sas_phy_show_linkspeed(field) \ | 427 | sas_phy_show_linkspeed(field) \ |
424 | static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) | 428 | static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) |
425 | 429 | ||
426 | 430 | ||
427 | #define sas_phy_show_linkerror(field) \ | 431 | #define sas_phy_show_linkerror(field) \ |
428 | static ssize_t \ | 432 | static ssize_t \ |
429 | show_sas_phy_##field(struct class_device *cdev, char *buf) \ | 433 | show_sas_phy_##field(struct device *dev, \ |
434 | struct device_attribute *attr, char *buf) \ | ||
430 | { \ | 435 | { \ |
431 | struct sas_phy *phy = transport_class_to_phy(cdev); \ | 436 | struct sas_phy *phy = transport_class_to_phy(dev); \ |
432 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ | 437 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \ |
433 | struct sas_internal *i = to_sas_internal(shost->transportt); \ | 438 | struct sas_internal *i = to_sas_internal(shost->transportt); \ |
434 | int error; \ | 439 | int error; \ |
@@ -441,24 +446,25 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \ | |||
441 | 446 | ||
442 | #define sas_phy_linkerror_attr(field) \ | 447 | #define sas_phy_linkerror_attr(field) \ |
443 | sas_phy_show_linkerror(field) \ | 448 | sas_phy_show_linkerror(field) \ |
444 | static CLASS_DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) | 449 | static DEVICE_ATTR(field, S_IRUGO, show_sas_phy_##field, NULL) |
445 | 450 | ||
446 | 451 | ||
447 | static ssize_t | 452 | static ssize_t |
448 | show_sas_device_type(struct class_device *cdev, char *buf) | 453 | show_sas_device_type(struct device *dev, |
454 | struct device_attribute *attr, char *buf) | ||
449 | { | 455 | { |
450 | struct sas_phy *phy = transport_class_to_phy(cdev); | 456 | struct sas_phy *phy = transport_class_to_phy(dev); |
451 | 457 | ||
452 | if (!phy->identify.device_type) | 458 | if (!phy->identify.device_type) |
453 | return snprintf(buf, 20, "none\n"); | 459 | return snprintf(buf, 20, "none\n"); |
454 | return get_sas_device_type_names(phy->identify.device_type, buf); | 460 | return get_sas_device_type_names(phy->identify.device_type, buf); |
455 | } | 461 | } |
456 | static CLASS_DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL); | 462 | static DEVICE_ATTR(device_type, S_IRUGO, show_sas_device_type, NULL); |
457 | 463 | ||
458 | static ssize_t do_sas_phy_enable(struct class_device *cdev, | 464 | static ssize_t do_sas_phy_enable(struct device *dev, |
459 | size_t count, int enable) | 465 | size_t count, int enable) |
460 | { | 466 | { |
461 | struct sas_phy *phy = transport_class_to_phy(cdev); | 467 | struct sas_phy *phy = transport_class_to_phy(dev); |
462 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); | 468 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); |
463 | struct sas_internal *i = to_sas_internal(shost->transportt); | 469 | struct sas_internal *i = to_sas_internal(shost->transportt); |
464 | int error; | 470 | int error; |
@@ -470,18 +476,19 @@ static ssize_t do_sas_phy_enable(struct class_device *cdev, | |||
470 | return count; | 476 | return count; |
471 | }; | 477 | }; |
472 | 478 | ||
473 | static ssize_t store_sas_phy_enable(struct class_device *cdev, | 479 | static ssize_t |
474 | const char *buf, size_t count) | 480 | store_sas_phy_enable(struct device *dev, struct device_attribute *attr, |
481 | const char *buf, size_t count) | ||
475 | { | 482 | { |
476 | if (count < 1) | 483 | if (count < 1) |
477 | return -EINVAL; | 484 | return -EINVAL; |
478 | 485 | ||
479 | switch (buf[0]) { | 486 | switch (buf[0]) { |
480 | case '0': | 487 | case '0': |
481 | do_sas_phy_enable(cdev, count, 0); | 488 | do_sas_phy_enable(dev, count, 0); |
482 | break; | 489 | break; |
483 | case '1': | 490 | case '1': |
484 | do_sas_phy_enable(cdev, count, 1); | 491 | do_sas_phy_enable(dev, count, 1); |
485 | break; | 492 | break; |
486 | default: | 493 | default: |
487 | return -EINVAL; | 494 | return -EINVAL; |
@@ -490,20 +497,22 @@ static ssize_t store_sas_phy_enable(struct class_device *cdev, | |||
490 | return count; | 497 | return count; |
491 | } | 498 | } |
492 | 499 | ||
493 | static ssize_t show_sas_phy_enable(struct class_device *cdev, char *buf) | 500 | static ssize_t |
501 | show_sas_phy_enable(struct device *dev, struct device_attribute *attr, | ||
502 | char *buf) | ||
494 | { | 503 | { |
495 | struct sas_phy *phy = transport_class_to_phy(cdev); | 504 | struct sas_phy *phy = transport_class_to_phy(dev); |
496 | 505 | ||
497 | return snprintf(buf, 20, "%d", phy->enabled); | 506 | return snprintf(buf, 20, "%d", phy->enabled); |
498 | } | 507 | } |
499 | 508 | ||
500 | static CLASS_DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, | 509 | static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, show_sas_phy_enable, |
501 | store_sas_phy_enable); | 510 | store_sas_phy_enable); |
502 | 511 | ||
503 | static ssize_t do_sas_phy_reset(struct class_device *cdev, | 512 | static ssize_t |
504 | size_t count, int hard_reset) | 513 | do_sas_phy_reset(struct device *dev, size_t count, int hard_reset) |
505 | { | 514 | { |
506 | struct sas_phy *phy = transport_class_to_phy(cdev); | 515 | struct sas_phy *phy = transport_class_to_phy(dev); |
507 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); | 516 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); |
508 | struct sas_internal *i = to_sas_internal(shost->transportt); | 517 | struct sas_internal *i = to_sas_internal(shost->transportt); |
509 | int error; | 518 | int error; |
@@ -514,19 +523,21 @@ static ssize_t do_sas_phy_reset(struct class_device *cdev, | |||
514 | return count; | 523 | return count; |
515 | }; | 524 | }; |
516 | 525 | ||
517 | static ssize_t store_sas_link_reset(struct class_device *cdev, | 526 | static ssize_t |
518 | const char *buf, size_t count) | 527 | store_sas_link_reset(struct device *dev, struct device_attribute *attr, |
528 | const char *buf, size_t count) | ||
519 | { | 529 | { |
520 | return do_sas_phy_reset(cdev, count, 0); | 530 | return do_sas_phy_reset(dev, count, 0); |
521 | } | 531 | } |
522 | static CLASS_DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset); | 532 | static DEVICE_ATTR(link_reset, S_IWUSR, NULL, store_sas_link_reset); |
523 | 533 | ||
524 | static ssize_t store_sas_hard_reset(struct class_device *cdev, | 534 | static ssize_t |
525 | const char *buf, size_t count) | 535 | store_sas_hard_reset(struct device *dev, struct device_attribute *attr, |
536 | const char *buf, size_t count) | ||
526 | { | 537 | { |
527 | return do_sas_phy_reset(cdev, count, 1); | 538 | return do_sas_phy_reset(dev, count, 1); |
528 | } | 539 | } |
529 | static CLASS_DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset); | 540 | static DEVICE_ATTR(hard_reset, S_IWUSR, NULL, store_sas_hard_reset); |
530 | 541 | ||
531 | sas_phy_protocol_attr(identify.initiator_port_protocols, | 542 | sas_phy_protocol_attr(identify.initiator_port_protocols, |
532 | initiator_port_protocols); | 543 | initiator_port_protocols); |
@@ -695,16 +706,17 @@ EXPORT_SYMBOL(scsi_is_sas_phy); | |||
695 | */ | 706 | */ |
696 | #define sas_port_show_simple(field, name, format_string, cast) \ | 707 | #define sas_port_show_simple(field, name, format_string, cast) \ |
697 | static ssize_t \ | 708 | static ssize_t \ |
698 | show_sas_port_##name(struct class_device *cdev, char *buf) \ | 709 | show_sas_port_##name(struct device *dev, \ |
710 | struct device_attribute *attr, char *buf) \ | ||
699 | { \ | 711 | { \ |
700 | struct sas_port *port = transport_class_to_sas_port(cdev); \ | 712 | struct sas_port *port = transport_class_to_sas_port(dev); \ |
701 | \ | 713 | \ |
702 | return snprintf(buf, 20, format_string, cast port->field); \ | 714 | return snprintf(buf, 20, format_string, cast port->field); \ |
703 | } | 715 | } |
704 | 716 | ||
705 | #define sas_port_simple_attr(field, name, format_string, type) \ | 717 | #define sas_port_simple_attr(field, name, format_string, type) \ |
706 | sas_port_show_simple(field, name, format_string, (type)) \ | 718 | sas_port_show_simple(field, name, format_string, (type)) \ |
707 | static CLASS_DEVICE_ATTR(name, S_IRUGO, show_sas_port_##name, NULL) | 719 | static DEVICE_ATTR(name, S_IRUGO, show_sas_port_##name, NULL) |
708 | 720 | ||
709 | sas_port_simple_attr(num_phys, num_phys, "%d\n", int); | 721 | sas_port_simple_attr(num_phys, num_phys, "%d\n", int); |
710 | 722 | ||
@@ -1017,23 +1029,25 @@ EXPORT_SYMBOL(sas_port_mark_backlink); | |||
1017 | 1029 | ||
1018 | #define sas_rphy_show_simple(field, name, format_string, cast) \ | 1030 | #define sas_rphy_show_simple(field, name, format_string, cast) \ |
1019 | static ssize_t \ | 1031 | static ssize_t \ |
1020 | show_sas_rphy_##name(struct class_device *cdev, char *buf) \ | 1032 | show_sas_rphy_##name(struct device *dev, \ |
1033 | struct device_attribute *attr, char *buf) \ | ||
1021 | { \ | 1034 | { \ |
1022 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ | 1035 | struct sas_rphy *rphy = transport_class_to_rphy(dev); \ |
1023 | \ | 1036 | \ |
1024 | return snprintf(buf, 20, format_string, cast rphy->field); \ | 1037 | return snprintf(buf, 20, format_string, cast rphy->field); \ |
1025 | } | 1038 | } |
1026 | 1039 | ||
1027 | #define sas_rphy_simple_attr(field, name, format_string, type) \ | 1040 | #define sas_rphy_simple_attr(field, name, format_string, type) \ |
1028 | sas_rphy_show_simple(field, name, format_string, (type)) \ | 1041 | sas_rphy_show_simple(field, name, format_string, (type)) \ |
1029 | static SAS_CLASS_DEVICE_ATTR(rphy, name, S_IRUGO, \ | 1042 | static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \ |
1030 | show_sas_rphy_##name, NULL) | 1043 | show_sas_rphy_##name, NULL) |
1031 | 1044 | ||
1032 | #define sas_rphy_show_protocol(field, name) \ | 1045 | #define sas_rphy_show_protocol(field, name) \ |
1033 | static ssize_t \ | 1046 | static ssize_t \ |
1034 | show_sas_rphy_##name(struct class_device *cdev, char *buf) \ | 1047 | show_sas_rphy_##name(struct device *dev, \ |
1048 | struct device_attribute *attr, char *buf) \ | ||
1035 | { \ | 1049 | { \ |
1036 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ | 1050 | struct sas_rphy *rphy = transport_class_to_rphy(dev); \ |
1037 | \ | 1051 | \ |
1038 | if (!rphy->field) \ | 1052 | if (!rphy->field) \ |
1039 | return snprintf(buf, 20, "none\n"); \ | 1053 | return snprintf(buf, 20, "none\n"); \ |
@@ -1042,13 +1056,14 @@ show_sas_rphy_##name(struct class_device *cdev, char *buf) \ | |||
1042 | 1056 | ||
1043 | #define sas_rphy_protocol_attr(field, name) \ | 1057 | #define sas_rphy_protocol_attr(field, name) \ |
1044 | sas_rphy_show_protocol(field, name) \ | 1058 | sas_rphy_show_protocol(field, name) \ |
1045 | static SAS_CLASS_DEVICE_ATTR(rphy, name, S_IRUGO, \ | 1059 | static SAS_DEVICE_ATTR(rphy, name, S_IRUGO, \ |
1046 | show_sas_rphy_##name, NULL) | 1060 | show_sas_rphy_##name, NULL) |
1047 | 1061 | ||
1048 | static ssize_t | 1062 | static ssize_t |
1049 | show_sas_rphy_device_type(struct class_device *cdev, char *buf) | 1063 | show_sas_rphy_device_type(struct device *dev, |
1064 | struct device_attribute *attr, char *buf) | ||
1050 | { | 1065 | { |
1051 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); | 1066 | struct sas_rphy *rphy = transport_class_to_rphy(dev); |
1052 | 1067 | ||
1053 | if (!rphy->identify.device_type) | 1068 | if (!rphy->identify.device_type) |
1054 | return snprintf(buf, 20, "none\n"); | 1069 | return snprintf(buf, 20, "none\n"); |
@@ -1056,13 +1071,14 @@ show_sas_rphy_device_type(struct class_device *cdev, char *buf) | |||
1056 | rphy->identify.device_type, buf); | 1071 | rphy->identify.device_type, buf); |
1057 | } | 1072 | } |
1058 | 1073 | ||
1059 | static SAS_CLASS_DEVICE_ATTR(rphy, device_type, S_IRUGO, | 1074 | static SAS_DEVICE_ATTR(rphy, device_type, S_IRUGO, |
1060 | show_sas_rphy_device_type, NULL); | 1075 | show_sas_rphy_device_type, NULL); |
1061 | 1076 | ||
1062 | static ssize_t | 1077 | static ssize_t |
1063 | show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf) | 1078 | show_sas_rphy_enclosure_identifier(struct device *dev, |
1079 | struct device_attribute *attr, char *buf) | ||
1064 | { | 1080 | { |
1065 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); | 1081 | struct sas_rphy *rphy = transport_class_to_rphy(dev); |
1066 | struct sas_phy *phy = dev_to_phy(rphy->dev.parent); | 1082 | struct sas_phy *phy = dev_to_phy(rphy->dev.parent); |
1067 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); | 1083 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); |
1068 | struct sas_internal *i = to_sas_internal(shost->transportt); | 1084 | struct sas_internal *i = to_sas_internal(shost->transportt); |
@@ -1082,13 +1098,14 @@ show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf) | |||
1082 | return sprintf(buf, "0x%llx\n", (unsigned long long)identifier); | 1098 | return sprintf(buf, "0x%llx\n", (unsigned long long)identifier); |
1083 | } | 1099 | } |
1084 | 1100 | ||
1085 | static SAS_CLASS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO, | 1101 | static SAS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO, |
1086 | show_sas_rphy_enclosure_identifier, NULL); | 1102 | show_sas_rphy_enclosure_identifier, NULL); |
1087 | 1103 | ||
1088 | static ssize_t | 1104 | static ssize_t |
1089 | show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf) | 1105 | show_sas_rphy_bay_identifier(struct device *dev, |
1106 | struct device_attribute *attr, char *buf) | ||
1090 | { | 1107 | { |
1091 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); | 1108 | struct sas_rphy *rphy = transport_class_to_rphy(dev); |
1092 | struct sas_phy *phy = dev_to_phy(rphy->dev.parent); | 1109 | struct sas_phy *phy = dev_to_phy(rphy->dev.parent); |
1093 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); | 1110 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); |
1094 | struct sas_internal *i = to_sas_internal(shost->transportt); | 1111 | struct sas_internal *i = to_sas_internal(shost->transportt); |
@@ -1103,7 +1120,7 @@ show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf) | |||
1103 | return sprintf(buf, "%d\n", val); | 1120 | return sprintf(buf, "%d\n", val); |
1104 | } | 1121 | } |
1105 | 1122 | ||
1106 | static SAS_CLASS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO, | 1123 | static SAS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO, |
1107 | show_sas_rphy_bay_identifier, NULL); | 1124 | show_sas_rphy_bay_identifier, NULL); |
1108 | 1125 | ||
1109 | sas_rphy_protocol_attr(identify.initiator_port_protocols, | 1126 | sas_rphy_protocol_attr(identify.initiator_port_protocols, |
@@ -1161,9 +1178,10 @@ static DECLARE_TRANSPORT_CLASS(sas_end_dev_class, | |||
1161 | 1178 | ||
1162 | #define sas_end_dev_show_simple(field, name, format_string, cast) \ | 1179 | #define sas_end_dev_show_simple(field, name, format_string, cast) \ |
1163 | static ssize_t \ | 1180 | static ssize_t \ |
1164 | show_sas_end_dev_##name(struct class_device *cdev, char *buf) \ | 1181 | show_sas_end_dev_##name(struct device *dev, \ |
1182 | struct device_attribute *attr, char *buf) \ | ||
1165 | { \ | 1183 | { \ |
1166 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ | 1184 | struct sas_rphy *rphy = transport_class_to_rphy(dev); \ |
1167 | struct sas_end_device *rdev = rphy_to_end_device(rphy); \ | 1185 | struct sas_end_device *rdev = rphy_to_end_device(rphy); \ |
1168 | \ | 1186 | \ |
1169 | return snprintf(buf, 20, format_string, cast rdev->field); \ | 1187 | return snprintf(buf, 20, format_string, cast rdev->field); \ |
@@ -1171,7 +1189,7 @@ show_sas_end_dev_##name(struct class_device *cdev, char *buf) \ | |||
1171 | 1189 | ||
1172 | #define sas_end_dev_simple_attr(field, name, format_string, type) \ | 1190 | #define sas_end_dev_simple_attr(field, name, format_string, type) \ |
1173 | sas_end_dev_show_simple(field, name, format_string, (type)) \ | 1191 | sas_end_dev_show_simple(field, name, format_string, (type)) \ |
1174 | static SAS_CLASS_DEVICE_ATTR(end_dev, name, S_IRUGO, \ | 1192 | static SAS_DEVICE_ATTR(end_dev, name, S_IRUGO, \ |
1175 | show_sas_end_dev_##name, NULL) | 1193 | show_sas_end_dev_##name, NULL) |
1176 | 1194 | ||
1177 | sas_end_dev_simple_attr(ready_led_meaning, ready_led_meaning, "%d\n", int); | 1195 | sas_end_dev_simple_attr(ready_led_meaning, ready_led_meaning, "%d\n", int); |
@@ -1185,9 +1203,10 @@ static DECLARE_TRANSPORT_CLASS(sas_expander_class, | |||
1185 | 1203 | ||
1186 | #define sas_expander_show_simple(field, name, format_string, cast) \ | 1204 | #define sas_expander_show_simple(field, name, format_string, cast) \ |
1187 | static ssize_t \ | 1205 | static ssize_t \ |
1188 | show_sas_expander_##name(struct class_device *cdev, char *buf) \ | 1206 | show_sas_expander_##name(struct device *dev, \ |
1207 | struct device_attribute *attr, char *buf) \ | ||
1189 | { \ | 1208 | { \ |
1190 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); \ | 1209 | struct sas_rphy *rphy = transport_class_to_rphy(dev); \ |
1191 | struct sas_expander_device *edev = rphy_to_expander_device(rphy); \ | 1210 | struct sas_expander_device *edev = rphy_to_expander_device(rphy); \ |
1192 | \ | 1211 | \ |
1193 | return snprintf(buf, 20, format_string, cast edev->field); \ | 1212 | return snprintf(buf, 20, format_string, cast edev->field); \ |
@@ -1195,7 +1214,7 @@ show_sas_expander_##name(struct class_device *cdev, char *buf) \ | |||
1195 | 1214 | ||
1196 | #define sas_expander_simple_attr(field, name, format_string, type) \ | 1215 | #define sas_expander_simple_attr(field, name, format_string, type) \ |
1197 | sas_expander_show_simple(field, name, format_string, (type)) \ | 1216 | sas_expander_show_simple(field, name, format_string, (type)) \ |
1198 | static SAS_CLASS_DEVICE_ATTR(expander, name, S_IRUGO, \ | 1217 | static SAS_DEVICE_ATTR(expander, name, S_IRUGO, \ |
1199 | show_sas_expander_##name, NULL) | 1218 | show_sas_expander_##name, NULL) |
1200 | 1219 | ||
1201 | sas_expander_simple_attr(vendor_id, vendor_id, "%s\n", char *); | 1220 | sas_expander_simple_attr(vendor_id, vendor_id, "%s\n", char *); |
@@ -1554,14 +1573,14 @@ static int sas_user_scan(struct Scsi_Host *shost, uint channel, | |||
1554 | */ | 1573 | */ |
1555 | 1574 | ||
1556 | #define SETUP_TEMPLATE(attrb, field, perm, test) \ | 1575 | #define SETUP_TEMPLATE(attrb, field, perm, test) \ |
1557 | i->private_##attrb[count] = class_device_attr_##field; \ | 1576 | i->private_##attrb[count] = dev_attr_##field; \ |
1558 | i->private_##attrb[count].attr.mode = perm; \ | 1577 | i->private_##attrb[count].attr.mode = perm; \ |
1559 | i->attrb[count] = &i->private_##attrb[count]; \ | 1578 | i->attrb[count] = &i->private_##attrb[count]; \ |
1560 | if (test) \ | 1579 | if (test) \ |
1561 | count++ | 1580 | count++ |
1562 | 1581 | ||
1563 | #define SETUP_TEMPLATE_RW(attrb, field, perm, test, ro_test, ro_perm) \ | 1582 | #define SETUP_TEMPLATE_RW(attrb, field, perm, test, ro_test, ro_perm) \ |
1564 | i->private_##attrb[count] = class_device_attr_##field; \ | 1583 | i->private_##attrb[count] = dev_attr_##field; \ |
1565 | i->private_##attrb[count].attr.mode = perm; \ | 1584 | i->private_##attrb[count].attr.mode = perm; \ |
1566 | if (ro_test) { \ | 1585 | if (ro_test) { \ |
1567 | i->private_##attrb[count].attr.mode = ro_perm; \ | 1586 | i->private_##attrb[count].attr.mode = ro_perm; \ |
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 1fb60313a516..bc12b5d5d676 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -158,7 +158,7 @@ static inline enum spi_signal_type spi_signal_to_value(const char *name) | |||
158 | } | 158 | } |
159 | 159 | ||
160 | static int spi_host_setup(struct transport_container *tc, struct device *dev, | 160 | static int spi_host_setup(struct transport_container *tc, struct device *dev, |
161 | struct class_device *cdev) | 161 | struct device *cdev) |
162 | { | 162 | { |
163 | struct Scsi_Host *shost = dev_to_shost(dev); | 163 | struct Scsi_Host *shost = dev_to_shost(dev); |
164 | 164 | ||
@@ -169,7 +169,7 @@ static int spi_host_setup(struct transport_container *tc, struct device *dev, | |||
169 | 169 | ||
170 | static int spi_host_configure(struct transport_container *tc, | 170 | static int spi_host_configure(struct transport_container *tc, |
171 | struct device *dev, | 171 | struct device *dev, |
172 | struct class_device *cdev); | 172 | struct device *cdev); |
173 | 173 | ||
174 | static DECLARE_TRANSPORT_CLASS(spi_host_class, | 174 | static DECLARE_TRANSPORT_CLASS(spi_host_class, |
175 | "spi_host", | 175 | "spi_host", |
@@ -195,11 +195,11 @@ static int spi_host_match(struct attribute_container *cont, | |||
195 | 195 | ||
196 | static int spi_target_configure(struct transport_container *tc, | 196 | static int spi_target_configure(struct transport_container *tc, |
197 | struct device *dev, | 197 | struct device *dev, |
198 | struct class_device *cdev); | 198 | struct device *cdev); |
199 | 199 | ||
200 | static int spi_device_configure(struct transport_container *tc, | 200 | static int spi_device_configure(struct transport_container *tc, |
201 | struct device *dev, | 201 | struct device *dev, |
202 | struct class_device *cdev) | 202 | struct device *cdev) |
203 | { | 203 | { |
204 | struct scsi_device *sdev = to_scsi_device(dev); | 204 | struct scsi_device *sdev = to_scsi_device(dev); |
205 | struct scsi_target *starget = sdev->sdev_target; | 205 | struct scsi_target *starget = sdev->sdev_target; |
@@ -219,7 +219,7 @@ static int spi_device_configure(struct transport_container *tc, | |||
219 | 219 | ||
220 | static int spi_setup_transport_attrs(struct transport_container *tc, | 220 | static int spi_setup_transport_attrs(struct transport_container *tc, |
221 | struct device *dev, | 221 | struct device *dev, |
222 | struct class_device *cdev) | 222 | struct device *cdev) |
223 | { | 223 | { |
224 | struct scsi_target *starget = to_scsi_target(dev); | 224 | struct scsi_target *starget = to_scsi_target(dev); |
225 | 225 | ||
@@ -248,9 +248,10 @@ static int spi_setup_transport_attrs(struct transport_container *tc, | |||
248 | #define spi_transport_show_simple(field, format_string) \ | 248 | #define spi_transport_show_simple(field, format_string) \ |
249 | \ | 249 | \ |
250 | static ssize_t \ | 250 | static ssize_t \ |
251 | show_spi_transport_##field(struct class_device *cdev, char *buf) \ | 251 | show_spi_transport_##field(struct device *dev, \ |
252 | struct device_attribute *attr, char *buf) \ | ||
252 | { \ | 253 | { \ |
253 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 254 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
254 | struct spi_transport_attrs *tp; \ | 255 | struct spi_transport_attrs *tp; \ |
255 | \ | 256 | \ |
256 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ | 257 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ |
@@ -260,11 +261,12 @@ show_spi_transport_##field(struct class_device *cdev, char *buf) \ | |||
260 | #define spi_transport_store_simple(field, format_string) \ | 261 | #define spi_transport_store_simple(field, format_string) \ |
261 | \ | 262 | \ |
262 | static ssize_t \ | 263 | static ssize_t \ |
263 | store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | 264 | store_spi_transport_##field(struct device *dev, \ |
264 | size_t count) \ | 265 | struct device_attribute *attr, \ |
266 | const char *buf, size_t count) \ | ||
265 | { \ | 267 | { \ |
266 | int val; \ | 268 | int val; \ |
267 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 269 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
268 | struct spi_transport_attrs *tp; \ | 270 | struct spi_transport_attrs *tp; \ |
269 | \ | 271 | \ |
270 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ | 272 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ |
@@ -276,9 +278,10 @@ store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | |||
276 | #define spi_transport_show_function(field, format_string) \ | 278 | #define spi_transport_show_function(field, format_string) \ |
277 | \ | 279 | \ |
278 | static ssize_t \ | 280 | static ssize_t \ |
279 | show_spi_transport_##field(struct class_device *cdev, char *buf) \ | 281 | show_spi_transport_##field(struct device *dev, \ |
282 | struct device_attribute *attr, char *buf) \ | ||
280 | { \ | 283 | { \ |
281 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 284 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
282 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ | 285 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ |
283 | struct spi_transport_attrs *tp; \ | 286 | struct spi_transport_attrs *tp; \ |
284 | struct spi_internal *i = to_spi_internal(shost->transportt); \ | 287 | struct spi_internal *i = to_spi_internal(shost->transportt); \ |
@@ -290,11 +293,12 @@ show_spi_transport_##field(struct class_device *cdev, char *buf) \ | |||
290 | 293 | ||
291 | #define spi_transport_store_function(field, format_string) \ | 294 | #define spi_transport_store_function(field, format_string) \ |
292 | static ssize_t \ | 295 | static ssize_t \ |
293 | store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | 296 | store_spi_transport_##field(struct device *dev, \ |
294 | size_t count) \ | 297 | struct device_attribute *attr, \ |
298 | const char *buf, size_t count) \ | ||
295 | { \ | 299 | { \ |
296 | int val; \ | 300 | int val; \ |
297 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 301 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
298 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ | 302 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ |
299 | struct spi_internal *i = to_spi_internal(shost->transportt); \ | 303 | struct spi_internal *i = to_spi_internal(shost->transportt); \ |
300 | \ | 304 | \ |
@@ -307,11 +311,12 @@ store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | |||
307 | 311 | ||
308 | #define spi_transport_store_max(field, format_string) \ | 312 | #define spi_transport_store_max(field, format_string) \ |
309 | static ssize_t \ | 313 | static ssize_t \ |
310 | store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | 314 | store_spi_transport_##field(struct device *dev, \ |
311 | size_t count) \ | 315 | struct device_attribute *attr, \ |
316 | const char *buf, size_t count) \ | ||
312 | { \ | 317 | { \ |
313 | int val; \ | 318 | int val; \ |
314 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 319 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
315 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ | 320 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ |
316 | struct spi_internal *i = to_spi_internal(shost->transportt); \ | 321 | struct spi_internal *i = to_spi_internal(shost->transportt); \ |
317 | struct spi_transport_attrs *tp \ | 322 | struct spi_transport_attrs *tp \ |
@@ -329,24 +334,24 @@ store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | |||
329 | #define spi_transport_rd_attr(field, format_string) \ | 334 | #define spi_transport_rd_attr(field, format_string) \ |
330 | spi_transport_show_function(field, format_string) \ | 335 | spi_transport_show_function(field, format_string) \ |
331 | spi_transport_store_function(field, format_string) \ | 336 | spi_transport_store_function(field, format_string) \ |
332 | static CLASS_DEVICE_ATTR(field, S_IRUGO, \ | 337 | static DEVICE_ATTR(field, S_IRUGO, \ |
333 | show_spi_transport_##field, \ | 338 | show_spi_transport_##field, \ |
334 | store_spi_transport_##field); | 339 | store_spi_transport_##field); |
335 | 340 | ||
336 | #define spi_transport_simple_attr(field, format_string) \ | 341 | #define spi_transport_simple_attr(field, format_string) \ |
337 | spi_transport_show_simple(field, format_string) \ | 342 | spi_transport_show_simple(field, format_string) \ |
338 | spi_transport_store_simple(field, format_string) \ | 343 | spi_transport_store_simple(field, format_string) \ |
339 | static CLASS_DEVICE_ATTR(field, S_IRUGO, \ | 344 | static DEVICE_ATTR(field, S_IRUGO, \ |
340 | show_spi_transport_##field, \ | 345 | show_spi_transport_##field, \ |
341 | store_spi_transport_##field); | 346 | store_spi_transport_##field); |
342 | 347 | ||
343 | #define spi_transport_max_attr(field, format_string) \ | 348 | #define spi_transport_max_attr(field, format_string) \ |
344 | spi_transport_show_function(field, format_string) \ | 349 | spi_transport_show_function(field, format_string) \ |
345 | spi_transport_store_max(field, format_string) \ | 350 | spi_transport_store_max(field, format_string) \ |
346 | spi_transport_simple_attr(max_##field, format_string) \ | 351 | spi_transport_simple_attr(max_##field, format_string) \ |
347 | static CLASS_DEVICE_ATTR(field, S_IRUGO, \ | 352 | static DEVICE_ATTR(field, S_IRUGO, \ |
348 | show_spi_transport_##field, \ | 353 | show_spi_transport_##field, \ |
349 | store_spi_transport_##field); | 354 | store_spi_transport_##field); |
350 | 355 | ||
351 | /* The Parallel SCSI Tranport Attributes: */ | 356 | /* The Parallel SCSI Tranport Attributes: */ |
352 | spi_transport_max_attr(offset, "%d\n"); | 357 | spi_transport_max_attr(offset, "%d\n"); |
@@ -370,14 +375,15 @@ static int child_iter(struct device *dev, void *data) | |||
370 | } | 375 | } |
371 | 376 | ||
372 | static ssize_t | 377 | static ssize_t |
373 | store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) | 378 | store_spi_revalidate(struct device *dev, struct device_attribute *attr, |
379 | const char *buf, size_t count) | ||
374 | { | 380 | { |
375 | struct scsi_target *starget = transport_class_to_starget(cdev); | 381 | struct scsi_target *starget = transport_class_to_starget(dev); |
376 | 382 | ||
377 | device_for_each_child(&starget->dev, NULL, child_iter); | 383 | device_for_each_child(&starget->dev, NULL, child_iter); |
378 | return count; | 384 | return count; |
379 | } | 385 | } |
380 | static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); | 386 | static DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); |
381 | 387 | ||
382 | /* Translate the period into ns according to the current spec | 388 | /* Translate the period into ns according to the current spec |
383 | * for SDTR/PPR messages */ | 389 | * for SDTR/PPR messages */ |
@@ -412,7 +418,7 @@ show_spi_transport_period_helper(char *buf, int period) | |||
412 | } | 418 | } |
413 | 419 | ||
414 | static ssize_t | 420 | static ssize_t |
415 | store_spi_transport_period_helper(struct class_device *cdev, const char *buf, | 421 | store_spi_transport_period_helper(struct device *dev, const char *buf, |
416 | size_t count, int *periodp) | 422 | size_t count, int *periodp) |
417 | { | 423 | { |
418 | int j, picosec, period = -1; | 424 | int j, picosec, period = -1; |
@@ -449,9 +455,10 @@ store_spi_transport_period_helper(struct class_device *cdev, const char *buf, | |||
449 | } | 455 | } |
450 | 456 | ||
451 | static ssize_t | 457 | static ssize_t |
452 | show_spi_transport_period(struct class_device *cdev, char *buf) | 458 | show_spi_transport_period(struct device *dev, |
459 | struct device_attribute *attr, char *buf) | ||
453 | { | 460 | { |
454 | struct scsi_target *starget = transport_class_to_starget(cdev); | 461 | struct scsi_target *starget = transport_class_to_starget(dev); |
455 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 462 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
456 | struct spi_internal *i = to_spi_internal(shost->transportt); | 463 | struct spi_internal *i = to_spi_internal(shost->transportt); |
457 | struct spi_transport_attrs *tp = | 464 | struct spi_transport_attrs *tp = |
@@ -464,8 +471,8 @@ show_spi_transport_period(struct class_device *cdev, char *buf) | |||
464 | } | 471 | } |
465 | 472 | ||
466 | static ssize_t | 473 | static ssize_t |
467 | store_spi_transport_period(struct class_device *cdev, const char *buf, | 474 | store_spi_transport_period(struct device *cdev, struct device_attribute *attr, |
468 | size_t count) | 475 | const char *buf, size_t count) |
469 | { | 476 | { |
470 | struct scsi_target *starget = transport_class_to_starget(cdev); | 477 | struct scsi_target *starget = transport_class_to_starget(cdev); |
471 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 478 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
@@ -487,12 +494,13 @@ store_spi_transport_period(struct class_device *cdev, const char *buf, | |||
487 | return retval; | 494 | return retval; |
488 | } | 495 | } |
489 | 496 | ||
490 | static CLASS_DEVICE_ATTR(period, S_IRUGO, | 497 | static DEVICE_ATTR(period, S_IRUGO, |
491 | show_spi_transport_period, | 498 | show_spi_transport_period, |
492 | store_spi_transport_period); | 499 | store_spi_transport_period); |
493 | 500 | ||
494 | static ssize_t | 501 | static ssize_t |
495 | show_spi_transport_min_period(struct class_device *cdev, char *buf) | 502 | show_spi_transport_min_period(struct device *cdev, |
503 | struct device_attribute *attr, char *buf) | ||
496 | { | 504 | { |
497 | struct scsi_target *starget = transport_class_to_starget(cdev); | 505 | struct scsi_target *starget = transport_class_to_starget(cdev); |
498 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 506 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
@@ -507,8 +515,9 @@ show_spi_transport_min_period(struct class_device *cdev, char *buf) | |||
507 | } | 515 | } |
508 | 516 | ||
509 | static ssize_t | 517 | static ssize_t |
510 | store_spi_transport_min_period(struct class_device *cdev, const char *buf, | 518 | store_spi_transport_min_period(struct device *cdev, |
511 | size_t count) | 519 | struct device_attribute *attr, |
520 | const char *buf, size_t count) | ||
512 | { | 521 | { |
513 | struct scsi_target *starget = transport_class_to_starget(cdev); | 522 | struct scsi_target *starget = transport_class_to_starget(cdev); |
514 | struct spi_transport_attrs *tp = | 523 | struct spi_transport_attrs *tp = |
@@ -519,12 +528,14 @@ store_spi_transport_min_period(struct class_device *cdev, const char *buf, | |||
519 | } | 528 | } |
520 | 529 | ||
521 | 530 | ||
522 | static CLASS_DEVICE_ATTR(min_period, S_IRUGO, | 531 | static DEVICE_ATTR(min_period, S_IRUGO, |
523 | show_spi_transport_min_period, | 532 | show_spi_transport_min_period, |
524 | store_spi_transport_min_period); | 533 | store_spi_transport_min_period); |
525 | 534 | ||
526 | 535 | ||
527 | static ssize_t show_spi_host_signalling(struct class_device *cdev, char *buf) | 536 | static ssize_t show_spi_host_signalling(struct device *cdev, |
537 | struct device_attribute *attr, | ||
538 | char *buf) | ||
528 | { | 539 | { |
529 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 540 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
530 | struct spi_internal *i = to_spi_internal(shost->transportt); | 541 | struct spi_internal *i = to_spi_internal(shost->transportt); |
@@ -534,10 +545,11 @@ static ssize_t show_spi_host_signalling(struct class_device *cdev, char *buf) | |||
534 | 545 | ||
535 | return sprintf(buf, "%s\n", spi_signal_to_string(spi_signalling(shost))); | 546 | return sprintf(buf, "%s\n", spi_signal_to_string(spi_signalling(shost))); |
536 | } | 547 | } |
537 | static ssize_t store_spi_host_signalling(struct class_device *cdev, | 548 | static ssize_t store_spi_host_signalling(struct device *dev, |
549 | struct device_attribute *attr, | ||
538 | const char *buf, size_t count) | 550 | const char *buf, size_t count) |
539 | { | 551 | { |
540 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 552 | struct Scsi_Host *shost = transport_class_to_shost(dev); |
541 | struct spi_internal *i = to_spi_internal(shost->transportt); | 553 | struct spi_internal *i = to_spi_internal(shost->transportt); |
542 | enum spi_signal_type type = spi_signal_to_value(buf); | 554 | enum spi_signal_type type = spi_signal_to_value(buf); |
543 | 555 | ||
@@ -549,9 +561,9 @@ static ssize_t store_spi_host_signalling(struct class_device *cdev, | |||
549 | 561 | ||
550 | return count; | 562 | return count; |
551 | } | 563 | } |
552 | static CLASS_DEVICE_ATTR(signalling, S_IRUGO, | 564 | static DEVICE_ATTR(signalling, S_IRUGO, |
553 | show_spi_host_signalling, | 565 | show_spi_host_signalling, |
554 | store_spi_host_signalling); | 566 | store_spi_host_signalling); |
555 | 567 | ||
556 | #define DV_SET(x, y) \ | 568 | #define DV_SET(x, y) \ |
557 | if(i->f->set_##x) \ | 569 | if(i->f->set_##x) \ |
@@ -1334,7 +1346,7 @@ static DECLARE_ANON_TRANSPORT_CLASS(spi_device_class, | |||
1334 | spi_device_configure); | 1346 | spi_device_configure); |
1335 | 1347 | ||
1336 | static struct attribute *host_attributes[] = { | 1348 | static struct attribute *host_attributes[] = { |
1337 | &class_device_attr_signalling.attr, | 1349 | &dev_attr_signalling.attr, |
1338 | NULL | 1350 | NULL |
1339 | }; | 1351 | }; |
1340 | 1352 | ||
@@ -1344,12 +1356,12 @@ static struct attribute_group host_attribute_group = { | |||
1344 | 1356 | ||
1345 | static int spi_host_configure(struct transport_container *tc, | 1357 | static int spi_host_configure(struct transport_container *tc, |
1346 | struct device *dev, | 1358 | struct device *dev, |
1347 | struct class_device *cdev) | 1359 | struct device *cdev) |
1348 | { | 1360 | { |
1349 | struct kobject *kobj = &cdev->kobj; | 1361 | struct kobject *kobj = &cdev->kobj; |
1350 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 1362 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
1351 | struct spi_internal *si = to_spi_internal(shost->transportt); | 1363 | struct spi_internal *si = to_spi_internal(shost->transportt); |
1352 | struct attribute *attr = &class_device_attr_signalling.attr; | 1364 | struct attribute *attr = &dev_attr_signalling.attr; |
1353 | int rc = 0; | 1365 | int rc = 0; |
1354 | 1366 | ||
1355 | if (si->f->set_signalling) | 1367 | if (si->f->set_signalling) |
@@ -1368,76 +1380,75 @@ static int spi_host_configure(struct transport_container *tc, | |||
1368 | static int target_attribute_is_visible(struct kobject *kobj, | 1380 | static int target_attribute_is_visible(struct kobject *kobj, |
1369 | struct attribute *attr, int i) | 1381 | struct attribute *attr, int i) |
1370 | { | 1382 | { |
1371 | struct class_device *cdev = | 1383 | struct device *cdev = container_of(kobj, struct device, kobj); |
1372 | container_of(kobj, struct class_device, kobj); | ||
1373 | struct scsi_target *starget = transport_class_to_starget(cdev); | 1384 | struct scsi_target *starget = transport_class_to_starget(cdev); |
1374 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 1385 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
1375 | struct spi_internal *si = to_spi_internal(shost->transportt); | 1386 | struct spi_internal *si = to_spi_internal(shost->transportt); |
1376 | 1387 | ||
1377 | if (attr == &class_device_attr_period.attr && | 1388 | if (attr == &dev_attr_period.attr && |
1378 | spi_support_sync(starget)) | 1389 | spi_support_sync(starget)) |
1379 | return TARGET_ATTRIBUTE_HELPER(period); | 1390 | return TARGET_ATTRIBUTE_HELPER(period); |
1380 | else if (attr == &class_device_attr_min_period.attr && | 1391 | else if (attr == &dev_attr_min_period.attr && |
1381 | spi_support_sync(starget)) | 1392 | spi_support_sync(starget)) |
1382 | return TARGET_ATTRIBUTE_HELPER(period); | 1393 | return TARGET_ATTRIBUTE_HELPER(period); |
1383 | else if (attr == &class_device_attr_offset.attr && | 1394 | else if (attr == &dev_attr_offset.attr && |
1384 | spi_support_sync(starget)) | 1395 | spi_support_sync(starget)) |
1385 | return TARGET_ATTRIBUTE_HELPER(offset); | 1396 | return TARGET_ATTRIBUTE_HELPER(offset); |
1386 | else if (attr == &class_device_attr_max_offset.attr && | 1397 | else if (attr == &dev_attr_max_offset.attr && |
1387 | spi_support_sync(starget)) | 1398 | spi_support_sync(starget)) |
1388 | return TARGET_ATTRIBUTE_HELPER(offset); | 1399 | return TARGET_ATTRIBUTE_HELPER(offset); |
1389 | else if (attr == &class_device_attr_width.attr && | 1400 | else if (attr == &dev_attr_width.attr && |
1390 | spi_support_wide(starget)) | 1401 | spi_support_wide(starget)) |
1391 | return TARGET_ATTRIBUTE_HELPER(width); | 1402 | return TARGET_ATTRIBUTE_HELPER(width); |
1392 | else if (attr == &class_device_attr_max_width.attr && | 1403 | else if (attr == &dev_attr_max_width.attr && |
1393 | spi_support_wide(starget)) | 1404 | spi_support_wide(starget)) |
1394 | return TARGET_ATTRIBUTE_HELPER(width); | 1405 | return TARGET_ATTRIBUTE_HELPER(width); |
1395 | else if (attr == &class_device_attr_iu.attr && | 1406 | else if (attr == &dev_attr_iu.attr && |
1396 | spi_support_ius(starget)) | 1407 | spi_support_ius(starget)) |
1397 | return TARGET_ATTRIBUTE_HELPER(iu); | 1408 | return TARGET_ATTRIBUTE_HELPER(iu); |
1398 | else if (attr == &class_device_attr_dt.attr && | 1409 | else if (attr == &dev_attr_dt.attr && |
1399 | spi_support_dt(starget)) | 1410 | spi_support_dt(starget)) |
1400 | return TARGET_ATTRIBUTE_HELPER(dt); | 1411 | return TARGET_ATTRIBUTE_HELPER(dt); |
1401 | else if (attr == &class_device_attr_qas.attr && | 1412 | else if (attr == &dev_attr_qas.attr && |
1402 | spi_support_qas(starget)) | 1413 | spi_support_qas(starget)) |
1403 | return TARGET_ATTRIBUTE_HELPER(qas); | 1414 | return TARGET_ATTRIBUTE_HELPER(qas); |
1404 | else if (attr == &class_device_attr_wr_flow.attr && | 1415 | else if (attr == &dev_attr_wr_flow.attr && |
1405 | spi_support_ius(starget)) | 1416 | spi_support_ius(starget)) |
1406 | return TARGET_ATTRIBUTE_HELPER(wr_flow); | 1417 | return TARGET_ATTRIBUTE_HELPER(wr_flow); |
1407 | else if (attr == &class_device_attr_rd_strm.attr && | 1418 | else if (attr == &dev_attr_rd_strm.attr && |
1408 | spi_support_ius(starget)) | 1419 | spi_support_ius(starget)) |
1409 | return TARGET_ATTRIBUTE_HELPER(rd_strm); | 1420 | return TARGET_ATTRIBUTE_HELPER(rd_strm); |
1410 | else if (attr == &class_device_attr_rti.attr && | 1421 | else if (attr == &dev_attr_rti.attr && |
1411 | spi_support_ius(starget)) | 1422 | spi_support_ius(starget)) |
1412 | return TARGET_ATTRIBUTE_HELPER(rti); | 1423 | return TARGET_ATTRIBUTE_HELPER(rti); |
1413 | else if (attr == &class_device_attr_pcomp_en.attr && | 1424 | else if (attr == &dev_attr_pcomp_en.attr && |
1414 | spi_support_ius(starget)) | 1425 | spi_support_ius(starget)) |
1415 | return TARGET_ATTRIBUTE_HELPER(pcomp_en); | 1426 | return TARGET_ATTRIBUTE_HELPER(pcomp_en); |
1416 | else if (attr == &class_device_attr_hold_mcs.attr && | 1427 | else if (attr == &dev_attr_hold_mcs.attr && |
1417 | spi_support_ius(starget)) | 1428 | spi_support_ius(starget)) |
1418 | return TARGET_ATTRIBUTE_HELPER(hold_mcs); | 1429 | return TARGET_ATTRIBUTE_HELPER(hold_mcs); |
1419 | else if (attr == &class_device_attr_revalidate.attr) | 1430 | else if (attr == &dev_attr_revalidate.attr) |
1420 | return 1; | 1431 | return 1; |
1421 | 1432 | ||
1422 | return 0; | 1433 | return 0; |
1423 | } | 1434 | } |
1424 | 1435 | ||
1425 | static struct attribute *target_attributes[] = { | 1436 | static struct attribute *target_attributes[] = { |
1426 | &class_device_attr_period.attr, | 1437 | &dev_attr_period.attr, |
1427 | &class_device_attr_min_period.attr, | 1438 | &dev_attr_min_period.attr, |
1428 | &class_device_attr_offset.attr, | 1439 | &dev_attr_offset.attr, |
1429 | &class_device_attr_max_offset.attr, | 1440 | &dev_attr_max_offset.attr, |
1430 | &class_device_attr_width.attr, | 1441 | &dev_attr_width.attr, |
1431 | &class_device_attr_max_width.attr, | 1442 | &dev_attr_max_width.attr, |
1432 | &class_device_attr_iu.attr, | 1443 | &dev_attr_iu.attr, |
1433 | &class_device_attr_dt.attr, | 1444 | &dev_attr_dt.attr, |
1434 | &class_device_attr_qas.attr, | 1445 | &dev_attr_qas.attr, |
1435 | &class_device_attr_wr_flow.attr, | 1446 | &dev_attr_wr_flow.attr, |
1436 | &class_device_attr_rd_strm.attr, | 1447 | &dev_attr_rd_strm.attr, |
1437 | &class_device_attr_rti.attr, | 1448 | &dev_attr_rti.attr, |
1438 | &class_device_attr_pcomp_en.attr, | 1449 | &dev_attr_pcomp_en.attr, |
1439 | &class_device_attr_hold_mcs.attr, | 1450 | &dev_attr_hold_mcs.attr, |
1440 | &class_device_attr_revalidate.attr, | 1451 | &dev_attr_revalidate.attr, |
1441 | NULL | 1452 | NULL |
1442 | }; | 1453 | }; |
1443 | 1454 | ||
@@ -1448,7 +1459,7 @@ static struct attribute_group target_attribute_group = { | |||
1448 | 1459 | ||
1449 | static int spi_target_configure(struct transport_container *tc, | 1460 | static int spi_target_configure(struct transport_container *tc, |
1450 | struct device *dev, | 1461 | struct device *dev, |
1451 | struct class_device *cdev) | 1462 | struct device *cdev) |
1452 | { | 1463 | { |
1453 | struct kobject *kobj = &cdev->kobj; | 1464 | struct kobject *kobj = &cdev->kobj; |
1454 | int i; | 1465 | int i; |
@@ -1462,7 +1473,7 @@ static int spi_target_configure(struct transport_container *tc, | |||
1462 | * to ignore, sysfs also does a WARN_ON and dumps a trace, | 1473 | * to ignore, sysfs also does a WARN_ON and dumps a trace, |
1463 | * which is bad, so temporarily, skip attributes that are | 1474 | * which is bad, so temporarily, skip attributes that are |
1464 | * already visible (the revalidate one) */ | 1475 | * already visible (the revalidate one) */ |
1465 | if (j && attr != &class_device_attr_revalidate.attr) | 1476 | if (j && attr != &dev_attr_revalidate.attr) |
1466 | rc = sysfs_add_file_to_group(kobj, attr, | 1477 | rc = sysfs_add_file_to_group(kobj, attr, |
1467 | target_attribute_group.name); | 1478 | target_attribute_group.name); |
1468 | /* and make the attribute writeable if we have a set | 1479 | /* and make the attribute writeable if we have a set |
diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 2445c98ae95e..8a7af951d98a 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c | |||
@@ -44,20 +44,20 @@ struct srp_internal { | |||
44 | struct scsi_transport_template t; | 44 | struct scsi_transport_template t; |
45 | struct srp_function_template *f; | 45 | struct srp_function_template *f; |
46 | 46 | ||
47 | struct class_device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; | 47 | struct device_attribute *host_attrs[SRP_HOST_ATTRS + 1]; |
48 | 48 | ||
49 | struct class_device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; | 49 | struct device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1]; |
50 | struct class_device_attribute private_rport_attrs[SRP_RPORT_ATTRS]; | 50 | struct device_attribute private_rport_attrs[SRP_RPORT_ATTRS]; |
51 | struct transport_container rport_attr_cont; | 51 | struct transport_container rport_attr_cont; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | #define to_srp_internal(tmpl) container_of(tmpl, struct srp_internal, t) | 54 | #define to_srp_internal(tmpl) container_of(tmpl, struct srp_internal, t) |
55 | 55 | ||
56 | #define dev_to_rport(d) container_of(d, struct srp_rport, dev) | 56 | #define dev_to_rport(d) container_of(d, struct srp_rport, dev) |
57 | #define transport_class_to_srp_rport(cdev) dev_to_rport((cdev)->dev) | 57 | #define transport_class_to_srp_rport(dev) dev_to_rport((dev)->parent) |
58 | 58 | ||
59 | static int srp_host_setup(struct transport_container *tc, struct device *dev, | 59 | static int srp_host_setup(struct transport_container *tc, struct device *dev, |
60 | struct class_device *cdev) | 60 | struct device *cdev) |
61 | { | 61 | { |
62 | struct Scsi_Host *shost = dev_to_shost(dev); | 62 | struct Scsi_Host *shost = dev_to_shost(dev); |
63 | struct srp_host_attrs *srp_host = to_srp_host_attrs(shost); | 63 | struct srp_host_attrs *srp_host = to_srp_host_attrs(shost); |
@@ -73,7 +73,7 @@ static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports", | |||
73 | NULL, NULL, NULL); | 73 | NULL, NULL, NULL); |
74 | 74 | ||
75 | #define SETUP_TEMPLATE(attrb, field, perm, test, ro_test, ro_perm) \ | 75 | #define SETUP_TEMPLATE(attrb, field, perm, test, ro_test, ro_perm) \ |
76 | i->private_##attrb[count] = class_device_attr_##field; \ | 76 | i->private_##attrb[count] = dev_attr_##field; \ |
77 | i->private_##attrb[count].attr.mode = perm; \ | 77 | i->private_##attrb[count].attr.mode = perm; \ |
78 | if (ro_test) { \ | 78 | if (ro_test) { \ |
79 | i->private_##attrb[count].attr.mode = ro_perm; \ | 79 | i->private_##attrb[count].attr.mode = ro_perm; \ |
@@ -100,13 +100,14 @@ static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports", | |||
100 | "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" | 100 | "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" |
101 | 101 | ||
102 | static ssize_t | 102 | static ssize_t |
103 | show_srp_rport_id(struct class_device *cdev, char *buf) | 103 | show_srp_rport_id(struct device *dev, struct device_attribute *attr, |
104 | char *buf) | ||
104 | { | 105 | { |
105 | struct srp_rport *rport = transport_class_to_srp_rport(cdev); | 106 | struct srp_rport *rport = transport_class_to_srp_rport(dev); |
106 | return sprintf(buf, SRP_PID_FMT "\n", SRP_PID(rport)); | 107 | return sprintf(buf, SRP_PID_FMT "\n", SRP_PID(rport)); |
107 | } | 108 | } |
108 | 109 | ||
109 | static CLASS_DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL); | 110 | static DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL); |
110 | 111 | ||
111 | static const struct { | 112 | static const struct { |
112 | u32 value; | 113 | u32 value; |
@@ -117,9 +118,10 @@ static const struct { | |||
117 | }; | 118 | }; |
118 | 119 | ||
119 | static ssize_t | 120 | static ssize_t |
120 | show_srp_rport_roles(struct class_device *cdev, char *buf) | 121 | show_srp_rport_roles(struct device *dev, struct device_attribute *attr, |
122 | char *buf) | ||
121 | { | 123 | { |
122 | struct srp_rport *rport = transport_class_to_srp_rport(cdev); | 124 | struct srp_rport *rport = transport_class_to_srp_rport(dev); |
123 | int i; | 125 | int i; |
124 | char *name = NULL; | 126 | char *name = NULL; |
125 | 127 | ||
@@ -131,7 +133,7 @@ show_srp_rport_roles(struct class_device *cdev, char *buf) | |||
131 | return sprintf(buf, "%s\n", name ? : "unknown"); | 133 | return sprintf(buf, "%s\n", name ? : "unknown"); |
132 | } | 134 | } |
133 | 135 | ||
134 | static CLASS_DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); | 136 | static DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL); |
135 | 137 | ||
136 | static void srp_rport_release(struct device *dev) | 138 | static void srp_rport_release(struct device *dev) |
137 | { | 139 | { |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5fe7aaed904c..3cea17dd5dba 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -95,7 +95,7 @@ static int sd_resume(struct device *); | |||
95 | static void sd_rescan(struct device *); | 95 | static void sd_rescan(struct device *); |
96 | static int sd_done(struct scsi_cmnd *); | 96 | static int sd_done(struct scsi_cmnd *); |
97 | static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); | 97 | static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer); |
98 | static void scsi_disk_release(struct class_device *cdev); | 98 | static void scsi_disk_release(struct device *cdev); |
99 | static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); | 99 | static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *); |
100 | static void sd_print_result(struct scsi_disk *, int); | 100 | static void sd_print_result(struct scsi_disk *, int); |
101 | 101 | ||
@@ -112,11 +112,12 @@ static const char *sd_cache_types[] = { | |||
112 | "write back, no read (daft)" | 112 | "write back, no read (daft)" |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, | 115 | static ssize_t |
116 | size_t count) | 116 | sd_store_cache_type(struct device *dev, struct device_attribute *attr, |
117 | const char *buf, size_t count) | ||
117 | { | 118 | { |
118 | int i, ct = -1, rcd, wce, sp; | 119 | int i, ct = -1, rcd, wce, sp; |
119 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 120 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
120 | struct scsi_device *sdp = sdkp->device; | 121 | struct scsi_device *sdp = sdkp->device; |
121 | char buffer[64]; | 122 | char buffer[64]; |
122 | char *buffer_data; | 123 | char *buffer_data; |
@@ -163,10 +164,11 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, | |||
163 | return count; | 164 | return count; |
164 | } | 165 | } |
165 | 166 | ||
166 | static ssize_t sd_store_manage_start_stop(struct class_device *cdev, | 167 | static ssize_t |
167 | const char *buf, size_t count) | 168 | sd_store_manage_start_stop(struct device *dev, struct device_attribute *attr, |
169 | const char *buf, size_t count) | ||
168 | { | 170 | { |
169 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 171 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
170 | struct scsi_device *sdp = sdkp->device; | 172 | struct scsi_device *sdp = sdkp->device; |
171 | 173 | ||
172 | if (!capable(CAP_SYS_ADMIN)) | 174 | if (!capable(CAP_SYS_ADMIN)) |
@@ -177,10 +179,11 @@ static ssize_t sd_store_manage_start_stop(struct class_device *cdev, | |||
177 | return count; | 179 | return count; |
178 | } | 180 | } |
179 | 181 | ||
180 | static ssize_t sd_store_allow_restart(struct class_device *cdev, const char *buf, | 182 | static ssize_t |
181 | size_t count) | 183 | sd_store_allow_restart(struct device *dev, struct device_attribute *attr, |
184 | const char *buf, size_t count) | ||
182 | { | 185 | { |
183 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 186 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
184 | struct scsi_device *sdp = sdkp->device; | 187 | struct scsi_device *sdp = sdkp->device; |
185 | 188 | ||
186 | if (!capable(CAP_SYS_ADMIN)) | 189 | if (!capable(CAP_SYS_ADMIN)) |
@@ -194,37 +197,44 @@ static ssize_t sd_store_allow_restart(struct class_device *cdev, const char *buf | |||
194 | return count; | 197 | return count; |
195 | } | 198 | } |
196 | 199 | ||
197 | static ssize_t sd_show_cache_type(struct class_device *cdev, char *buf) | 200 | static ssize_t |
201 | sd_show_cache_type(struct device *dev, struct device_attribute *attr, | ||
202 | char *buf) | ||
198 | { | 203 | { |
199 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 204 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
200 | int ct = sdkp->RCD + 2*sdkp->WCE; | 205 | int ct = sdkp->RCD + 2*sdkp->WCE; |
201 | 206 | ||
202 | return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); | 207 | return snprintf(buf, 40, "%s\n", sd_cache_types[ct]); |
203 | } | 208 | } |
204 | 209 | ||
205 | static ssize_t sd_show_fua(struct class_device *cdev, char *buf) | 210 | static ssize_t |
211 | sd_show_fua(struct device *dev, struct device_attribute *attr, char *buf) | ||
206 | { | 212 | { |
207 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 213 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
208 | 214 | ||
209 | return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); | 215 | return snprintf(buf, 20, "%u\n", sdkp->DPOFUA); |
210 | } | 216 | } |
211 | 217 | ||
212 | static ssize_t sd_show_manage_start_stop(struct class_device *cdev, char *buf) | 218 | static ssize_t |
219 | sd_show_manage_start_stop(struct device *dev, struct device_attribute *attr, | ||
220 | char *buf) | ||
213 | { | 221 | { |
214 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 222 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
215 | struct scsi_device *sdp = sdkp->device; | 223 | struct scsi_device *sdp = sdkp->device; |
216 | 224 | ||
217 | return snprintf(buf, 20, "%u\n", sdp->manage_start_stop); | 225 | return snprintf(buf, 20, "%u\n", sdp->manage_start_stop); |
218 | } | 226 | } |
219 | 227 | ||
220 | static ssize_t sd_show_allow_restart(struct class_device *cdev, char *buf) | 228 | static ssize_t |
229 | sd_show_allow_restart(struct device *dev, struct device_attribute *attr, | ||
230 | char *buf) | ||
221 | { | 231 | { |
222 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 232 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
223 | 233 | ||
224 | return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); | 234 | return snprintf(buf, 40, "%d\n", sdkp->device->allow_restart); |
225 | } | 235 | } |
226 | 236 | ||
227 | static struct class_device_attribute sd_disk_attrs[] = { | 237 | static struct device_attribute sd_disk_attrs[] = { |
228 | __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, | 238 | __ATTR(cache_type, S_IRUGO|S_IWUSR, sd_show_cache_type, |
229 | sd_store_cache_type), | 239 | sd_store_cache_type), |
230 | __ATTR(FUA, S_IRUGO, sd_show_fua, NULL), | 240 | __ATTR(FUA, S_IRUGO, sd_show_fua, NULL), |
@@ -238,8 +248,8 @@ static struct class_device_attribute sd_disk_attrs[] = { | |||
238 | static struct class sd_disk_class = { | 248 | static struct class sd_disk_class = { |
239 | .name = "scsi_disk", | 249 | .name = "scsi_disk", |
240 | .owner = THIS_MODULE, | 250 | .owner = THIS_MODULE, |
241 | .release = scsi_disk_release, | 251 | .dev_release = scsi_disk_release, |
242 | .class_dev_attrs = sd_disk_attrs, | 252 | .dev_attrs = sd_disk_attrs, |
243 | }; | 253 | }; |
244 | 254 | ||
245 | static struct scsi_driver sd_template = { | 255 | static struct scsi_driver sd_template = { |
@@ -297,7 +307,7 @@ static struct scsi_disk *__scsi_disk_get(struct gendisk *disk) | |||
297 | if (disk->private_data) { | 307 | if (disk->private_data) { |
298 | sdkp = scsi_disk(disk); | 308 | sdkp = scsi_disk(disk); |
299 | if (scsi_device_get(sdkp->device) == 0) | 309 | if (scsi_device_get(sdkp->device) == 0) |
300 | class_device_get(&sdkp->cdev); | 310 | get_device(&sdkp->dev); |
301 | else | 311 | else |
302 | sdkp = NULL; | 312 | sdkp = NULL; |
303 | } | 313 | } |
@@ -331,7 +341,7 @@ static void scsi_disk_put(struct scsi_disk *sdkp) | |||
331 | struct scsi_device *sdev = sdkp->device; | 341 | struct scsi_device *sdev = sdkp->device; |
332 | 342 | ||
333 | mutex_lock(&sd_ref_mutex); | 343 | mutex_lock(&sd_ref_mutex); |
334 | class_device_put(&sdkp->cdev); | 344 | put_device(&sdkp->dev); |
335 | scsi_device_put(sdev); | 345 | scsi_device_put(sdev); |
336 | mutex_unlock(&sd_ref_mutex); | 346 | mutex_unlock(&sd_ref_mutex); |
337 | } | 347 | } |
@@ -1663,12 +1673,12 @@ static int sd_probe(struct device *dev) | |||
1663 | sdp->timeout = SD_MOD_TIMEOUT; | 1673 | sdp->timeout = SD_MOD_TIMEOUT; |
1664 | } | 1674 | } |
1665 | 1675 | ||
1666 | class_device_initialize(&sdkp->cdev); | 1676 | device_initialize(&sdkp->dev); |
1667 | sdkp->cdev.dev = &sdp->sdev_gendev; | 1677 | sdkp->dev.parent = &sdp->sdev_gendev; |
1668 | sdkp->cdev.class = &sd_disk_class; | 1678 | sdkp->dev.class = &sd_disk_class; |
1669 | strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); | 1679 | strncpy(sdkp->dev.bus_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); |
1670 | 1680 | ||
1671 | if (class_device_add(&sdkp->cdev)) | 1681 | if (device_add(&sdkp->dev)) |
1672 | goto out_put; | 1682 | goto out_put; |
1673 | 1683 | ||
1674 | get_device(&sdp->sdev_gendev); | 1684 | get_device(&sdp->sdev_gendev); |
@@ -1734,13 +1744,13 @@ static int sd_remove(struct device *dev) | |||
1734 | { | 1744 | { |
1735 | struct scsi_disk *sdkp = dev_get_drvdata(dev); | 1745 | struct scsi_disk *sdkp = dev_get_drvdata(dev); |
1736 | 1746 | ||
1737 | class_device_del(&sdkp->cdev); | 1747 | device_del(&sdkp->dev); |
1738 | del_gendisk(sdkp->disk); | 1748 | del_gendisk(sdkp->disk); |
1739 | sd_shutdown(dev); | 1749 | sd_shutdown(dev); |
1740 | 1750 | ||
1741 | mutex_lock(&sd_ref_mutex); | 1751 | mutex_lock(&sd_ref_mutex); |
1742 | dev_set_drvdata(dev, NULL); | 1752 | dev_set_drvdata(dev, NULL); |
1743 | class_device_put(&sdkp->cdev); | 1753 | put_device(&sdkp->dev); |
1744 | mutex_unlock(&sd_ref_mutex); | 1754 | mutex_unlock(&sd_ref_mutex); |
1745 | 1755 | ||
1746 | return 0; | 1756 | return 0; |
@@ -1748,16 +1758,16 @@ static int sd_remove(struct device *dev) | |||
1748 | 1758 | ||
1749 | /** | 1759 | /** |
1750 | * scsi_disk_release - Called to free the scsi_disk structure | 1760 | * scsi_disk_release - Called to free the scsi_disk structure |
1751 | * @cdev: pointer to embedded class device | 1761 | * @dev: pointer to embedded class device |
1752 | * | 1762 | * |
1753 | * sd_ref_mutex must be held entering this routine. Because it is | 1763 | * sd_ref_mutex must be held entering this routine. Because it is |
1754 | * called on last put, you should always use the scsi_disk_get() | 1764 | * called on last put, you should always use the scsi_disk_get() |
1755 | * scsi_disk_put() helpers which manipulate the semaphore directly | 1765 | * scsi_disk_put() helpers which manipulate the semaphore directly |
1756 | * and never do a direct class_device_put(). | 1766 | * and never do a direct put_device. |
1757 | **/ | 1767 | **/ |
1758 | static void scsi_disk_release(struct class_device *cdev) | 1768 | static void scsi_disk_release(struct device *dev) |
1759 | { | 1769 | { |
1760 | struct scsi_disk *sdkp = to_scsi_disk(cdev); | 1770 | struct scsi_disk *sdkp = to_scsi_disk(dev); |
1761 | struct gendisk *disk = sdkp->disk; | 1771 | struct gendisk *disk = sdkp->disk; |
1762 | 1772 | ||
1763 | spin_lock(&sd_index_lock); | 1773 | spin_lock(&sd_index_lock); |
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c index a6d96694d0a5..45df83b9d847 100644 --- a/drivers/scsi/ses.c +++ b/drivers/scsi/ses.c | |||
@@ -107,7 +107,7 @@ static int ses_set_page2_descriptor(struct enclosure_device *edev, | |||
107 | unsigned char *desc) | 107 | unsigned char *desc) |
108 | { | 108 | { |
109 | int i, j, count = 0, descriptor = ecomp->number; | 109 | int i, j, count = 0, descriptor = ecomp->number; |
110 | struct scsi_device *sdev = to_scsi_device(edev->cdev.dev); | 110 | struct scsi_device *sdev = to_scsi_device(edev->edev.parent); |
111 | struct ses_device *ses_dev = edev->scratch; | 111 | struct ses_device *ses_dev = edev->scratch; |
112 | unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; | 112 | unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; |
113 | unsigned char *desc_ptr = ses_dev->page2 + 8; | 113 | unsigned char *desc_ptr = ses_dev->page2 + 8; |
@@ -137,7 +137,7 @@ static unsigned char *ses_get_page2_descriptor(struct enclosure_device *edev, | |||
137 | struct enclosure_component *ecomp) | 137 | struct enclosure_component *ecomp) |
138 | { | 138 | { |
139 | int i, j, count = 0, descriptor = ecomp->number; | 139 | int i, j, count = 0, descriptor = ecomp->number; |
140 | struct scsi_device *sdev = to_scsi_device(edev->cdev.dev); | 140 | struct scsi_device *sdev = to_scsi_device(edev->edev.parent); |
141 | struct ses_device *ses_dev = edev->scratch; | 141 | struct ses_device *ses_dev = edev->scratch; |
142 | unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; | 142 | unsigned char *type_ptr = ses_dev->page1 + 12 + ses_dev->page1[11]; |
143 | unsigned char *desc_ptr = ses_dev->page2 + 8; | 143 | unsigned char *desc_ptr = ses_dev->page2 + 8; |
@@ -269,10 +269,10 @@ int ses_match_host(struct enclosure_device *edev, void *data) | |||
269 | struct ses_host_edev *sed = data; | 269 | struct ses_host_edev *sed = data; |
270 | struct scsi_device *sdev; | 270 | struct scsi_device *sdev; |
271 | 271 | ||
272 | if (!scsi_is_sdev_device(edev->cdev.dev)) | 272 | if (!scsi_is_sdev_device(edev->edev.parent)) |
273 | return 0; | 273 | return 0; |
274 | 274 | ||
275 | sdev = to_scsi_device(edev->cdev.dev); | 275 | sdev = to_scsi_device(edev->edev.parent); |
276 | 276 | ||
277 | if (sdev->host != sed->shost) | 277 | if (sdev->host != sed->shost) |
278 | return 0; | 278 | return 0; |
@@ -407,10 +407,10 @@ static void ses_match_to_enclosure(struct enclosure_device *edev, | |||
407 | 407 | ||
408 | #define INIT_ALLOC_SIZE 32 | 408 | #define INIT_ALLOC_SIZE 32 |
409 | 409 | ||
410 | static int ses_intf_add(struct class_device *cdev, | 410 | static int ses_intf_add(struct device *cdev, |
411 | struct class_interface *intf) | 411 | struct class_interface *intf) |
412 | { | 412 | { |
413 | struct scsi_device *sdev = to_scsi_device(cdev->dev); | 413 | struct scsi_device *sdev = to_scsi_device(cdev->parent); |
414 | struct scsi_device *tmp_sdev; | 414 | struct scsi_device *tmp_sdev; |
415 | unsigned char *buf = NULL, *hdr_buf, *type_ptr, *desc_ptr = NULL, | 415 | unsigned char *buf = NULL, *hdr_buf, *type_ptr, *desc_ptr = NULL, |
416 | *addl_desc_ptr = NULL; | 416 | *addl_desc_ptr = NULL; |
@@ -426,7 +426,7 @@ static int ses_intf_add(struct class_device *cdev, | |||
426 | edev = enclosure_find(&sdev->host->shost_gendev); | 426 | edev = enclosure_find(&sdev->host->shost_gendev); |
427 | if (edev) { | 427 | if (edev) { |
428 | ses_match_to_enclosure(edev, sdev); | 428 | ses_match_to_enclosure(edev, sdev); |
429 | class_device_put(&edev->cdev); | 429 | put_device(&edev->edev); |
430 | } | 430 | } |
431 | return -ENODEV; | 431 | return -ENODEV; |
432 | } | 432 | } |
@@ -515,7 +515,7 @@ static int ses_intf_add(struct class_device *cdev, | |||
515 | if (!scomp) | 515 | if (!scomp) |
516 | goto err_free; | 516 | goto err_free; |
517 | 517 | ||
518 | edev = enclosure_register(cdev->dev, sdev->sdev_gendev.bus_id, | 518 | edev = enclosure_register(cdev->parent, sdev->sdev_gendev.bus_id, |
519 | components, &ses_enclosure_callbacks); | 519 | components, &ses_enclosure_callbacks); |
520 | if (IS_ERR(edev)) { | 520 | if (IS_ERR(edev)) { |
521 | err = PTR_ERR(edev); | 521 | err = PTR_ERR(edev); |
@@ -625,17 +625,17 @@ static int ses_remove(struct device *dev) | |||
625 | return 0; | 625 | return 0; |
626 | } | 626 | } |
627 | 627 | ||
628 | static void ses_intf_remove(struct class_device *cdev, | 628 | static void ses_intf_remove(struct device *cdev, |
629 | struct class_interface *intf) | 629 | struct class_interface *intf) |
630 | { | 630 | { |
631 | struct scsi_device *sdev = to_scsi_device(cdev->dev); | 631 | struct scsi_device *sdev = to_scsi_device(cdev->parent); |
632 | struct enclosure_device *edev; | 632 | struct enclosure_device *edev; |
633 | struct ses_device *ses_dev; | 633 | struct ses_device *ses_dev; |
634 | 634 | ||
635 | if (!scsi_device_enclosure(sdev)) | 635 | if (!scsi_device_enclosure(sdev)) |
636 | return; | 636 | return; |
637 | 637 | ||
638 | edev = enclosure_find(cdev->dev); | 638 | edev = enclosure_find(cdev->parent); |
639 | if (!edev) | 639 | if (!edev) |
640 | return; | 640 | return; |
641 | 641 | ||
@@ -649,13 +649,13 @@ static void ses_intf_remove(struct class_device *cdev, | |||
649 | 649 | ||
650 | kfree(edev->component[0].scratch); | 650 | kfree(edev->component[0].scratch); |
651 | 651 | ||
652 | class_device_put(&edev->cdev); | 652 | put_device(&edev->edev); |
653 | enclosure_unregister(edev); | 653 | enclosure_unregister(edev); |
654 | } | 654 | } |
655 | 655 | ||
656 | static struct class_interface ses_interface = { | 656 | static struct class_interface ses_interface = { |
657 | .add = ses_intf_add, | 657 | .add_dev = ses_intf_add, |
658 | .remove = ses_intf_remove, | 658 | .remove_dev = ses_intf_remove, |
659 | }; | 659 | }; |
660 | 660 | ||
661 | static struct scsi_driver ses_template = { | 661 | static struct scsi_driver ses_template = { |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index e5156aa6dd20..2029422bc04d 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -101,16 +101,16 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ; | |||
101 | #define SG_SECTOR_SZ 512 | 101 | #define SG_SECTOR_SZ 512 |
102 | #define SG_SECTOR_MSK (SG_SECTOR_SZ - 1) | 102 | #define SG_SECTOR_MSK (SG_SECTOR_SZ - 1) |
103 | 103 | ||
104 | static int sg_add(struct class_device *, struct class_interface *); | 104 | static int sg_add(struct device *, struct class_interface *); |
105 | static void sg_remove(struct class_device *, struct class_interface *); | 105 | static void sg_remove(struct device *, struct class_interface *); |
106 | 106 | ||
107 | static DEFINE_IDR(sg_index_idr); | 107 | static DEFINE_IDR(sg_index_idr); |
108 | static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock | 108 | static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock |
109 | file descriptor list for device */ | 109 | file descriptor list for device */ |
110 | 110 | ||
111 | static struct class_interface sg_interface = { | 111 | static struct class_interface sg_interface = { |
112 | .add = sg_add, | 112 | .add_dev = sg_add, |
113 | .remove = sg_remove, | 113 | .remove_dev = sg_remove, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ | 116 | typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */ |
@@ -1401,9 +1401,9 @@ static Sg_device *sg_alloc(struct gendisk *disk, struct scsi_device *scsidp) | |||
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | static int | 1403 | static int |
1404 | sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) | 1404 | sg_add(struct device *cl_dev, struct class_interface *cl_intf) |
1405 | { | 1405 | { |
1406 | struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); | 1406 | struct scsi_device *scsidp = to_scsi_device(cl_dev->parent); |
1407 | struct gendisk *disk; | 1407 | struct gendisk *disk; |
1408 | Sg_device *sdp = NULL; | 1408 | Sg_device *sdp = NULL; |
1409 | struct cdev * cdev = NULL; | 1409 | struct cdev * cdev = NULL; |
@@ -1439,19 +1439,19 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) | |||
1439 | 1439 | ||
1440 | sdp->cdev = cdev; | 1440 | sdp->cdev = cdev; |
1441 | if (sg_sysfs_valid) { | 1441 | if (sg_sysfs_valid) { |
1442 | struct class_device * sg_class_member; | 1442 | struct device *sg_class_member; |
1443 | 1443 | ||
1444 | sg_class_member = class_device_create(sg_sysfs_class, NULL, | 1444 | sg_class_member = device_create(sg_sysfs_class, cl_dev->parent, |
1445 | MKDEV(SCSI_GENERIC_MAJOR, sdp->index), | 1445 | MKDEV(SCSI_GENERIC_MAJOR, |
1446 | cl_dev->dev, "%s", | 1446 | sdp->index), |
1447 | disk->disk_name); | 1447 | "%s", disk->disk_name); |
1448 | if (IS_ERR(sg_class_member)) { | 1448 | if (IS_ERR(sg_class_member)) { |
1449 | printk(KERN_ERR "sg_add: " | 1449 | printk(KERN_ERR "sg_add: " |
1450 | "class_device_create failed\n"); | 1450 | "device_create failed\n"); |
1451 | error = PTR_ERR(sg_class_member); | 1451 | error = PTR_ERR(sg_class_member); |
1452 | goto cdev_add_err; | 1452 | goto cdev_add_err; |
1453 | } | 1453 | } |
1454 | class_set_devdata(sg_class_member, sdp); | 1454 | dev_set_drvdata(sg_class_member, sdp); |
1455 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, | 1455 | error = sysfs_create_link(&scsidp->sdev_gendev.kobj, |
1456 | &sg_class_member->kobj, "generic"); | 1456 | &sg_class_member->kobj, "generic"); |
1457 | if (error) | 1457 | if (error) |
@@ -1464,7 +1464,7 @@ sg_add(struct class_device *cl_dev, struct class_interface *cl_intf) | |||
1464 | "Attached scsi generic sg%d type %d\n", sdp->index, | 1464 | "Attached scsi generic sg%d type %d\n", sdp->index, |
1465 | scsidp->type); | 1465 | scsidp->type); |
1466 | 1466 | ||
1467 | class_set_devdata(cl_dev, sdp); | 1467 | dev_set_drvdata(cl_dev, sdp); |
1468 | 1468 | ||
1469 | return 0; | 1469 | return 0; |
1470 | 1470 | ||
@@ -1482,10 +1482,10 @@ out: | |||
1482 | } | 1482 | } |
1483 | 1483 | ||
1484 | static void | 1484 | static void |
1485 | sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf) | 1485 | sg_remove(struct device *cl_dev, struct class_interface *cl_intf) |
1486 | { | 1486 | { |
1487 | struct scsi_device *scsidp = to_scsi_device(cl_dev->dev); | 1487 | struct scsi_device *scsidp = to_scsi_device(cl_dev->parent); |
1488 | Sg_device *sdp = class_get_devdata(cl_dev); | 1488 | Sg_device *sdp = dev_get_drvdata(cl_dev); |
1489 | unsigned long iflags; | 1489 | unsigned long iflags; |
1490 | Sg_fd *sfp; | 1490 | Sg_fd *sfp; |
1491 | Sg_fd *tsfp; | 1491 | Sg_fd *tsfp; |
@@ -1528,7 +1528,7 @@ sg_remove(struct class_device *cl_dev, struct class_interface *cl_intf) | |||
1528 | write_unlock_irqrestore(&sg_index_lock, iflags); | 1528 | write_unlock_irqrestore(&sg_index_lock, iflags); |
1529 | 1529 | ||
1530 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); | 1530 | sysfs_remove_link(&scsidp->sdev_gendev.kobj, "generic"); |
1531 | class_device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); | 1531 | device_destroy(sg_sysfs_class, MKDEV(SCSI_GENERIC_MAJOR, sdp->index)); |
1532 | cdev_del(sdp->cdev); | 1532 | cdev_del(sdp->cdev); |
1533 | sdp->cdev = NULL; | 1533 | sdp->cdev = NULL; |
1534 | put_disk(sdp->disk); | 1534 | put_disk(sdp->disk); |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index df83bea2c620..a860c3a9ae99 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4108,9 +4108,9 @@ out_free_tape: | |||
4108 | if (STm->cdevs[j]) { | 4108 | if (STm->cdevs[j]) { |
4109 | if (cdev == STm->cdevs[j]) | 4109 | if (cdev == STm->cdevs[j]) |
4110 | cdev = NULL; | 4110 | cdev = NULL; |
4111 | class_device_destroy(st_sysfs_class, | 4111 | device_destroy(st_sysfs_class, |
4112 | MKDEV(SCSI_TAPE_MAJOR, | 4112 | MKDEV(SCSI_TAPE_MAJOR, |
4113 | TAPE_MINOR(i, mode, j))); | 4113 | TAPE_MINOR(i, mode, j))); |
4114 | cdev_del(STm->cdevs[j]); | 4114 | cdev_del(STm->cdevs[j]); |
4115 | } | 4115 | } |
4116 | } | 4116 | } |
@@ -4148,9 +4148,9 @@ static int st_remove(struct device *dev) | |||
4148 | "tape"); | 4148 | "tape"); |
4149 | for (mode = 0; mode < ST_NBR_MODES; ++mode) { | 4149 | for (mode = 0; mode < ST_NBR_MODES; ++mode) { |
4150 | for (j=0; j < 2; j++) { | 4150 | for (j=0; j < 2; j++) { |
4151 | class_device_destroy(st_sysfs_class, | 4151 | device_destroy(st_sysfs_class, |
4152 | MKDEV(SCSI_TAPE_MAJOR, | 4152 | MKDEV(SCSI_TAPE_MAJOR, |
4153 | TAPE_MINOR(i, mode, j))); | 4153 | TAPE_MINOR(i, mode, j))); |
4154 | cdev_del(tpnt->modes[mode].cdevs[j]); | 4154 | cdev_del(tpnt->modes[mode].cdevs[j]); |
4155 | tpnt->modes[mode].cdevs[j] = NULL; | 4155 | tpnt->modes[mode].cdevs[j] = NULL; |
4156 | } | 4156 | } |
@@ -4319,31 +4319,34 @@ static void do_remove_sysfs_files(void) | |||
4319 | 4319 | ||
4320 | 4320 | ||
4321 | /* The sysfs simple class interface */ | 4321 | /* The sysfs simple class interface */ |
4322 | static ssize_t st_defined_show(struct class_device *class_dev, char *buf) | 4322 | static ssize_t |
4323 | st_defined_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
4323 | { | 4324 | { |
4324 | struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); | 4325 | struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); |
4325 | ssize_t l = 0; | 4326 | ssize_t l = 0; |
4326 | 4327 | ||
4327 | l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); | 4328 | l = snprintf(buf, PAGE_SIZE, "%d\n", STm->defined); |
4328 | return l; | 4329 | return l; |
4329 | } | 4330 | } |
4330 | 4331 | ||
4331 | CLASS_DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL); | 4332 | DEVICE_ATTR(defined, S_IRUGO, st_defined_show, NULL); |
4332 | 4333 | ||
4333 | static ssize_t st_defblk_show(struct class_device *class_dev, char *buf) | 4334 | static ssize_t |
4335 | st_defblk_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
4334 | { | 4336 | { |
4335 | struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); | 4337 | struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); |
4336 | ssize_t l = 0; | 4338 | ssize_t l = 0; |
4337 | 4339 | ||
4338 | l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); | 4340 | l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_blksize); |
4339 | return l; | 4341 | return l; |
4340 | } | 4342 | } |
4341 | 4343 | ||
4342 | CLASS_DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL); | 4344 | DEVICE_ATTR(default_blksize, S_IRUGO, st_defblk_show, NULL); |
4343 | 4345 | ||
4344 | static ssize_t st_defdensity_show(struct class_device *class_dev, char *buf) | 4346 | static ssize_t |
4347 | st_defdensity_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
4345 | { | 4348 | { |
4346 | struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); | 4349 | struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); |
4347 | ssize_t l = 0; | 4350 | ssize_t l = 0; |
4348 | char *fmt; | 4351 | char *fmt; |
4349 | 4352 | ||
@@ -4352,22 +4355,25 @@ static ssize_t st_defdensity_show(struct class_device *class_dev, char *buf) | |||
4352 | return l; | 4355 | return l; |
4353 | } | 4356 | } |
4354 | 4357 | ||
4355 | CLASS_DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL); | 4358 | DEVICE_ATTR(default_density, S_IRUGO, st_defdensity_show, NULL); |
4356 | 4359 | ||
4357 | static ssize_t st_defcompression_show(struct class_device *class_dev, char *buf) | 4360 | static ssize_t |
4361 | st_defcompression_show(struct device *dev, struct device_attribute *attr, | ||
4362 | char *buf) | ||
4358 | { | 4363 | { |
4359 | struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); | 4364 | struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); |
4360 | ssize_t l = 0; | 4365 | ssize_t l = 0; |
4361 | 4366 | ||
4362 | l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); | 4367 | l = snprintf(buf, PAGE_SIZE, "%d\n", STm->default_compression - 1); |
4363 | return l; | 4368 | return l; |
4364 | } | 4369 | } |
4365 | 4370 | ||
4366 | CLASS_DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); | 4371 | DEVICE_ATTR(default_compression, S_IRUGO, st_defcompression_show, NULL); |
4367 | 4372 | ||
4368 | static ssize_t st_options_show(struct class_device *class_dev, char *buf) | 4373 | static ssize_t |
4374 | st_options_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
4369 | { | 4375 | { |
4370 | struct st_modedef *STm = (struct st_modedef *)class_get_devdata(class_dev); | 4376 | struct st_modedef *STm = (struct st_modedef *)dev_get_drvdata(dev); |
4371 | struct scsi_tape *STp; | 4377 | struct scsi_tape *STp; |
4372 | int i, j, options; | 4378 | int i, j, options; |
4373 | ssize_t l = 0; | 4379 | ssize_t l = 0; |
@@ -4403,13 +4409,13 @@ static ssize_t st_options_show(struct class_device *class_dev, char *buf) | |||
4403 | return l; | 4409 | return l; |
4404 | } | 4410 | } |
4405 | 4411 | ||
4406 | CLASS_DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL); | 4412 | DEVICE_ATTR(options, S_IRUGO, st_options_show, NULL); |
4407 | 4413 | ||
4408 | static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | 4414 | static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) |
4409 | { | 4415 | { |
4410 | int i, rew, error; | 4416 | int i, rew, error; |
4411 | char name[10]; | 4417 | char name[10]; |
4412 | struct class_device *st_class_member; | 4418 | struct device *st_class_member; |
4413 | 4419 | ||
4414 | for (rew=0; rew < 2; rew++) { | 4420 | for (rew=0; rew < 2; rew++) { |
4415 | /* Make sure that the minor numbers corresponding to the four | 4421 | /* Make sure that the minor numbers corresponding to the four |
@@ -4418,32 +4424,32 @@ static int do_create_class_files(struct scsi_tape *STp, int dev_num, int mode) | |||
4418 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", | 4424 | snprintf(name, 10, "%s%s%s", rew ? "n" : "", |
4419 | STp->disk->disk_name, st_formats[i]); | 4425 | STp->disk->disk_name, st_formats[i]); |
4420 | st_class_member = | 4426 | st_class_member = |
4421 | class_device_create(st_sysfs_class, NULL, | 4427 | device_create(st_sysfs_class, &STp->device->sdev_gendev, |
4422 | MKDEV(SCSI_TAPE_MAJOR, | 4428 | MKDEV(SCSI_TAPE_MAJOR, |
4423 | TAPE_MINOR(dev_num, mode, rew)), | 4429 | TAPE_MINOR(dev_num, mode, rew)), |
4424 | &STp->device->sdev_gendev, "%s", name); | 4430 | "%s", name); |
4425 | if (IS_ERR(st_class_member)) { | 4431 | if (IS_ERR(st_class_member)) { |
4426 | printk(KERN_WARNING "st%d: class_device_create failed\n", | 4432 | printk(KERN_WARNING "st%d: device_create failed\n", |
4427 | dev_num); | 4433 | dev_num); |
4428 | error = PTR_ERR(st_class_member); | 4434 | error = PTR_ERR(st_class_member); |
4429 | goto out; | 4435 | goto out; |
4430 | } | 4436 | } |
4431 | class_set_devdata(st_class_member, &STp->modes[mode]); | 4437 | dev_set_drvdata(st_class_member, &STp->modes[mode]); |
4432 | 4438 | ||
4433 | error = class_device_create_file(st_class_member, | 4439 | error = device_create_file(st_class_member, |
4434 | &class_device_attr_defined); | 4440 | &dev_attr_defined); |
4435 | if (error) goto out; | 4441 | if (error) goto out; |
4436 | error = class_device_create_file(st_class_member, | 4442 | error = device_create_file(st_class_member, |
4437 | &class_device_attr_default_blksize); | 4443 | &dev_attr_default_blksize); |
4438 | if (error) goto out; | 4444 | if (error) goto out; |
4439 | error = class_device_create_file(st_class_member, | 4445 | error = device_create_file(st_class_member, |
4440 | &class_device_attr_default_density); | 4446 | &dev_attr_default_density); |
4441 | if (error) goto out; | 4447 | if (error) goto out; |
4442 | error = class_device_create_file(st_class_member, | 4448 | error = device_create_file(st_class_member, |
4443 | &class_device_attr_default_compression); | 4449 | &dev_attr_default_compression); |
4444 | if (error) goto out; | 4450 | if (error) goto out; |
4445 | error = class_device_create_file(st_class_member, | 4451 | error = device_create_file(st_class_member, |
4446 | &class_device_attr_options); | 4452 | &dev_attr_options); |
4447 | if (error) goto out; | 4453 | if (error) goto out; |
4448 | 4454 | ||
4449 | if (mode == 0 && rew == 0) { | 4455 | if (mode == 0 && rew == 0) { |