aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/linit.c
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:33 -0400
commitee959b00c335d7780136c5abda37809191fe52c3 (patch)
tree7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/aacraid/linit.c
parent56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff)
SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/aacraid/linit.c')
-rw-r--r--drivers/scsi/aacraid/linit.c93
1 files changed, 53 insertions, 40 deletions
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
758static ssize_t aac_show_model(struct class_device *class_dev, 758static 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
777static ssize_t aac_show_vendor(struct class_device *class_dev, 777static 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
796static ssize_t aac_show_flags(struct class_device *class_dev, char *buf) 796static 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
815static ssize_t aac_show_kernel_version(struct class_device *class_dev, 816static 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
828static ssize_t aac_show_monitor_version(struct class_device *class_dev, 830static 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
841static ssize_t aac_show_bios_version(struct class_device *class_dev, 844static 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
854ssize_t aac_show_serial_number(struct class_device *class_dev, char *buf) 858ssize_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
872static ssize_t aac_show_max_channel(struct class_device *class_dev, char *buf) 877static 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
878static ssize_t aac_show_max_id(struct class_device *class_dev, char *buf) 884static 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
884static ssize_t aac_store_reset_adapter(struct class_device *class_dev, 891static 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
897static ssize_t aac_show_reset_adapter(struct class_device *class_dev, 905static 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
910static struct class_device_attribute aac_model = { 919static 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};
917static struct class_device_attribute aac_vendor = { 926static 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};
924static struct class_device_attribute aac_flags = { 933static 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};
931static struct class_device_attribute aac_kernel_version = { 940static 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};
938static struct class_device_attribute aac_monitor_version = { 947static 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};
945static struct class_device_attribute aac_bios_version = { 954static 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};
952static struct class_device_attribute aac_serial_number = { 961static 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};
959static struct class_device_attribute aac_max_channel = { 968static 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};
966static struct class_device_attribute aac_max_id = { 975static 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};
973static struct class_device_attribute aac_reset = { 982static 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
982static struct class_device_attribute *aac_attrs[] = { 991static 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
1005ssize_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
997static const struct file_operations aac_cfg_fops = { 1010static const struct file_operations aac_cfg_fops = {
998 .owner = THIS_MODULE, 1011 .owner = THIS_MODULE,