Re: [PATCH] crypt: bfin_crc: access crc registers by ioread32 and iowrite32 functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[...]

> @@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux