Skip to content

Commit

Permalink
scsi: libsas: Simplify sas_queue_reset() and remove unused code
Browse files Browse the repository at this point in the history
sas_queue_reset() is always called with param "wait" set to 0, so remove it
from this function's parameter list. Also remove unused function
sas_wait_eh().

Signed-off-by: Wenchao Hao <haowenchao2@huawei.com>
Link: https://lore.kernel.org/r/20230729102451.2452826-1-haowenchao2@huawei.com
Reviewed-by: Jason Yan <yanaijie@huawei.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Wenchao Hao authored and Martin K. Petersen committed Aug 31, 2023
1 parent d0bac0e commit be946e3
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions drivers/scsi/libsas/sas_scsi_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,46 +386,14 @@ struct sas_phy *sas_get_local_phy(struct domain_device *dev)
}
EXPORT_SYMBOL_GPL(sas_get_local_phy);

static void sas_wait_eh(struct domain_device *dev)
{
struct sas_ha_struct *ha = dev->port->ha;
DEFINE_WAIT(wait);

if (dev_is_sata(dev)) {
ata_port_wait_eh(dev->sata_dev.ap);
return;
}
retry:
spin_lock_irq(&ha->lock);

while (test_bit(SAS_DEV_EH_PENDING, &dev->state)) {
prepare_to_wait(&ha->eh_wait_q, &wait, TASK_UNINTERRUPTIBLE);
spin_unlock_irq(&ha->lock);
schedule();
spin_lock_irq(&ha->lock);
}
finish_wait(&ha->eh_wait_q, &wait);

spin_unlock_irq(&ha->lock);

/* make sure SCSI EH is complete */
if (scsi_host_in_recovery(ha->shost)) {
msleep(10);
goto retry;
}
}

static int sas_queue_reset(struct domain_device *dev, int reset_type,
u64 lun, int wait)
static int sas_queue_reset(struct domain_device *dev, int reset_type, u64 lun)
{
struct sas_ha_struct *ha = dev->port->ha;
int scheduled = 0, tries = 100;

/* ata: promote lun reset to bus reset */
if (dev_is_sata(dev)) {
sas_ata_schedule_reset(dev);
if (wait)
sas_ata_wait_eh(dev);
return SUCCESS;
}

Expand All @@ -443,9 +411,6 @@ static int sas_queue_reset(struct domain_device *dev, int reset_type,
}
spin_unlock_irq(&ha->lock);

if (wait)
sas_wait_eh(dev);

if (scheduled)
return SUCCESS;
}
Expand Down Expand Up @@ -498,7 +463,7 @@ int sas_eh_device_reset_handler(struct scsi_cmnd *cmd)
struct sas_internal *i = to_sas_internal(host->transportt);

if (current != host->ehandler)
return sas_queue_reset(dev, SAS_DEV_LU_RESET, cmd->device->lun, 0);
return sas_queue_reset(dev, SAS_DEV_LU_RESET, cmd->device->lun);

int_to_scsilun(cmd->device->lun, &lun);

Expand All @@ -521,7 +486,7 @@ int sas_eh_target_reset_handler(struct scsi_cmnd *cmd)
struct sas_internal *i = to_sas_internal(host->transportt);

if (current != host->ehandler)
return sas_queue_reset(dev, SAS_DEV_RESET, 0, 0);
return sas_queue_reset(dev, SAS_DEV_RESET, 0);

if (!i->dft->lldd_I_T_nexus_reset)
return FAILED;
Expand Down

0 comments on commit be946e3

Please sign in to comment.