All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: hare@suse.com, damien.lemoal@hgst.com, linux-ide@vger.kernel.org,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH 04/10] ata: add ata_is_fpdma() accessor
Date: Thu, 14 Jul 2016 10:37:56 -0400	[thread overview]
Message-ID: <20160714143756.GF15005@htj.duckdns.org> (raw)
In-Reply-To: <1468454751-12466-5-git-send-email-hch@lst.de>

Hello,

I'm still a bit confused about this patch.

On Thu, Jul 14, 2016 at 09:05:45AM +0900, Christoph Hellwig wrote:
> diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
> index a723ae9..acfb865 100644
> --- a/drivers/ata/sata_fsl.c
> +++ b/drivers/ata/sata_fsl.c
> @@ -534,7 +534,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
>  	VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
>  		cd->cfis[0], cd->cfis[1], cd->cfis[2]);
>  
> -	if (qc->tf.protocol == ATA_PROT_NCQ) {
> +	if (ata_is_fpdma(qc->tf.protocol)) {

ata_is_fpdma() tests NCQ or DMA.  Is this right?

> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -1173,7 +1173,7 @@ static void mv_set_irq_coalescing(struct ata_host *host,
>  static void mv_start_edma(struct ata_port *ap, void __iomem *port_mmio,
>  			 struct mv_port_priv *pp, u8 protocol)
>  {
> -	int want_ncq = (protocol == ATA_PROT_NCQ);
> +	int want_ncq = (ata_is_fpdma(protocol));

Let's get rid of the parentheses while at it.

>  
>  	if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
>  		int using_ncq = ((pp->pp_flags & MV_PP_FLAG_NCQ_EN) != 0);
> @@ -2156,8 +2156,7 @@ static void mv_qc_prep_iie(struct ata_queued_cmd *qc)
>  	unsigned in_index;
>  	u32 flags = 0;
>  
> -	if ((tf->protocol != ATA_PROT_DMA) &&
> -	    (tf->protocol != ATA_PROT_NCQ))
> +	if (!ata_is_fpdma(tf->protocol))

This is actually testing !DMA && !NCQ and an equivalent conversion but
the rest aren't.

> diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
> index 734f563..89e36aa 100644
> --- a/drivers/ata/sata_nv.c
> +++ b/drivers/ata/sata_nv.c
> @@ -1407,7 +1407,7 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)
>  	cpb->next_cpb_idx	= 0;
>  
>  	/* turn on NCQ flags for NCQ commands */
> -	if (qc->tf.protocol == ATA_PROT_NCQ)
> +	if (ata_is_fpdma(qc->tf.protocol))
>  		ctl_flags |= NV_CPB_CTL_QUEUE | NV_CPB_CTL_FPDMA;

And I don't know why testing NCQ or DMA would be safe for places like
this.

> +	ATA_PROT_FLAG_FPDMA	= ATA_PROT_FLAG_NCQ | ATA_PROT_FLAG_DMA,
...
> +static inline bool ata_is_fpdma(u8 prot)
> +{
> +	return ata_prot_flags(prot) & ATA_PROT_FLAG_FPDMA;
> +}

???

Thanks.

-- 
tejun

  reply	other threads:[~2016-07-14 14:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-14  0:05 ZAC fixes Christoph Hellwig
2016-07-14  0:05 ` [PATCH 01/10] libata: return boolean values from ata_is_* Christoph Hellwig
2016-07-14  0:05 ` [PATCH 02/10] libata: use ata_is_ncq() accessors Christoph Hellwig
2016-07-14  0:05 ` [PATCH 03/10] libsas: use ata_is_ncq() and ata_has_dma() accessors Christoph Hellwig
2016-07-14 14:45   ` Tejun Heo
2016-07-14  0:05 ` [PATCH 04/10] ata: add ata_is_fpdma() accessor Christoph Hellwig
2016-07-14 14:37   ` Tejun Heo [this message]
2016-07-14 15:15     ` Hannes Reinecke
2016-07-14 15:19       ` Tejun Heo
2016-07-14 16:01         ` Hannes Reinecke
2016-07-15  6:13     ` Christoph Hellwig
2016-07-15  7:07       ` Hannes Reinecke
2016-07-15  7:26         ` Christoph Hellwig
2016-07-14  0:05 ` [PATCH 05/10] ata: fixup ATA_PROT_NODATA Christoph Hellwig
2016-07-14  0:05 ` [PATCH 06/10] libata-eh: decode all taskfile protocols Christoph Hellwig
2016-07-14 11:51   ` Sergei Shtylyov
2016-07-14 14:48   ` Tejun Heo
2016-07-14 23:08     ` Christoph Hellwig
2016-07-14  0:05 ` [PATCH 07/10] ata: Handle ATA NCQ NO-DATA commands correctly Christoph Hellwig
2016-07-14  0:05 ` [PATCH 08/10] libata-scsi: Fix translation of REPORT ZONES command Christoph Hellwig
2016-07-14  0:05 ` [PATCH 09/10] libata-scsi: Fix ZBC management out command translation Christoph Hellwig
2016-07-14 11:54   ` Sergei Shtylyov
2016-07-14  0:05 ` [PATCH 10/10] libata-scsi: minor cleanup for ata_scsi_zbc_out_xlat Christoph Hellwig
2016-07-15 12:09   ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160714143756.GF15005@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=damien.lemoal@hgst.com \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.