Re: [PATCH 02/15] scsi: add scsi_{get,put}_internal_cmd() helper

Bart Van Assche
2021-11-26T23:14:29Z

On 11/25/21 07:10, Hannes Reinecke wrote:
> +struct scsi_cmnd *scsi_get_internal_cmd(struct scsi_device *sdev,
> + int data_direction, bool nowait)

Please use enum dma_data_direction instead of 'int' for the data direction.
> +{
> + struct request *rq;
> + struct scsi_cmnd *scmd;
> + blk_mq_req_flags_t flags = 0;
> + int op;

The name 'op' is confusing since that variable is a bitfield that
includes the operation and operation flags. Consider one of the names
'opf', 'op_and_flags' or 'cmd_and_flags'. Please also change the data
type from 'int' into 'unsigned int' or 'u32'.

> + op = (data_direction == DMA_TO_DEVICE) ?
> + REQ_OP_DRV_OUT : REQ_OP_DRV_IN;

Please leave out the parentheses from the above assignment.

Thanks,

Bart.