diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-10 12:36:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-10 12:36:02 -0400 |
commit | 48d28fd55e7fd349fb16a50244379b4da3a4943c (patch) | |
tree | a6239419973b87c0560de36ab9e11516d45173e8 /drivers | |
parent | 86b3786078d63242d3194ffc58ae8dae1d1bbef3 (diff) | |
parent | 5bb8345db8f2aef367e0fddf99a42b7a6029b31f (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 9 | ||||
-rw-r--r-- | drivers/scsi/scsi_scan.c | 16 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 19 |
3 files changed, 42 insertions, 2 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index e2370529c632..7235f94f1191 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -907,9 +907,13 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
907 | raptorFlag = TRUE; | 907 | raptorFlag = TRUE; |
908 | } | 908 | } |
909 | 909 | ||
910 | 910 | if (pci_request_regions(pDev, "dpt_i2o")) { | |
911 | PERROR("dpti: adpt_config_hba: pci request region failed\n"); | ||
912 | return -EINVAL; | ||
913 | } | ||
911 | base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size); | 914 | base_addr_virt = ioremap(base_addr0_phys,hba_map0_area_size); |
912 | if (!base_addr_virt) { | 915 | if (!base_addr_virt) { |
916 | pci_release_regions(pDev); | ||
913 | PERROR("dpti: adpt_config_hba: io remap failed\n"); | 917 | PERROR("dpti: adpt_config_hba: io remap failed\n"); |
914 | return -EINVAL; | 918 | return -EINVAL; |
915 | } | 919 | } |
@@ -919,6 +923,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
919 | if (!msg_addr_virt) { | 923 | if (!msg_addr_virt) { |
920 | PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n"); | 924 | PERROR("dpti: adpt_config_hba: io remap failed on BAR1\n"); |
921 | iounmap(base_addr_virt); | 925 | iounmap(base_addr_virt); |
926 | pci_release_regions(pDev); | ||
922 | return -EINVAL; | 927 | return -EINVAL; |
923 | } | 928 | } |
924 | } else { | 929 | } else { |
@@ -932,6 +937,7 @@ static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev | |||
932 | iounmap(msg_addr_virt); | 937 | iounmap(msg_addr_virt); |
933 | } | 938 | } |
934 | iounmap(base_addr_virt); | 939 | iounmap(base_addr_virt); |
940 | pci_release_regions(pDev); | ||
935 | return -ENOMEM; | 941 | return -ENOMEM; |
936 | } | 942 | } |
937 | memset(pHba, 0, sizeof(adpt_hba)); | 943 | memset(pHba, 0, sizeof(adpt_hba)); |
@@ -1027,6 +1033,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba) | |||
1027 | up(&adpt_configuration_lock); | 1033 | up(&adpt_configuration_lock); |
1028 | 1034 | ||
1029 | iounmap(pHba->base_addr_virt); | 1035 | iounmap(pHba->base_addr_virt); |
1036 | pci_release_regions(pHba->pDev); | ||
1030 | if(pHba->msg_addr_virt != pHba->base_addr_virt){ | 1037 | if(pHba->msg_addr_virt != pHba->base_addr_virt){ |
1031 | iounmap(pHba->msg_addr_virt); | 1038 | iounmap(pHba->msg_addr_virt); |
1032 | } | 1039 | } |
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index 2d3c4ac475f2..48edd67982a5 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c | |||
@@ -336,9 +336,23 @@ static struct scsi_target *scsi_alloc_target(struct device *parent, | |||
336 | unsigned long flags; | 336 | unsigned long flags; |
337 | const int size = sizeof(struct scsi_target) | 337 | const int size = sizeof(struct scsi_target) |
338 | + shost->transportt->target_size; | 338 | + shost->transportt->target_size; |
339 | struct scsi_target *starget = kmalloc(size, GFP_ATOMIC); | 339 | struct scsi_target *starget; |
340 | struct scsi_target *found_target; | 340 | struct scsi_target *found_target; |
341 | 341 | ||
342 | /* | ||
343 | * Obtain the real parent from the transport. The transport | ||
344 | * is allowed to fail (no error) if there is nothing at that | ||
345 | * target id. | ||
346 | */ | ||
347 | if (shost->transportt->target_parent) { | ||
348 | spin_lock_irqsave(shost->host_lock, flags); | ||
349 | parent = shost->transportt->target_parent(shost, channel, id); | ||
350 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
351 | if (!parent) | ||
352 | return NULL; | ||
353 | } | ||
354 | |||
355 | starget = kmalloc(size, GFP_KERNEL); | ||
342 | if (!starget) { | 356 | if (!starget) { |
343 | printk(KERN_ERR "%s: allocation failure\n", __FUNCTION__); | 357 | printk(KERN_ERR "%s: allocation failure\n", __FUNCTION__); |
344 | return NULL; | 358 | return NULL; |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 35d1c1e8e345..e6412fce423c 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -1022,6 +1022,23 @@ static int fc_rport_match(struct attribute_container *cont, | |||
1022 | return &i->rport_attr_cont.ac == cont; | 1022 | return &i->rport_attr_cont.ac == cont; |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | |||
1026 | /* | ||
1027 | * Must be called with shost->host_lock held | ||
1028 | */ | ||
1029 | static struct device *fc_target_parent(struct Scsi_Host *shost, | ||
1030 | int channel, uint id) | ||
1031 | { | ||
1032 | struct fc_rport *rport; | ||
1033 | |||
1034 | list_for_each_entry(rport, &fc_host_rports(shost), peers) | ||
1035 | if ((rport->channel == channel) && | ||
1036 | (rport->scsi_target_id == id)) | ||
1037 | return &rport->dev; | ||
1038 | |||
1039 | return NULL; | ||
1040 | } | ||
1041 | |||
1025 | struct scsi_transport_template * | 1042 | struct scsi_transport_template * |
1026 | fc_attach_transport(struct fc_function_template *ft) | 1043 | fc_attach_transport(struct fc_function_template *ft) |
1027 | { | 1044 | { |
@@ -1057,6 +1074,8 @@ fc_attach_transport(struct fc_function_template *ft) | |||
1057 | 1074 | ||
1058 | /* Transport uses the shost workq for scsi scanning */ | 1075 | /* Transport uses the shost workq for scsi scanning */ |
1059 | i->t.create_work_queue = 1; | 1076 | i->t.create_work_queue = 1; |
1077 | |||
1078 | i->t.target_parent = fc_target_parent; | ||
1060 | 1079 | ||
1061 | /* | 1080 | /* |
1062 | * Setup SCSI Target Attributes. | 1081 | * Setup SCSI Target Attributes. |