Commit c5e46f7a authored by Martin Wilck's avatar Martin Wilck Committed by Martin K. Petersen

scsi: core: Merge scsi_internal_device_block() and device_block()

scsi_internal_device_block() is only called from device_block().  Merge the
two functions, and call the result scsi_device_block(), as the name
device_block() is confusingly generic.
Signed-off-by: default avatarMartin Wilck <mwilck@suse.com>
Link: https://lore.kernel.org/r/20230614103616.31857-4-mwilck@suse.comReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 37c918e0
...@@ -2775,13 +2775,12 @@ int scsi_internal_device_block_nowait(struct scsi_device *sdev) ...@@ -2775,13 +2775,12 @@ int scsi_internal_device_block_nowait(struct scsi_device *sdev)
EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
/** /**
* scsi_internal_device_block - try to transition to the SDEV_BLOCK state * scsi_device_block - try to transition to the SDEV_BLOCK state
* @sdev: device to block * @sdev: device to block
* @data: dummy argument, ignored
* *
* Pause SCSI command processing on the specified device and wait until all * Pause SCSI command processing on the specified device and wait until all
* ongoing scsi_request_fn() / scsi_queue_rq() calls have finished. May sleep. * ongoing scsi_queue_rq() calls have finished. May sleep.
*
* Returns zero if successful or a negative error code upon failure.
* *
* Note: * Note:
* This routine transitions the device to the SDEV_BLOCK state (which must be * This routine transitions the device to the SDEV_BLOCK state (which must be
...@@ -2789,7 +2788,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); ...@@ -2789,7 +2788,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
* is paused until the device leaves the SDEV_BLOCK state. See also * is paused until the device leaves the SDEV_BLOCK state. See also
* scsi_internal_device_unblock(). * scsi_internal_device_unblock().
*/ */
static int scsi_internal_device_block(struct scsi_device *sdev) static void scsi_device_block(struct scsi_device *sdev, void *data)
{ {
int err; int err;
...@@ -2799,7 +2798,8 @@ static int scsi_internal_device_block(struct scsi_device *sdev) ...@@ -2799,7 +2798,8 @@ static int scsi_internal_device_block(struct scsi_device *sdev)
scsi_stop_queue(sdev, false); scsi_stop_queue(sdev, false);
mutex_unlock(&sdev->state_mutex); mutex_unlock(&sdev->state_mutex);
return err; WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n",
dev_name(&sdev->sdev_gendev), err);
} }
/** /**
...@@ -2882,23 +2882,12 @@ static int scsi_internal_device_unblock(struct scsi_device *sdev, ...@@ -2882,23 +2882,12 @@ static int scsi_internal_device_unblock(struct scsi_device *sdev,
return ret; return ret;
} }
static void
device_block(struct scsi_device *sdev, void *data)
{
int ret;
ret = scsi_internal_device_block(sdev);
WARN_ONCE(ret, "scsi_internal_device_block(%s) failed: ret = %d\n",
dev_name(&sdev->sdev_gendev), ret);
}
static int static int
target_block(struct device *dev, void *data) target_block(struct device *dev, void *data)
{ {
if (scsi_is_target_device(dev)) if (scsi_is_target_device(dev))
starget_for_each_device(to_scsi_target(dev), NULL, starget_for_each_device(to_scsi_target(dev), NULL,
device_block); scsi_device_block);
return 0; return 0;
} }
...@@ -2907,7 +2896,7 @@ scsi_target_block(struct device *dev) ...@@ -2907,7 +2896,7 @@ scsi_target_block(struct device *dev)
{ {
if (scsi_is_target_device(dev)) if (scsi_is_target_device(dev))
starget_for_each_device(to_scsi_target(dev), NULL, starget_for_each_device(to_scsi_target(dev), NULL,
device_block); scsi_device_block);
else else
device_for_each_child(dev, NULL, target_block); device_for_each_child(dev, NULL, target_block);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment