linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Crypto: geode-aes: Fix some code style issues
@ 2010-04-15 17:17 Chihau Chau
  2010-04-15 18:34 ` Andres Salomon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chihau Chau @ 2010-04-15 17:17 UTC (permalink / raw)
  To: herbert
  Cc: davem, roel.kluin, sebastian, linux-geode, linux-crypto,
	linux-kernel, Chihau Chau

From: Chihau Chau <chihau@gmail.com>

This fixes some code style issues like:

- Use #include <linux/io.h> instead of <asm/io.h> and #include
  <linux/delay.h> instead of <asm/delay.h>

- Use "foo *bar" instead of "foo * bar"

- Add a space after the for or while sentence and before the open
  parenthesis '('

- Don't use assignments in a if condition

Signed-off-by: Chihau Chau <chihau@gmail.com>
---
 drivers/crypto/geode-aes.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
index c7a5a43..09389dd 100644
--- a/drivers/crypto/geode-aes.c
+++ b/drivers/crypto/geode-aes.c
@@ -15,14 +15,14 @@
 #include <crypto/algapi.h>
 #include <crypto/aes.h>
 
-#include <asm/io.h>
-#include <asm/delay.h>
+#include <linux/io.h>
+#include <linux/delay.h>
 
 #include "geode-aes.h"
 
 /* Static structures */
 
-static void __iomem * _iobase;
+static void __iomem *_iobase;
 static spinlock_t lock;
 
 /* Write a 128 bit field (either a writable key or IV) */
@@ -30,7 +30,7 @@ static inline void
 _writefield(u32 offset, void *value)
 {
 	int i;
-	for(i = 0; i < 4; i++)
+	for (i = 0; i < 4; i++)
 		iowrite32(((u32 *) value)[i], _iobase + offset + (i * 4));
 }
 
@@ -39,7 +39,7 @@ static inline void
 _readfield(u32 offset, void *value)
 {
 	int i;
-	for(i = 0; i < 4; i++)
+	for (i = 0; i < 4; i++)
 		((u32 *) value)[i] = ioread32(_iobase + offset + (i * 4));
 }
 
@@ -59,7 +59,7 @@ do_crypt(void *src, void *dst, int len, u32 flags)
 	do {
 		status = ioread32(_iobase + AES_INTR_REG);
 		cpu_relax();
-	} while(!(status & AES_INTRA_PENDING) && --counter);
+	} while (!(status & AES_INTRA_PENDING) && --counter);
 
 	/* Clear the event */
 	iowrite32((status & 0xFF) | AES_INTRA_PENDING, _iobase + AES_INTR_REG);
@@ -317,7 +317,7 @@ geode_cbc_decrypt(struct blkcipher_desc *desc,
 	err = blkcipher_walk_virt(desc, &walk);
 	op->iv = walk.iv;
 
-	while((nbytes = walk.nbytes)) {
+	while ((nbytes = walk.nbytes)) {
 		op->src = walk.src.virt.addr,
 		op->dst = walk.dst.virt.addr;
 		op->mode = AES_MODE_CBC;
@@ -349,7 +349,7 @@ geode_cbc_encrypt(struct blkcipher_desc *desc,
 	err = blkcipher_walk_virt(desc, &walk);
 	op->iv = walk.iv;
 
-	while((nbytes = walk.nbytes)) {
+	while ((nbytes = walk.nbytes)) {
 		op->src = walk.src.virt.addr,
 		op->dst = walk.dst.virt.addr;
 		op->mode = AES_MODE_CBC;
@@ -429,7 +429,7 @@ geode_ecb_decrypt(struct blkcipher_desc *desc,
 	blkcipher_walk_init(&walk, dst, src, nbytes);
 	err = blkcipher_walk_virt(desc, &walk);
 
-	while((nbytes = walk.nbytes)) {
+	while ((nbytes = walk.nbytes)) {
 		op->src = walk.src.virt.addr,
 		op->dst = walk.dst.virt.addr;
 		op->mode = AES_MODE_ECB;
@@ -459,7 +459,7 @@ geode_ecb_encrypt(struct blkcipher_desc *desc,
 	blkcipher_walk_init(&walk, dst, src, nbytes);
 	err = blkcipher_walk_virt(desc, &walk);
 
-	while((nbytes = walk.nbytes)) {
+	while ((nbytes = walk.nbytes)) {
 		op->src = walk.src.virt.addr,
 		op->dst = walk.dst.virt.addr;
 		op->mode = AES_MODE_ECB;
@@ -518,11 +518,12 @@ static int __devinit
 geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
 	int ret;
-
-	if ((ret = pci_enable_device(dev)))
+	ret = pci_enable_device(dev);
+	if (ret)
 		return ret;
 
-	if ((ret = pci_request_regions(dev, "geode-aes")))
+	ret = pci_request_regions(dev, "geode-aes");
+	if (ret)
 		goto eenable;
 
 	_iobase = pci_iomap(dev, 0, 0);
@@ -537,13 +538,16 @@ geode_aes_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	/* Clear any pending activity */
 	iowrite32(AES_INTR_PENDING | AES_INTR_MASK, _iobase + AES_INTR_REG);
 
-	if ((ret = crypto_register_alg(&geode_alg)))
+	ret = crypto_register_alg(&geode_alg);
+	if (ret)
 		goto eiomap;
 
-	if ((ret = crypto_register_alg(&geode_ecb_alg)))
+	ret = crypto_register_alg(&geode_ecb_alg);
+	if (ret)
 		goto ealg;
 
-	if ((ret = crypto_register_alg(&geode_cbc_alg)))
+	ret = crypto_register_alg(&geode_cbc_alg);
+	if (ret)
 		goto eecb;
 
 	printk(KERN_NOTICE "geode-aes: GEODE AES engine enabled.\n");
-- 
1.5.6.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Crypto: geode-aes: Fix some code style issues
  2010-04-15 17:17 [PATCH] Crypto: geode-aes: Fix some code style issues Chihau Chau
@ 2010-04-15 18:34 ` Andres Salomon
  2010-04-16 20:06 ` Sebastian Andrzej Siewior
  2010-04-19 13:03 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Andres Salomon @ 2010-04-15 18:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-geode, linux-crypto

On Thu, 15 Apr 2010 13:17:59 -0400
Chihau Chau <chihau@gmail.com> wrote:

> From: Chihau Chau <chihau@gmail.com>
> 
> This fixes some code style issues like:
> 
> - Use #include <linux/io.h> instead of <asm/io.h> and #include
>   <linux/delay.h> instead of <asm/delay.h>
> 
> - Use "foo *bar" instead of "foo * bar"
> 
> - Add a space after the for or while sentence and before the open
>   parenthesis '('
> 
> - Don't use assignments in a if condition
> 
> Signed-off-by: Chihau Chau <chihau@gmail.com>

Looks obviously correct to me.

Acked-by: Andres Salomon <dilinger@debian.org>


> ---
>  drivers/crypto/geode-aes.c |   36 ++++++++++++++++++++----------------
>  1 files changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/crypto/geode-aes.c b/drivers/crypto/geode-aes.c
> index c7a5a43..09389dd 100644
> --- a/drivers/crypto/geode-aes.c
> +++ b/drivers/crypto/geode-aes.c
> @@ -15,14 +15,14 @@
>  #include <crypto/algapi.h>
>  #include <crypto/aes.h>
>  
> -#include <asm/io.h>
> -#include <asm/delay.h>
> +#include <linux/io.h>
> +#include <linux/delay.h>
>  

I don't see any delay functions being used anywhere; delay.h can
probably just be dropped.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Crypto: geode-aes: Fix some code style issues
  2010-04-15 17:17 [PATCH] Crypto: geode-aes: Fix some code style issues Chihau Chau
  2010-04-15 18:34 ` Andres Salomon
@ 2010-04-16 20:06 ` Sebastian Andrzej Siewior
  2010-04-19 13:03 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Sebastian Andrzej Siewior @ 2010-04-16 20:06 UTC (permalink / raw)
  To: Chihau Chau
  Cc: herbert, davem, roel.kluin, sebastian, linux-geode, linux-crypto,
	linux-kernel

* Chihau Chau | 2010-04-15 13:17:59 [-0400]:

>From: Chihau Chau <chihau@gmail.com>
>
>This fixes some code style issues like:

looks good

Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Crypto: geode-aes: Fix some code style issues
  2010-04-15 17:17 [PATCH] Crypto: geode-aes: Fix some code style issues Chihau Chau
  2010-04-15 18:34 ` Andres Salomon
  2010-04-16 20:06 ` Sebastian Andrzej Siewior
@ 2010-04-19 13:03 ` Herbert Xu
  2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2010-04-19 13:03 UTC (permalink / raw)
  To: Chihau Chau
  Cc: davem, roel.kluin, sebastian, linux-geode, linux-crypto, linux-kernel

On Thu, Apr 15, 2010 at 05:17:59PM +0000, Chihau Chau wrote:
> From: Chihau Chau <chihau@gmail.com>
> 
> This fixes some code style issues like:

Applied.  Thanks!
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-19 13:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-15 17:17 [PATCH] Crypto: geode-aes: Fix some code style issues Chihau Chau
2010-04-15 18:34 ` Andres Salomon
2010-04-16 20:06 ` Sebastian Andrzej Siewior
2010-04-19 13:03 ` Herbert Xu

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).