Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Sonic Zhang <sonic.adi@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	linux-crypto@vger.kernel.org,
	adi-buildroot-devel@lists.sourceforge.net,
	Sonic Zhang <sonic.zhang@analog.com>
Subject: Re: [PATCH] crypt: bfin_crc: access crc registers by ioread32 and iowrite32 functions
Date: Wed, 9 Apr 2014 19:32:01 +0200	[thread overview]
Message-ID: <201404091932.02072.marex@denx.de> (raw)
In-Reply-To: <1395910353-2853-1-git-send-email-sonic.adi@gmail.com>

On Thursday, March 27, 2014 at 09:52:33 AM, Sonic Zhang wrote:
> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> Move architecture independant crc header file out of the blackfin folder.
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>

[...]

> @@ -530,13 +532,14 @@ static irqreturn_t bfin_crypto_crc_handler(int irq,
> void *dev_id) {
>  	struct bfin_crypto_crc *crc = dev_id;
> 
> -	if (crc->regs->status & DCNTEXP) {
> -		crc->regs->status = DCNTEXP;
> +	if (ioread32(&crc->regs->status) & DCNTEXP) {
> +		iowrite32(DCNTEXP, &crc->regs->status);
> 
>  		/* prepare results */
> -		put_unaligned_le32(crc->regs->result, crc->req->result);
> +		put_unaligned_le32(ioread32(&crc->regs->result),
> +			crc->req->result);
> 
> -		crc->regs->control &= ~BLKEN;
> +		iowrite32(ioread32(&crc->regs->control) & ~BLKEN, &crc->regs-
>control);

You should avoid combining the IO accessors into each other like this, it's 
rather cryptic. Please introduce some variable like so:

u32 reg;
reg = ioread32(...);
reg &= ~....
iowrite32(reg, ...);

[...]

Why do you not use readl()/writel() ?

Other than that, it's a move in the right direction.

Best regards,
Marek Vasut

  parent reply	other threads:[~2014-04-09 17:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27  8:52 [PATCH] crypt: bfin_crc: access crc registers by ioread32 and iowrite32 functions Sonic Zhang
2014-04-02  4:57 ` Sonic Zhang
2014-04-09 17:32 ` Marek Vasut [this message]
2014-04-10  3:50   ` Sonic Zhang
2014-04-10  7:48     ` Marek Vasut

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=201404091932.02072.marex@denx.de \
    --to=marex@denx.de \
    --cc=adi-buildroot-devel@lists.sourceforge.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sonic.adi@gmail.com \
    --cc=sonic.zhang@analog.com \
    /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