From 5066863337afdb0ad7323f424f7959d9f9f066da Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 30 Oct 2014 14:30:06 +0100 Subject: scsi: remove abuses of scsi_populate_tag Unless we want to build a SPI tag message we should just check SCMD_TAGGED instead of reverse engineering a tag type through the use of scsi_populate_tag_msg. Also rename the function to spi_populate_tag_msg, make it behave like the other spi message helpers, and move it to the spi transport class. Signed-off-by: Christoph Hellwig Reviewed-by: Mike Christie Reviewed-by: Hannes Reinecke --- drivers/scsi/scsi_transport_spi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'drivers/scsi/scsi_transport_spi.c') diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index cf08071a9b6e..fa2aece76cc2 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -1207,6 +1208,28 @@ int spi_populate_ppr_msg(unsigned char *msg, int period, int offset, } EXPORT_SYMBOL_GPL(spi_populate_ppr_msg); +/** + * spi_populate_tag_msg - place a tag message in a buffer + * @msg: pointer to the area to place the tag + * @cmd: pointer to the scsi command for the tag + * + * Notes: + * designed to create the correct type of tag message for the + * particular request. Returns the size of the tag message. + * May return 0 if TCQ is disabled for this device. + **/ +int spi_populate_tag_msg(unsigned char *msg, struct scsi_cmnd *cmd) +{ + if (cmd->flags & SCMD_TAGGED) { + *msg++ = MSG_SIMPLE_TAG; + *msg++ = cmd->request->tag; + return 2; + } + + return 0; +} +EXPORT_SYMBOL_GPL(spi_populate_tag_msg); + #ifdef CONFIG_SCSI_CONSTANTS static const char * const one_byte_msgs[] = { /* 0x00 */ "Task Complete", NULL /* Extended Message */, "Save Pointers", -- cgit v1.2.3