diff mbox series

Move the scsi_medium_access_command() definition

Message ID 20191209174640.191076-1-bvanassche@acm.org (mailing list archive)
State Deferred
Headers show
Series Move the scsi_medium_access_command() definition | expand

Commit Message

Bart Van Assche Dec. 9, 2019, 5:46 p.m. UTC
Move the scsi_medium_access_command() definition from a header file into a .c
file to reduce the kernel build time. This function is used by the scsi_debug
and by the sd drivers.

Cc: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_lib.c  | 33 +++++++++++++++++++++++++++++++++
 drivers/scsi/sd.h        | 32 --------------------------------
 include/scsi/scsi_cmnd.h |  2 ++
 3 files changed, 35 insertions(+), 32 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3e7a45d0daca..ae95e2e9e6d8 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -3119,3 +3119,36 @@  int scsi_vpd_tpg_id(struct scsi_device *sdev, int *rel_id)
 	return group_id;
 }
 EXPORT_SYMBOL(scsi_vpd_tpg_id);
+
+bool scsi_medium_access_command(const struct scsi_cmnd *scmd)
+{
+	switch (scmd->cmnd[0]) {
+	case READ_6:
+	case READ_10:
+	case READ_12:
+	case READ_16:
+	case SYNCHRONIZE_CACHE:
+	case VERIFY:
+	case VERIFY_12:
+	case VERIFY_16:
+	case WRITE_6:
+	case WRITE_10:
+	case WRITE_12:
+	case WRITE_16:
+	case WRITE_SAME:
+	case WRITE_SAME_16:
+	case UNMAP:
+		return true;
+	case VARIABLE_LENGTH_CMD:
+		switch (scmd->cmnd[9]) {
+		case READ_32:
+		case VERIFY_32:
+		case WRITE_32:
+		case WRITE_SAME_32:
+			return true;
+		}
+	}
+
+	return false;
+}
+EXPORT_SYMBOL(scsi_medium_access_command);
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index 50fff0bf8c8e..5c338e1c4270 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -136,38 +136,6 @@  static inline struct scsi_disk *scsi_disk(struct gendisk *disk)
 			sd_printk(prefix, sdsk, fmt, ##a);		\
 	} while (0)
 
-static inline int scsi_medium_access_command(struct scsi_cmnd *scmd)
-{
-	switch (scmd->cmnd[0]) {
-	case READ_6:
-	case READ_10:
-	case READ_12:
-	case READ_16:
-	case SYNCHRONIZE_CACHE:
-	case VERIFY:
-	case VERIFY_12:
-	case VERIFY_16:
-	case WRITE_6:
-	case WRITE_10:
-	case WRITE_12:
-	case WRITE_16:
-	case WRITE_SAME:
-	case WRITE_SAME_16:
-	case UNMAP:
-		return 1;
-	case VARIABLE_LENGTH_CMD:
-		switch (scmd->cmnd[9]) {
-		case READ_32:
-		case VERIFY_32:
-		case WRITE_32:
-		case WRITE_SAME_32:
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
 static inline sector_t logical_to_sectors(struct scsi_device *sdev, sector_t blocks)
 {
 	return blocks << (ilog2(sdev->sector_size) - 9);
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index a2849bb9cd19..f6bbf48b3694 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -168,6 +168,8 @@  extern void scsi_kunmap_atomic_sg(void *virt);
 
 extern blk_status_t scsi_init_io(struct scsi_cmnd *cmd);
 
+extern bool scsi_medium_access_command(const struct scsi_cmnd *scmd);
+
 #ifdef CONFIG_SCSI_DMA
 extern int scsi_dma_map(struct scsi_cmnd *cmd);
 extern void scsi_dma_unmap(struct scsi_cmnd *cmd);