aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ses.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2009-07-31 20:39:36 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:52:13 -0400
commit163f52b6cf3a639df6a72c7937e0eb88b20f1ef3 (patch)
tree68991096e7ff15e31db28fb0d7bf2e87b1bd01c2 /drivers/scsi/ses.c
parent0124ca9d8ee58b3cd028a23cef2fe225fcfee3b8 (diff)
[SCSI] ses: fix hotplug with multiple devices and expanders
In a situation either with expanders or with multiple enclosure devices, hot add doesn't always work. This is because we try to find a single enclosure device attached to the host. Fix this by looping over all enclosure devices attached to the host and also by making the find loop recognise that the enclosure devices may be expander remote (i.e. not parented by the host). Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/ses.c')
-rw-r--r--drivers/scsi/ses.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/scsi/ses.c b/drivers/scsi/ses.c
index 4f618f487356..e1b8c828f03a 100644
--- a/drivers/scsi/ses.c
+++ b/drivers/scsi/ses.c
@@ -413,10 +413,11 @@ static int ses_intf_add(struct device *cdev,
413 413
414 if (!scsi_device_enclosure(sdev)) { 414 if (!scsi_device_enclosure(sdev)) {
415 /* not an enclosure, but might be in one */ 415 /* not an enclosure, but might be in one */
416 edev = enclosure_find(&sdev->host->shost_gendev); 416 struct enclosure_device *prev = NULL;
417 if (edev) { 417
418 while ((edev = enclosure_find(&sdev->host->shost_gendev, prev)) != NULL) {
418 ses_match_to_enclosure(edev, sdev); 419 ses_match_to_enclosure(edev, sdev);
419 put_device(&edev->edev); 420 prev = edev;
420 } 421 }
421 return -ENODEV; 422 return -ENODEV;
422 } 423 }
@@ -625,7 +626,8 @@ static void ses_intf_remove(struct device *cdev,
625 if (!scsi_device_enclosure(sdev)) 626 if (!scsi_device_enclosure(sdev))
626 return; 627 return;
627 628
628 edev = enclosure_find(cdev->parent); 629 /* exact match to this enclosure */
630 edev = enclosure_find(cdev->parent, NULL);
629 if (!edev) 631 if (!edev)
630 return; 632 return;
631 633