aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-sbp2.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index a15e3c7d21d3..72fddf5a12a3 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -499,6 +499,9 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
499 unsigned int timeout; 499 unsigned int timeout;
500 int retval = -ENOMEM; 500 int retval = -ENOMEM;
501 501
502 if (function == SBP2_LOGOUT_REQUEST && fw_device_is_shutdown(device))
503 return 0;
504
502 orb = kzalloc(sizeof(*orb), GFP_ATOMIC); 505 orb = kzalloc(sizeof(*orb), GFP_ATOMIC);
503 if (orb == NULL) 506 if (orb == NULL)
504 return -ENOMEM; 507 return -ENOMEM;
@@ -619,16 +622,13 @@ static void sbp2_release_target(struct kref *kref)
619 struct sbp2_logical_unit *lu, *next; 622 struct sbp2_logical_unit *lu, *next;
620 struct Scsi_Host *shost = 623 struct Scsi_Host *shost =
621 container_of((void *)tgt, struct Scsi_Host, hostdata[0]); 624 container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
622 struct fw_device *device = fw_device(tgt->unit->device.parent);
623 625
624 list_for_each_entry_safe(lu, next, &tgt->lu_list, link) { 626 list_for_each_entry_safe(lu, next, &tgt->lu_list, link) {
625 if (lu->sdev) 627 if (lu->sdev)
626 scsi_remove_device(lu->sdev); 628 scsi_remove_device(lu->sdev);
627 629
628 if (!fw_device_is_shutdown(device)) 630 sbp2_send_management_orb(lu, tgt->node_id, lu->generation,
629 sbp2_send_management_orb(lu, tgt->node_id, 631 SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
630 lu->generation, SBP2_LOGOUT_REQUEST,
631 lu->login_id, NULL);
632 632
633 fw_core_remove_address_handler(&lu->address_handler); 633 fw_core_remove_address_handler(&lu->address_handler);
634 list_del(&lu->link); 634 list_del(&lu->link);
@@ -673,6 +673,9 @@ static void sbp2_login(struct work_struct *work)
673 struct sbp2_login_response response; 673 struct sbp2_login_response response;
674 int generation, node_id, local_node_id; 674 int generation, node_id, local_node_id;
675 675
676 if (fw_device_is_shutdown(device))
677 goto out;
678
676 generation = device->generation; 679 generation = device->generation;
677 smp_rmb(); /* node_id must not be older than generation */ 680 smp_rmb(); /* node_id must not be older than generation */
678 node_id = device->node_id; 681 node_id = device->node_id;
@@ -944,6 +947,9 @@ static void sbp2_reconnect(struct work_struct *work)
944 struct fw_device *device = fw_device(unit->device.parent); 947 struct fw_device *device = fw_device(unit->device.parent);
945 int generation, node_id, local_node_id; 948 int generation, node_id, local_node_id;
946 949
950 if (fw_device_is_shutdown(device))
951 goto out;
952
947 generation = device->generation; 953 generation = device->generation;
948 smp_rmb(); /* node_id must not be older than generation */ 954 smp_rmb(); /* node_id must not be older than generation */
949 node_id = device->node_id; 955 node_id = device->node_id;