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: Thu, 10 Apr 2014 09:48:30 +0200	[thread overview]
Message-ID: <201404100948.30352.marex@denx.de> (raw)
In-Reply-To: <CAJxxZ0OgK2EP51wv1_rqigfLOvMAXMiuNciDws2xSyxnaTFUdg@mail.gmail.com>

On Thursday, April 10, 2014 at 05:50:37 AM, Sonic Zhang wrote:
> Hi Marek,
> 
> On Thu, Apr 10, 2014 at 1:32 AM, Marek Vasut <marex@denx.de> wrote:
> > 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, ...);
> > 
> > [...]
> 
> OK
> 
> > Why do you not use readl()/writel() ?
> 
> ioread and iowrite are inline function, which do parameter type
> checking, while readl and writel don't as a macro.
> I am fine if you prefer readl/writel in crypto code.

I was just curious what the rationale behind this was.

Best regards,
Marek Vasut

      reply	other threads:[~2014-04-10  8:20 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
2014-04-10  3:50   ` Sonic Zhang
2014-04-10  7:48     ` Marek Vasut [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=201404100948.30352.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