Commit 2bb95584 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: core: add scsi_host_(block,unblock) helper function

Add helper functions to call scsi_internal_device_block()/
scsi_internal_device_unblock() for all attached devices on a SCSI host.

Link: https://lore.kernel.org/r/20200228075318.91255-9-hare@suse.deReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5646e13a
...@@ -2845,6 +2845,36 @@ scsi_target_unblock(struct device *dev, enum scsi_device_state new_state) ...@@ -2845,6 +2845,36 @@ scsi_target_unblock(struct device *dev, enum scsi_device_state new_state)
} }
EXPORT_SYMBOL_GPL(scsi_target_unblock); EXPORT_SYMBOL_GPL(scsi_target_unblock);
int
scsi_host_block(struct Scsi_Host *shost)
{
struct scsi_device *sdev;
int ret = 0;
shost_for_each_device(sdev, shost) {
ret = scsi_internal_device_block(sdev);
if (ret)
break;
}
return ret;
}
EXPORT_SYMBOL_GPL(scsi_host_block);
int
scsi_host_unblock(struct Scsi_Host *shost, int new_state)
{
struct scsi_device *sdev;
int ret = 0;
shost_for_each_device(sdev, shost) {
ret = scsi_internal_device_unblock(sdev, new_state);
if (ret)
break;
}
return ret;
}
EXPORT_SYMBOL_GPL(scsi_host_unblock);
/** /**
* scsi_kmap_atomic_sg - find and atomically map an sg-elemnt * scsi_kmap_atomic_sg - find and atomically map an sg-elemnt
* @sgl: scatter-gather list * @sgl: scatter-gather list
......
...@@ -758,6 +758,8 @@ static inline int scsi_host_scan_allowed(struct Scsi_Host *shost) ...@@ -758,6 +758,8 @@ static inline int scsi_host_scan_allowed(struct Scsi_Host *shost)
extern void scsi_unblock_requests(struct Scsi_Host *); extern void scsi_unblock_requests(struct Scsi_Host *);
extern void scsi_block_requests(struct Scsi_Host *); extern void scsi_block_requests(struct Scsi_Host *);
extern int scsi_host_block(struct Scsi_Host *shost);
extern int scsi_host_unblock(struct Scsi_Host *shost, int new_state);
struct class_container; struct class_container;
......
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