Skip to content

Commit c5e46f7

Browse files
mwilckmartinkpetersen
authored andcommitted
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: Martin Wilck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 37c918e commit c5e46f7

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

drivers/scsi/scsi_lib.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,21 +2775,20 @@ int scsi_internal_device_block_nowait(struct scsi_device *sdev)
27752775
EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait);
27762776

27772777
/**
2778-
* scsi_internal_device_block - try to transition to the SDEV_BLOCK state
2778+
* scsi_device_block - try to transition to the SDEV_BLOCK state
27792779
* @sdev: device to block
2780+
* @data: dummy argument, ignored
27802781
*
27812782
* Pause SCSI command processing on the specified device and wait until all
2782-
* ongoing scsi_request_fn() / scsi_queue_rq() calls have finished. May sleep.
2783-
*
2784-
* Returns zero if successful or a negative error code upon failure.
2783+
* ongoing scsi_queue_rq() calls have finished. May sleep.
27852784
*
27862785
* Note:
27872786
* This routine transitions the device to the SDEV_BLOCK state (which must be
27882787
* a legal transition). When the device is in this state, command processing
27892788
* is paused until the device leaves the SDEV_BLOCK state. See also
27902789
* scsi_internal_device_unblock().
27912790
*/
2792-
static int scsi_internal_device_block(struct scsi_device *sdev)
2791+
static void scsi_device_block(struct scsi_device *sdev, void *data)
27932792
{
27942793
int err;
27952794

@@ -2799,7 +2798,8 @@ static int scsi_internal_device_block(struct scsi_device *sdev)
27992798
scsi_stop_queue(sdev, false);
28002799
mutex_unlock(&sdev->state_mutex);
28012800

2802-
return err;
2801+
WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n",
2802+
dev_name(&sdev->sdev_gendev), err);
28032803
}
28042804

28052805
/**
@@ -2882,23 +2882,12 @@ static int scsi_internal_device_unblock(struct scsi_device *sdev,
28822882
return ret;
28832883
}
28842884

2885-
static void
2886-
device_block(struct scsi_device *sdev, void *data)
2887-
{
2888-
int ret;
2889-
2890-
ret = scsi_internal_device_block(sdev);
2891-
2892-
WARN_ONCE(ret, "scsi_internal_device_block(%s) failed: ret = %d\n",
2893-
dev_name(&sdev->sdev_gendev), ret);
2894-
}
2895-
28962885
static int
28972886
target_block(struct device *dev, void *data)
28982887
{
28992888
if (scsi_is_target_device(dev))
29002889
starget_for_each_device(to_scsi_target(dev), NULL,
2901-
device_block);
2890+
scsi_device_block);
29022891
return 0;
29032892
}
29042893

@@ -2907,7 +2896,7 @@ scsi_target_block(struct device *dev)
29072896
{
29082897
if (scsi_is_target_device(dev))
29092898
starget_for_each_device(to_scsi_target(dev), NULL,
2910-
device_block);
2899+
scsi_device_block);
29112900
else
29122901
device_for_each_child(dev, NULL, target_block);
29132902
}

0 commit comments

Comments
 (0)