[PATCH v2 5/7] Move several function definitions in <scsi/scsi_cmnd.h>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the next patch will call scsi_out_cmd() from scsi_[gs]et_resid(),
reorder the function definitions in <scsi/scsi_cmnd.h>.

Cc: Douglas Gilbert <dgilbert@xxxxxxxxxxxx>
Cc: Hannes Reinecke <hare@xxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 include/scsi/scsi_cmnd.h | 50 ++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 213404163993..673980ed7db6 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -185,61 +185,61 @@ static inline int scsi_dma_map(struct scsi_cmnd *cmd) { return -ENOSYS; }
 static inline void scsi_dma_unmap(struct scsi_cmnd *cmd) { }
 #endif /* !CONFIG_SCSI_DMA */
 
-static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)
+static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
 {
-	return cmd->sdb.table.nents;
+	return blk_bidi_rq(cmd->request);
 }
 
-static inline struct scatterlist *scsi_sglist(struct scsi_cmnd *cmd)
+static inline struct scsi_cmnd *scsi_in_cmd(struct scsi_cmnd *cmd)
 {
-	return cmd->sdb.table.sgl;
+	if (likely(!scsi_bidi_cmnd(cmd)))
+		return cmd;
+	return blk_mq_rq_to_pdu(cmd->request->next_rq);
 }
 
-static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd)
+static inline struct scsi_data_buffer *scsi_in(struct scsi_cmnd *cmd)
 {
-	return cmd->sdb.length;
+	return &scsi_in_cmd(cmd)->sdb;
 }
 
-static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
+static inline struct scsi_cmnd *scsi_out_cmd(struct scsi_cmnd *cmd)
 {
-	cmd->sdb.resid = resid;
+	return cmd;
 }
 
-static inline int scsi_get_resid(struct scsi_cmnd *cmd)
+static inline struct scsi_data_buffer *scsi_out(struct scsi_cmnd *cmd)
 {
-	return cmd->sdb.resid;
+	return &scsi_out_cmd(cmd)->sdb;
 }
 
-#define scsi_for_each_sg(cmd, sg, nseg, __i)			\
-	for_each_sg(scsi_sglist(cmd), sg, nseg, __i)
-
-static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
+static inline unsigned scsi_sg_count(struct scsi_cmnd *cmd)
 {
-	return blk_bidi_rq(cmd->request);
+	return cmd->sdb.table.nents;
 }
 
-static inline struct scsi_cmnd *scsi_in_cmd(struct scsi_cmnd *cmd)
+static inline struct scatterlist *scsi_sglist(struct scsi_cmnd *cmd)
 {
-	if (likely(!scsi_bidi_cmnd(cmd)))
-		return cmd;
-	return blk_mq_rq_to_pdu(cmd->request->next_rq);
+	return cmd->sdb.table.sgl;
 }
 
-static inline struct scsi_data_buffer *scsi_in(struct scsi_cmnd *cmd)
+static inline unsigned scsi_bufflen(struct scsi_cmnd *cmd)
 {
-	return &scsi_in_cmd(cmd)->sdb;
+	return cmd->sdb.length;
 }
 
-static inline struct scsi_cmnd *scsi_out_cmd(struct scsi_cmnd *cmd)
+static inline void scsi_set_resid(struct scsi_cmnd *cmd, int resid)
 {
-	return cmd;
+	cmd->sdb.resid = resid;
 }
 
-static inline struct scsi_data_buffer *scsi_out(struct scsi_cmnd *cmd)
+static inline int scsi_get_resid(struct scsi_cmnd *cmd)
 {
-	return &scsi_out_cmd(cmd)->sdb;
+	return cmd->sdb.resid;
 }
 
+#define scsi_for_each_sg(cmd, sg, nseg, __i)			\
+	for_each_sg(scsi_sglist(cmd), sg, nseg, __i)
+
 static inline int scsi_sg_copy_from_buffer(struct scsi_cmnd *cmd,
 					   void *buf, int buflen)
 {
-- 
2.20.1.321.g9e740568ce-goog




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux