Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1f4e4773761d0aa622411469b54d6570005a66b1
Commit:     1f4e4773761d0aa622411469b54d6570005a66b1
Parent:     2d506d4fa1df18aa9505820722f834426edc907f
Author:     Sebastian Siewior <[EMAIL PROTECTED]>
AuthorDate: Sun Oct 21 16:18:12 2007 +0800
Committer:  Herbert Xu <[EMAIL PROTECTED]>
CommitDate: Fri Jan 11 08:16:05 2008 +1100

    [CRYPTO] geode: relax in busy loop and care about return value
    
    The code waits in a busy loop until the hardware finishes the encryption
    or decryption process. This wants a cpu_relax() :)
    The busy loop finishes either if the encryption is done or if the counter
    is zero. If the latter is true than the hardware failed. Since this
    should not happen, leave sith a BUG().
    
    Signed-off-by: Sebastian Siewior <[EMAIL PROTECTED]>
    Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>
---
 drivers/crypto/geode-aes.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index 6c04f13..6c6a31b 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -88,9 +88,10 @@ do_crypt(void *src, void *dst, int len, u32 flags)
        /* Start the operation */
        iowrite32(AES_CTRL_START | flags, _iobase + AES_CTRLA_REG);
 
-       do
+       do {
                status = ioread32(_iobase + AES_INTR_REG);
-       while(!(status & AES_INTRA_PENDING) && --counter);
+               cpu_relax();
+       } while(!(status & AES_INTRA_PENDING) && --counter);
 
        /* Clear the event */
        iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG);
@@ -102,6 +103,7 @@ geode_aes_crypt(struct geode_aes_op *op)
 {
        u32 flags = 0;
        unsigned long iflags;
+       int ret;
 
        if (op->len == 0)
                return 0;
@@ -130,7 +132,8 @@ geode_aes_crypt(struct geode_aes_op *op)
                _writefield(AES_WRITEKEY0_REG, op->key);
        }
 
-       do_crypt(op->src, op->dst, op->len, flags);
+       ret = do_crypt(op->src, op->dst, op->len, flags);
+       BUG_ON(ret);
 
        if (op->mode == AES_MODE_CBC)
                _readfield(AES_WRITEIV0_REG, op->iv);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to