diff mbox

[2/6] libsas: use ata_is_ncq() and ata_has_dma() accessors

Message ID 1466422756-126637-3-git-send-email-hare@suse.de
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Hannes Reinecke June 20, 2016, 11:39 a.m. UTC
Use accessors instead of the raw protocol value.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/libsas/sas_ata.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Comments

Tejun Heo June 20, 2016, 3:40 p.m. UTC | #1
On Mon, Jun 20, 2016 at 01:39:12PM +0200, Hannes Reinecke wrote:
> Use accessors instead of the raw protocol value.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/libsas/sas_ata.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 935c430..e1da52c 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -233,15 +233,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
>  	task->task_state_flags = SAS_TASK_STATE_PENDING;
>  	qc->lldd_task = task;
>  
> -	switch (qc->tf.protocol) {
> -	case ATA_PROT_NCQ:
> +	if (ata_is_ncq(qc->tf.protocol))
>  		task->ata_task.use_ncq = 1;
> -		/* fall through */
> -	case ATAPI_PROT_DMA:
> -	case ATA_PROT_DMA:
> +	if (ata_is_dma(qc->tf.protocol))
>  		task->ata_task.dma_xfer = 1;
> -		break;
> -	}

As you're cleaning it up anyway, can you please make ata_is_*()
functions return bool and do

	task->ata_task.use_ncq = ata_is_ncq()

instead?
Hannes Reinecke June 21, 2016, 5:44 a.m. UTC | #2
On 06/20/2016 05:40 PM, Tejun Heo wrote:
> On Mon, Jun 20, 2016 at 01:39:12PM +0200, Hannes Reinecke wrote:
>> Use accessors instead of the raw protocol value.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.com>
>> ---
>>  drivers/scsi/libsas/sas_ata.c | 9 ++-------
>>  1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
>> index 935c430..e1da52c 100644
>> --- a/drivers/scsi/libsas/sas_ata.c
>> +++ b/drivers/scsi/libsas/sas_ata.c
>> @@ -233,15 +233,10 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
>>  	task->task_state_flags = SAS_TASK_STATE_PENDING;
>>  	qc->lldd_task = task;
>>  
>> -	switch (qc->tf.protocol) {
>> -	case ATA_PROT_NCQ:
>> +	if (ata_is_ncq(qc->tf.protocol))
>>  		task->ata_task.use_ncq = 1;
>> -		/* fall through */
>> -	case ATAPI_PROT_DMA:
>> -	case ATA_PROT_DMA:
>> +	if (ata_is_dma(qc->tf.protocol))
>>  		task->ata_task.dma_xfer = 1;
>> -		break;
>> -	}
> 
> As you're cleaning it up anyway, can you please make ata_is_*()
> functions return bool and do
> 
> 	task->ata_task.use_ncq = ata_is_ncq()
> 
> instead?
> 
Sure, will do with the next round.

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 935c430..e1da52c 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -233,15 +233,10 @@  static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
 	task->task_state_flags = SAS_TASK_STATE_PENDING;
 	qc->lldd_task = task;
 
-	switch (qc->tf.protocol) {
-	case ATA_PROT_NCQ:
+	if (ata_is_ncq(qc->tf.protocol))
 		task->ata_task.use_ncq = 1;
-		/* fall through */
-	case ATAPI_PROT_DMA:
-	case ATA_PROT_DMA:
+	if (ata_is_dma(qc->tf.protocol))
 		task->ata_task.dma_xfer = 1;
-		break;
-	}
 
 	if (qc->scsicmd)
 		ASSIGN_SAS_TASK(qc->scsicmd, task);