staging: ccree: Fix indentation of driver_hash[] initializers
PATCH 1/2 staging: ccree: Fix indentation of driver_hash[] initializers
Closing braces should match the first characters of the opening.
--- drivers/staging/ccree/ssi_hash.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/staging/ccree/ssi_hash.c +14 -14
@@ -2001,8 +2001,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA1_DIGEST_SIZE, .statesize = sizeof(struct sha1_state), - }, }, + }, .hash_mode = DRV_HASH_SHA1, .hw_mode = DRV_HASH_HW_SHA1, .inter_digestsize = SHA1_DIGEST_SIZE,
@@ -2028,8 +2028,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA256_DIGEST_SIZE, .statesize = sizeof(struct sha256_state), - }, }, + }, .hash_mode = DRV_HASH_SHA256, .hw_mode = DRV_HASH_HW_SHA256, .inter_digestsize = SHA256_DIGEST_SIZE,
@@ -2055,8 +2055,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA224_DIGEST_SIZE, .statesize = sizeof(struct sha256_state), - }, }, + }, .hash_mode = DRV_HASH_SHA224, .hw_mode = DRV_HASH_HW_SHA256, .inter_digestsize = SHA256_DIGEST_SIZE,
@@ -2083,8 +2083,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA384_DIGEST_SIZE, .statesize = sizeof(struct sha512_state), - }, }, + }, .hash_mode = DRV_HASH_SHA384, .hw_mode = DRV_HASH_HW_SHA512, .inter_digestsize = SHA512_DIGEST_SIZE,
@@ -2110,8 +2110,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA512_DIGEST_SIZE, .statesize = sizeof(struct sha512_state), - }, }, + }, .hash_mode = DRV_HASH_SHA512, .hw_mode = DRV_HASH_HW_SHA512, .inter_digestsize = SHA512_DIGEST_SIZE,
@@ -2138,8 +2138,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = MD5_DIGEST_SIZE, .statesize = sizeof(struct md5_state), - }, }, + }, .hash_mode = DRV_HASH_MD5, .hw_mode = DRV_HASH_HW_MD5, .inter_digestsize = MD5_DIGEST_SIZE,
@@ -2163,12 +2163,12 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = AES_BLOCK_SIZE, .statesize = sizeof(struct aeshash_state), - }, }, - .hash_mode = DRV_HASH_NULL, - .hw_mode = DRV_CIPHER_XCBC_MAC, - .inter_digestsize = AES_BLOCK_SIZE, }, + .hash_mode = DRV_HASH_NULL, + .hw_mode = DRV_CIPHER_XCBC_MAC, + .inter_digestsize = AES_BLOCK_SIZE, + },#if SSI_CC_HAS_CMAC { .name = "cmac(aes)",
@@ -2189,12 +2189,12 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = AES_BLOCK_SIZE, .statesize =sizeof (struct aeshash_state ), - }, }, - .hash_mode = DRV_HASH_NULL, - .hw_mode = DRV_CIPHER_CMAC, - .inter_digestsize = AES_BLOCK_SIZE, }, + .hash_mode = DRV_HASH_NULL, + .hw_mode = DRV_CIPHER_CMAC, + .inter_digestsize = AES_BLOCK_SIZE, + }, #endif };
Signature · 1 line
2.7.4
PATCH 2/2 staging: ccree: Fix initialization of anonymous unions
With gcc 4.1.2:
drivers/staging/ccree/ssi_hash.c:1990: error: unknown field ‘template_ahash’ specified in initializer drivers/staging/ccree/ssi_hash.c:1991: error: unknown field ‘init’ specified in initializer drivers/staging/ccree/ssi_hash.c:1991: warning: missing braces around initializer drivers/staging/ccree/ssi_hash.c:1991: warning: (near initialization for ‘driver_hash[0].<anonymous>.template_ahash’) drivers/staging/ccree/ssi_hash.c:1992: error: unknown field ‘update’ specified in initializer drivers/staging/ccree/ssi_hash.c:1992: warning: excess elements in union initializer
...
Add missing braces to fix this.
After this it compiles without warnings with gcc 4.1.2 and 4.9.0.
--- drivers/staging/ccree/ssi_hash.c | 208 +++++++++++++++++++++------------------ 1 file changed, 112 insertions(+), 96 deletions(-)
drivers/staging/ccree/ssi_hash.c +112 -96
@@ -1987,20 +1987,22 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-sha1-dx", .blocksize = SHA1_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize =SHA1_DIGEST_SIZE , - .statesize = sizeof(struct sha1_state), + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize =SHA1_DIGEST_SIZE , + .statesize = sizeof(struct sha1_state), + }, }, }, .hash_mode = DRV_HASH_SHA1,
@@ -2014,20 +2016,22 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-sha256-dx", .blocksize = SHA256_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize =SHA256_DIGEST_SIZE , - .statesize = sizeof(struct sha256_state), + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize =SHA256_DIGEST_SIZE , + .statesize = sizeof(struct sha256_state), + }, }, }, .hash_mode = DRV_HASH_SHA256,
@@ -2041,20 +2045,22 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-sha224-dx", .blocksize = SHA224_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize =SHA224_DIGEST_SIZE , - .statesize = sizeof(struct sha256_state), + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize =SHA224_DIGEST_SIZE , + .statesize = sizeof(struct sha256_state), + }, }, }, .hash_mode = DRV_HASH_SHA224,
@@ -2069,20 +2075,22 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-sha384-dx", .blocksize = SHA384_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize =SHA384_DIGEST_SIZE , - .statesize = sizeof(struct sha512_state), + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize =SHA384_DIGEST_SIZE , + .statesize = sizeof(struct sha512_state), + }, }, }, .hash_mode = DRV_HASH_SHA384,
@@ -2096,20 +2104,22 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-sha512-dx", .blocksize = SHA512_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize =SHA512_DIGEST_SIZE , - .statesize = sizeof(struct sha512_state), + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize =SHA512_DIGEST_SIZE , + .statesize = sizeof(struct sha512_state), + }, }, }, .hash_mode = DRV_HASH_SHA512,
@@ -2124,20 +2134,22 @@ static struct ssi_hash_template driver_hash[] = { .hmac_driver_name = "hmac-md5-dx", .blocksize = MD5_HMAC_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_ahash_update, - .final = ssi_ahash_final, - .finup = ssi_ahash_finup, - .digest = ssi_ahash_digest, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_ahash_update, + .final = ssi_ahash_final, + .finup = ssi_ahash_finup, + .digest = ssi_ahash_digest, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .setkey = ssi_ahash_setkey, - .halg = { - .digestsize =MD5_DIGEST_SIZE , - .statesize = sizeof(struct md5_state), + .setkey = ssi_ahash_setkey, + .halg = { + .digestsize =MD5_DIGEST_SIZE , + .statesize = sizeof(struct md5_state), + }, }, }, .hash_mode = DRV_HASH_MD5,
@@ -2149,20 +2161,22 @@ static struct ssi_hash_template driver_hash[] = { .driver_name = "xcbc-aes-dx", .blocksize = AES_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_mac_update, - .final = ssi_mac_final, - .finup = ssi_mac_finup, - .digest = ssi_mac_digest, - .setkey = ssi_xcbc_setkey, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_mac_update, + .final = ssi_mac_final, + .finup = ssi_mac_finup, + .digest = ssi_mac_digest, + .setkey = ssi_xcbc_setkey, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .halg = { - .digestsize =AES_BLOCK_SIZE , - .statesize = sizeof(struct aeshash_state), + .halg = { + .digestsize =AES_BLOCK_SIZE , + .statesize = sizeof(struct aeshash_state), + }, }, }, .hash_mode = DRV_HASH_NULL,
@@ -2175,20 +2189,22 @@ static struct ssi_hash_template driver_hash[] = { .driver_name = "cmac-aes-dx", .blocksize = AES_BLOCK_SIZE, .synchronize = false, - .template_ahash = { - .init = ssi_ahash_init, - .update = ssi_mac_update, - .final = ssi_mac_final, - .finup = ssi_mac_finup, - .digest = ssi_mac_digest, - .setkey = ssi_cmac_setkey, + { + .template_ahash = { + .init = ssi_ahash_init, + .update = ssi_mac_update, + .final = ssi_mac_final, + .finup = ssi_mac_finup, + .digest = ssi_mac_digest, + .setkey = ssi_cmac_setkey, #ifdef EXPORT_FIXED - .export = ssi_ahash_export, - .import = ssi_ahash_import, + .export = ssi_ahash_export, + .import = ssi_ahash_import, #endif - .halg = { - .digestsize =AES_BLOCK_SIZE , - .statesize = sizeof(struct aeshash_state), + .halg = { + .digestsize =AES_BLOCK_SIZE , + .statesize = sizeof(struct aeshash_state), + }, }, }, .hash_mode = DRV_HASH_NULL,
Signature · 1 line
2.7.4
Re: [PATCH 2/2] staging: ccree: Fix initialization of anonymous unions
Quoted 10 lines · Geert Uytterhoeven
With gcc 4.1.2:
drivers/staging/ccree/ssi_hash.c:1990: error: unknown field ‘template_ahash’ specified in initializerdrivers/staging/ccree/ssi_hash.c:1991: error: unknown field ‘init’ specified in initializerdrivers/staging/ccree/ssi_hash.c:1991: warning: missing braces around initializerdrivers/staging/ccree/ssi_hash.c:1991: warning: (near initialization for ‘driver_hash[0].<anonymous>.template_ahash’)drivers/staging/ccree/ssi_hash.c:1992: error: unknown field ‘update’ specified in initializerdrivers/staging/ccree/ssi_hash.c:1992: warning: excess elements in union initializer
...
Quoted 2 lines
Add missing braces to fix this.
After this it compiles without warnings with gcc 4.1.2 and 4.9.0.
For reference, we need this up to gcc-4.5, the anonymous initializers were added on gcc-4.6.
Arnd
Re: [PATCH 2/2] staging: ccree: Fix initialization of anonymous unions
In reply to Geert UytterhoevenHi,
Quoted 10 lines · Geert Uytterhoeven
With gcc 4.1.2:
drivers/staging/ccree/ssi_hash.c:1990: error: unknown field ‘template_ahash’ specified in initializerdrivers/staging/ccree/ssi_hash.c:1991: error: unknown field ‘init’ specified in initializerdrivers/staging/ccree/ssi_hash.c:1991: warning: missing braces around initializerdrivers/staging/ccree/ssi_hash.c:1991: warning: (near initialization for ‘driver_hash[0].<anonymous>.template_ahash’)drivers/staging/ccree/ssi_hash.c:1992: error: unknown field ‘update’ specified in initializerdrivers/staging/ccree/ssi_hash.c:1992: warning: excess elements in union initializer
...
Quoted 2 lines
Add missing braces to fix this.
After this it compiles without warnings with gcc 4.1.2 and 4.9.0.
It seems this bothered Andrew Morton too as he just took in to mm his own patch for the same issue,
Thanks anyway!
Gilad
Signature · 6 lines
Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru
Greg Kroah-Hartman
maintainerQuoted 6 lines · Geert Uytterhoeven
Closing braces should match the first characters of the opening.
Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/staging/ccree/ssi_hash.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
Doesn't apply to my tree at all :(
Hi Greg,
Quoted 9 lines · Greg Kroah-Hartman
Quoted 6 lines · Geert Uytterhoeven
Closing braces should match the first characters of the opening.
Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/staging/ccree/ssi_hash.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)Doesn't apply to my tree at all :(
Not anymore, as Linus applied an alternative from Andrew for my 2/2. Hence see v2.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Greg Kroah-Hartman
maintainerQuoted 12 lines · Geert Uytterhoeven
Hi Greg,
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Geert Uytterhoeven
Closing braces should match the first characters of the opening.
Signed-off-by Geert Uytterhoeven <[email protected]>--- drivers/staging/ccree/ssi_hash.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
Quoted 4 lines
Quoted 1 line
Doesn't apply to my tree at all :(
Not anymore, as Linus applied an alternative from Andrew for my 2/2. Hence see v2.
Ah, got that one now, sorry for the noise :)
greg k-h