linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Haikun Wang <haikun.wang-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3] spi: spi-fsl-dspi: Enable TCF interrupt mode support
Date: Tue, 2 Jun 2015 20:59:10 +0100	[thread overview]
Message-ID: <20150602195910.GL14071@sirena.org.uk> (raw)
In-Reply-To: <1432548469-12714-1-git-send-email-haikun.wang-KZfg59tc24xl57MIdRCFDg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

On Mon, May 25, 2015 at 06:07:49PM +0800, Haikun Wang wrote:

> +		if (dspi->devtype_data->trans_mode == DSPI_EOQ_MODE) {
> +			regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_EOQFE);
> +			message->actual_length += dspi_eoq_write(dspi);
> +		} else if (dspi->devtype_data->trans_mode == DSPI_TCFQ_MODE) {
> +			regmap_write(dspi->regmap, SPI_RSER, SPI_RSER_TCFQE);
> +			message->actual_length += dspi_tcfq_write(dspi);
> +		}

Please use switch statements to select between variants (this is more
idiomatic and makes it easier to add any new variants) both here and in
the other place where you do this.  It'd also be better to handle the
default case - what happens if we forgot a mode here?  I'd expect at
least an error message.

Otherwise this looks good.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      parent reply	other threads:[~2015-06-02 19:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25 10:07 [PATCH v3] spi: spi-fsl-dspi: Enable TCF interrupt mode support Haikun Wang
     [not found] ` <1432548469-12714-1-git-send-email-haikun.wang-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-06-02 19:59   ` Mark Brown [this message]

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=20150602195910.GL14071@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=haikun.wang-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).