Skip to content

Commit 55c7bc3

Browse files
Christoph Hellwigaxboe
authored andcommitted
mtip32xx: remove mtip_get_int_command
Merging this function into the only callers makes the code flow easier. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 7bbf118 commit 55c7bc3

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

drivers/block/mtip32xx/mtip32xx.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,6 @@ static bool mtip_check_surprise_removal(struct pci_dev *pdev)
168168
return false; /* device present */
169169
}
170170

171-
static struct mtip_cmd *mtip_get_int_command(struct driver_data *dd)
172-
{
173-
struct request *rq;
174-
175-
if (mtip_check_surprise_removal(dd->pdev))
176-
return NULL;
177-
178-
rq = blk_mq_alloc_request(dd->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_RESERVED);
179-
if (IS_ERR(rq))
180-
return NULL;
181-
182-
return blk_mq_rq_to_pdu(rq);
183-
}
184-
185171
static struct mtip_cmd *mtip_cmd_from_tag(struct driver_data *dd,
186172
unsigned int tag)
187173
{
@@ -1002,12 +988,15 @@ static int mtip_exec_internal_command(struct mtip_port *port,
1002988
return -EFAULT;
1003989
}
1004990

1005-
int_cmd = mtip_get_int_command(dd);
1006-
if (!int_cmd) {
991+
if (mtip_check_surprise_removal(dd->pdev))
992+
return -EFAULT;
993+
994+
rq = blk_mq_alloc_request(dd->queue, REQ_OP_DRV_IN, BLK_MQ_REQ_RESERVED);
995+
if (IS_ERR(rq)) {
1007996
dbg_printk(MTIP_DRV_NAME "Unable to allocate tag for PIO cmd\n");
1008997
return -EFAULT;
1009998
}
1010-
rq = blk_mq_rq_from_pdu(int_cmd);
999+
10111000
rq->special = &icmd;
10121001

10131002
set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags);
@@ -1029,6 +1018,7 @@ static int mtip_exec_internal_command(struct mtip_port *port,
10291018
}
10301019

10311020
/* Copy the command to the command table */
1021+
int_cmd = blk_mq_rq_to_pdu(rq);
10321022
memcpy(int_cmd->command, fis, fis_len*4);
10331023

10341024
rq->timeout = timeout;

0 commit comments

Comments
 (0)