diff options
Diffstat (limited to 'drivers/message/fusion/mptsas.c')
-rw-r--r-- | drivers/message/fusion/mptsas.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 1dfe7d713aea..ee03c3f20526 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c | |||
@@ -846,13 +846,14 @@ mptsas_target_alloc(struct scsi_target *starget) | |||
846 | struct sas_rphy *rphy; | 846 | struct sas_rphy *rphy; |
847 | struct mptsas_portinfo *p; | 847 | struct mptsas_portinfo *p; |
848 | int i; | 848 | int i; |
849 | MPT_ADAPTER *ioc = hd->ioc; | ||
849 | 850 | ||
850 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); | 851 | vtarget = kzalloc(sizeof(VirtTarget), GFP_KERNEL); |
851 | if (!vtarget) | 852 | if (!vtarget) |
852 | return -ENOMEM; | 853 | return -ENOMEM; |
853 | 854 | ||
854 | vtarget->starget = starget; | 855 | vtarget->starget = starget; |
855 | vtarget->ioc_id = hd->ioc->id; | 856 | vtarget->ioc_id = ioc->id; |
856 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; | 857 | vtarget->tflags = MPT_TARGET_FLAGS_Q_YES; |
857 | id = starget->id; | 858 | id = starget->id; |
858 | channel = 0; | 859 | channel = 0; |
@@ -861,15 +862,15 @@ mptsas_target_alloc(struct scsi_target *starget) | |||
861 | * RAID volumes placed beyond the last expected port. | 862 | * RAID volumes placed beyond the last expected port. |
862 | */ | 863 | */ |
863 | if (starget->channel == MPTSAS_RAID_CHANNEL) { | 864 | if (starget->channel == MPTSAS_RAID_CHANNEL) { |
864 | for (i=0; i < hd->ioc->raid_data.pIocPg2->NumActiveVolumes; i++) | 865 | for (i=0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) |
865 | if (id == hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) | 866 | if (id == ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID) |
866 | channel = hd->ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus; | 867 | channel = ioc->raid_data.pIocPg2->RaidVolume[i].VolumeBus; |
867 | goto out; | 868 | goto out; |
868 | } | 869 | } |
869 | 870 | ||
870 | rphy = dev_to_rphy(starget->dev.parent); | 871 | rphy = dev_to_rphy(starget->dev.parent); |
871 | mutex_lock(&hd->ioc->sas_topology_mutex); | 872 | mutex_lock(&ioc->sas_topology_mutex); |
872 | list_for_each_entry(p, &hd->ioc->sas_topology, list) { | 873 | list_for_each_entry(p, &ioc->sas_topology, list) { |
873 | for (i = 0; i < p->num_phys; i++) { | 874 | for (i = 0; i < p->num_phys; i++) { |
874 | if (p->phy_info[i].attached.sas_address != | 875 | if (p->phy_info[i].attached.sas_address != |
875 | rphy->identify.sas_address) | 876 | rphy->identify.sas_address) |
@@ -881,18 +882,18 @@ mptsas_target_alloc(struct scsi_target *starget) | |||
881 | /* | 882 | /* |
882 | * Exposing hidden raid components | 883 | * Exposing hidden raid components |
883 | */ | 884 | */ |
884 | if (mptscsih_is_phys_disk(hd->ioc, channel, id)) { | 885 | if (mptscsih_is_phys_disk(ioc, channel, id)) { |
885 | id = mptscsih_raid_id_to_num(hd->ioc, | 886 | id = mptscsih_raid_id_to_num(ioc, |
886 | channel, id); | 887 | channel, id); |
887 | vtarget->tflags |= | 888 | vtarget->tflags |= |
888 | MPT_TARGET_FLAGS_RAID_COMPONENT; | 889 | MPT_TARGET_FLAGS_RAID_COMPONENT; |
889 | p->phy_info[i].attached.phys_disk_num = id; | 890 | p->phy_info[i].attached.phys_disk_num = id; |
890 | } | 891 | } |
891 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 892 | mutex_unlock(&ioc->sas_topology_mutex); |
892 | goto out; | 893 | goto out; |
893 | } | 894 | } |
894 | } | 895 | } |
895 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 896 | mutex_unlock(&ioc->sas_topology_mutex); |
896 | 897 | ||
897 | kfree(vtarget); | 898 | kfree(vtarget); |
898 | return -ENXIO; | 899 | return -ENXIO; |
@@ -912,6 +913,7 @@ mptsas_target_destroy(struct scsi_target *starget) | |||
912 | struct sas_rphy *rphy; | 913 | struct sas_rphy *rphy; |
913 | struct mptsas_portinfo *p; | 914 | struct mptsas_portinfo *p; |
914 | int i; | 915 | int i; |
916 | MPT_ADAPTER *ioc = hd->ioc; | ||
915 | 917 | ||
916 | if (!starget->hostdata) | 918 | if (!starget->hostdata) |
917 | return; | 919 | return; |
@@ -920,7 +922,7 @@ mptsas_target_destroy(struct scsi_target *starget) | |||
920 | goto out; | 922 | goto out; |
921 | 923 | ||
922 | rphy = dev_to_rphy(starget->dev.parent); | 924 | rphy = dev_to_rphy(starget->dev.parent); |
923 | list_for_each_entry(p, &hd->ioc->sas_topology, list) { | 925 | list_for_each_entry(p, &ioc->sas_topology, list) { |
924 | for (i = 0; i < p->num_phys; i++) { | 926 | for (i = 0; i < p->num_phys; i++) { |
925 | if (p->phy_info[i].attached.sas_address != | 927 | if (p->phy_info[i].attached.sas_address != |
926 | rphy->identify.sas_address) | 928 | rphy->identify.sas_address) |
@@ -946,11 +948,12 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
946 | VirtDevice *vdevice; | 948 | VirtDevice *vdevice; |
947 | struct scsi_target *starget; | 949 | struct scsi_target *starget; |
948 | int i; | 950 | int i; |
951 | MPT_ADAPTER *ioc = hd->ioc; | ||
949 | 952 | ||
950 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); | 953 | vdevice = kzalloc(sizeof(VirtDevice), GFP_KERNEL); |
951 | if (!vdevice) { | 954 | if (!vdevice) { |
952 | printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n", | 955 | printk(MYIOC_s_ERR_FMT "slave_alloc kzalloc(%zd) FAILED!\n", |
953 | hd->ioc->name, sizeof(VirtDevice)); | 956 | ioc->name, sizeof(VirtDevice)); |
954 | return -ENOMEM; | 957 | return -ENOMEM; |
955 | } | 958 | } |
956 | starget = scsi_target(sdev); | 959 | starget = scsi_target(sdev); |
@@ -960,8 +963,8 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
960 | goto out; | 963 | goto out; |
961 | 964 | ||
962 | rphy = dev_to_rphy(sdev->sdev_target->dev.parent); | 965 | rphy = dev_to_rphy(sdev->sdev_target->dev.parent); |
963 | mutex_lock(&hd->ioc->sas_topology_mutex); | 966 | mutex_lock(&ioc->sas_topology_mutex); |
964 | list_for_each_entry(p, &hd->ioc->sas_topology, list) { | 967 | list_for_each_entry(p, &ioc->sas_topology, list) { |
965 | for (i = 0; i < p->num_phys; i++) { | 968 | for (i = 0; i < p->num_phys; i++) { |
966 | if (p->phy_info[i].attached.sas_address != | 969 | if (p->phy_info[i].attached.sas_address != |
967 | rphy->identify.sas_address) | 970 | rphy->identify.sas_address) |
@@ -970,15 +973,15 @@ mptsas_slave_alloc(struct scsi_device *sdev) | |||
970 | /* | 973 | /* |
971 | * Exposing hidden raid components | 974 | * Exposing hidden raid components |
972 | */ | 975 | */ |
973 | if (mptscsih_is_phys_disk(hd->ioc, | 976 | if (mptscsih_is_phys_disk(ioc, |
974 | p->phy_info[i].attached.channel, | 977 | p->phy_info[i].attached.channel, |
975 | p->phy_info[i].attached.id)) | 978 | p->phy_info[i].attached.id)) |
976 | sdev->no_uld_attach = 1; | 979 | sdev->no_uld_attach = 1; |
977 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 980 | mutex_unlock(&ioc->sas_topology_mutex); |
978 | goto out; | 981 | goto out; |
979 | } | 982 | } |
980 | } | 983 | } |
981 | mutex_unlock(&hd->ioc->sas_topology_mutex); | 984 | mutex_unlock(&ioc->sas_topology_mutex); |
982 | 985 | ||
983 | kfree(vdevice); | 986 | kfree(vdevice); |
984 | return -ENXIO; | 987 | return -ENXIO; |