diff options
Diffstat (limited to 'drivers/scsi/aacraid/linit.c')
-rw-r--r-- | drivers/scsi/aacraid/linit.c | 93 |
1 files changed, 53 insertions, 40 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 8372bf6ed482..c109f63f8279 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -754,10 +754,10 @@ static long aac_compat_cfg_ioctl(struct file *file, unsigned cmd, unsigned long | |||
754 | } | 754 | } |
755 | #endif | 755 | #endif |
756 | 756 | ||
757 | static ssize_t aac_show_model(struct class_device *class_dev, | 757 | static ssize_t aac_show_model(struct device *device, |
758 | char *buf) | 758 | struct device_attribute *attr, char *buf) |
759 | { | 759 | { |
760 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 760 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
761 | int len; | 761 | int len; |
762 | 762 | ||
763 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { | 763 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { |
@@ -773,10 +773,10 @@ static ssize_t aac_show_model(struct class_device *class_dev, | |||
773 | return len; | 773 | return len; |
774 | } | 774 | } |
775 | 775 | ||
776 | static ssize_t aac_show_vendor(struct class_device *class_dev, | 776 | static ssize_t aac_show_vendor(struct device *device, |
777 | char *buf) | 777 | struct device_attribute *attr, char *buf) |
778 | { | 778 | { |
779 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 779 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
780 | int len; | 780 | int len; |
781 | 781 | ||
782 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { | 782 | if (dev->supplement_adapter_info.AdapterTypeText[0]) { |
@@ -792,10 +792,11 @@ static ssize_t aac_show_vendor(struct class_device *class_dev, | |||
792 | return len; | 792 | return len; |
793 | } | 793 | } |
794 | 794 | ||
795 | static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) | 795 | static ssize_t aac_show_flags(struct device *cdev, |
796 | struct device_attribute *attr, char *buf) | ||
796 | { | 797 | { |
797 | int len = 0; | 798 | int len = 0; |
798 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 799 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(cdev)->hostdata; |
799 | 800 | ||
800 | if (nblank(dprintk(x))) | 801 | if (nblank(dprintk(x))) |
801 | len = snprintf(buf, PAGE_SIZE, "dprintk\n"); | 802 | len = snprintf(buf, PAGE_SIZE, "dprintk\n"); |
@@ -811,10 +812,11 @@ static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) | |||
811 | return len; | 812 | return len; |
812 | } | 813 | } |
813 | 814 | ||
814 | static ssize_t aac_show_kernel_version(struct class_device *class_dev, | 815 | static ssize_t aac_show_kernel_version(struct device *device, |
815 | char *buf) | 816 | struct device_attribute *attr, |
817 | char *buf) | ||
816 | { | 818 | { |
817 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 819 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
818 | int len, tmp; | 820 | int len, tmp; |
819 | 821 | ||
820 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); | 822 | tmp = le32_to_cpu(dev->adapter_info.kernelrev); |
@@ -824,10 +826,11 @@ static ssize_t aac_show_kernel_version(struct class_device *class_dev, | |||
824 | return len; | 826 | return len; |
825 | } | 827 | } |
826 | 828 | ||
827 | static ssize_t aac_show_monitor_version(struct class_device *class_dev, | 829 | static ssize_t aac_show_monitor_version(struct device *device, |
828 | char *buf) | 830 | struct device_attribute *attr, |
831 | char *buf) | ||
829 | { | 832 | { |
830 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 833 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
831 | int len, tmp; | 834 | int len, tmp; |
832 | 835 | ||
833 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); | 836 | tmp = le32_to_cpu(dev->adapter_info.monitorrev); |
@@ -837,10 +840,11 @@ static ssize_t aac_show_monitor_version(struct class_device *class_dev, | |||
837 | return len; | 840 | return len; |
838 | } | 841 | } |
839 | 842 | ||
840 | static ssize_t aac_show_bios_version(struct class_device *class_dev, | 843 | static ssize_t aac_show_bios_version(struct device *device, |
841 | char *buf) | 844 | struct device_attribute *attr, |
845 | char *buf) | ||
842 | { | 846 | { |
843 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 847 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
844 | int len, tmp; | 848 | int len, tmp; |
845 | 849 | ||
846 | tmp = le32_to_cpu(dev->adapter_info.biosrev); | 850 | tmp = le32_to_cpu(dev->adapter_info.biosrev); |
@@ -850,9 +854,10 @@ static ssize_t aac_show_bios_version(struct class_device *class_dev, | |||
850 | return len; | 854 | return len; |
851 | } | 855 | } |
852 | 856 | ||
853 | ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) | 857 | ssize_t aac_show_serial_number(struct device *device, |
858 | struct device_attribute *attr, char *buf) | ||
854 | { | 859 | { |
855 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 860 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
856 | int len = 0; | 861 | int len = 0; |
857 | 862 | ||
858 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) | 863 | if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) |
@@ -868,35 +873,39 @@ ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) | |||
868 | return len; | 873 | return len; |
869 | } | 874 | } |
870 | 875 | ||
871 | static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf) | 876 | static ssize_t aac_show_max_channel(struct device *device, |
877 | struct device_attribute *attr, char *buf) | ||
872 | { | 878 | { |
873 | return snprintf(buf, PAGE_SIZE, "%d\n", | 879 | return snprintf(buf, PAGE_SIZE, "%d\n", |
874 | class_to_shost(class_dev)->max_channel); | 880 | class_to_shost(device)->max_channel); |
875 | } | 881 | } |
876 | 882 | ||
877 | static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf) | 883 | static ssize_t aac_show_max_id(struct device *device, |
884 | struct device_attribute *attr, char *buf) | ||
878 | { | 885 | { |
879 | return snprintf(buf, PAGE_SIZE, "%d\n", | 886 | return snprintf(buf, PAGE_SIZE, "%d\n", |
880 | class_to_shost(class_dev)->max_id); | 887 | class_to_shost(device)->max_id); |
881 | } | 888 | } |
882 | 889 | ||
883 | static ssize_t aac_store_reset_adapter(struct class_device *class_dev, | 890 | static ssize_t aac_store_reset_adapter(struct device *device, |
884 | const char *buf, size_t count) | 891 | struct device_attribute *attr, |
892 | const char *buf, size_t count) | ||
885 | { | 893 | { |
886 | int retval = -EACCES; | 894 | int retval = -EACCES; |
887 | 895 | ||
888 | if (!capable(CAP_SYS_ADMIN)) | 896 | if (!capable(CAP_SYS_ADMIN)) |
889 | return retval; | 897 | return retval; |
890 | retval = aac_reset_adapter((struct aac_dev*)class_to_shost(class_dev)->hostdata, buf[0] == '!'); | 898 | retval = aac_reset_adapter((struct aac_dev*)class_to_shost(device)->hostdata, buf[0] == '!'); |
891 | if (retval >= 0) | 899 | if (retval >= 0) |
892 | retval = count; | 900 | retval = count; |
893 | return retval; | 901 | return retval; |
894 | } | 902 | } |
895 | 903 | ||
896 | static ssize_t aac_show_reset_adapter(struct class_device *class_dev, | 904 | static ssize_t aac_show_reset_adapter(struct device *device, |
897 | char *buf) | 905 | struct device_attribute *attr, |
906 | char *buf) | ||
898 | { | 907 | { |
899 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; | 908 | struct aac_dev *dev = (struct aac_dev*)class_to_shost(device)->hostdata; |
900 | int len, tmp; | 909 | int len, tmp; |
901 | 910 | ||
902 | tmp = aac_adapter_check_health(dev); | 911 | tmp = aac_adapter_check_health(dev); |
@@ -906,70 +915,70 @@ static ssize_t aac_show_reset_adapter(struct class_device *class_dev, | |||
906 | return len; | 915 | return len; |
907 | } | 916 | } |
908 | 917 | ||
909 | static struct class_device_attribute aac_model = { | 918 | static struct device_attribute aac_model = { |
910 | .attr = { | 919 | .attr = { |
911 | .name = "model", | 920 | .name = "model", |
912 | .mode = S_IRUGO, | 921 | .mode = S_IRUGO, |
913 | }, | 922 | }, |
914 | .show = aac_show_model, | 923 | .show = aac_show_model, |
915 | }; | 924 | }; |
916 | static struct class_device_attribute aac_vendor = { | 925 | static struct device_attribute aac_vendor = { |
917 | .attr = { | 926 | .attr = { |
918 | .name = "vendor", | 927 | .name = "vendor", |
919 | .mode = S_IRUGO, | 928 | .mode = S_IRUGO, |
920 | }, | 929 | }, |
921 | .show = aac_show_vendor, | 930 | .show = aac_show_vendor, |
922 | }; | 931 | }; |
923 | static struct class_device_attribute aac_flags = { | 932 | static struct device_attribute aac_flags = { |
924 | .attr = { | 933 | .attr = { |
925 | .name = "flags", | 934 | .name = "flags", |
926 | .mode = S_IRUGO, | 935 | .mode = S_IRUGO, |
927 | }, | 936 | }, |
928 | .show = aac_show_flags, | 937 | .show = aac_show_flags, |
929 | }; | 938 | }; |
930 | static struct class_device_attribute aac_kernel_version = { | 939 | static struct device_attribute aac_kernel_version = { |
931 | .attr = { | 940 | .attr = { |
932 | .name = "hba_kernel_version", | 941 | .name = "hba_kernel_version", |
933 | .mode = S_IRUGO, | 942 | .mode = S_IRUGO, |
934 | }, | 943 | }, |
935 | .show = aac_show_kernel_version, | 944 | .show = aac_show_kernel_version, |
936 | }; | 945 | }; |
937 | static struct class_device_attribute aac_monitor_version = { | 946 | static struct device_attribute aac_monitor_version = { |
938 | .attr = { | 947 | .attr = { |
939 | .name = "hba_monitor_version", | 948 | .name = "hba_monitor_version", |
940 | .mode = S_IRUGO, | 949 | .mode = S_IRUGO, |
941 | }, | 950 | }, |
942 | .show = aac_show_monitor_version, | 951 | .show = aac_show_monitor_version, |
943 | }; | 952 | }; |
944 | static struct class_device_attribute aac_bios_version = { | 953 | static struct device_attribute aac_bios_version = { |
945 | .attr = { | 954 | .attr = { |
946 | .name = "hba_bios_version", | 955 | .name = "hba_bios_version", |
947 | .mode = S_IRUGO, | 956 | .mode = S_IRUGO, |
948 | }, | 957 | }, |
949 | .show = aac_show_bios_version, | 958 | .show = aac_show_bios_version, |
950 | }; | 959 | }; |
951 | static struct class_device_attribute aac_serial_number = { | 960 | static struct device_attribute aac_serial_number = { |
952 | .attr = { | 961 | .attr = { |
953 | .name = "serial_number", | 962 | .name = "serial_number", |
954 | .mode = S_IRUGO, | 963 | .mode = S_IRUGO, |
955 | }, | 964 | }, |
956 | .show = aac_show_serial_number, | 965 | .show = aac_show_serial_number, |
957 | }; | 966 | }; |
958 | static struct class_device_attribute aac_max_channel = { | 967 | static struct device_attribute aac_max_channel = { |
959 | .attr = { | 968 | .attr = { |
960 | .name = "max_channel", | 969 | .name = "max_channel", |
961 | .mode = S_IRUGO, | 970 | .mode = S_IRUGO, |
962 | }, | 971 | }, |
963 | .show = aac_show_max_channel, | 972 | .show = aac_show_max_channel, |
964 | }; | 973 | }; |
965 | static struct class_device_attribute aac_max_id = { | 974 | static struct device_attribute aac_max_id = { |
966 | .attr = { | 975 | .attr = { |
967 | .name = "max_id", | 976 | .name = "max_id", |
968 | .mode = S_IRUGO, | 977 | .mode = S_IRUGO, |
969 | }, | 978 | }, |
970 | .show = aac_show_max_id, | 979 | .show = aac_show_max_id, |
971 | }; | 980 | }; |
972 | static struct class_device_attribute aac_reset = { | 981 | static struct device_attribute aac_reset = { |
973 | .attr = { | 982 | .attr = { |
974 | .name = "reset_host", | 983 | .name = "reset_host", |
975 | .mode = S_IWUSR|S_IRUGO, | 984 | .mode = S_IWUSR|S_IRUGO, |
@@ -978,7 +987,7 @@ static struct class_device_attribute aac_reset = { | |||
978 | .show = aac_show_reset_adapter, | 987 | .show = aac_show_reset_adapter, |
979 | }; | 988 | }; |
980 | 989 | ||
981 | static struct class_device_attribute *aac_attrs[] = { | 990 | static struct device_attribute *aac_attrs[] = { |
982 | &aac_model, | 991 | &aac_model, |
983 | &aac_vendor, | 992 | &aac_vendor, |
984 | &aac_flags, | 993 | &aac_flags, |
@@ -992,6 +1001,10 @@ static struct class_device_attribute *aac_attrs[] = { | |||
992 | NULL | 1001 | NULL |
993 | }; | 1002 | }; |
994 | 1003 | ||
1004 | ssize_t aac_get_serial_number(struct device *device, char *buf) | ||
1005 | { | ||
1006 | return aac_show_serial_number(device, &aac_serial_number, buf); | ||
1007 | } | ||
995 | 1008 | ||
996 | static const struct file_operations aac_cfg_fops = { | 1009 | static const struct file_operations aac_cfg_fops = { |
997 | .owner = THIS_MODULE, | 1010 | .owner = THIS_MODULE, |