[PATCH 5/9 v2] crypto: atmel-ecc: Create a config word reader

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

 



Rewrite the function atmel_ecc_init_read_cmd() into a more
general atmel_ecc_init_read_config_word() function to read
any word from the configuration zone, and use this
parameterized with what we want to read out.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
ChangeLog v1->v2:
- Rebased
---
 drivers/crypto/atmel-ecc.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c
index 98f9322ca303..2ec570d06a27 100644
--- a/drivers/crypto/atmel-ecc.c
+++ b/drivers/crypto/atmel-ecc.c
@@ -136,16 +136,13 @@ static void atmel_ecc_checksum(struct atmel_ecc_cmd *cmd)
 	*crc16 = atmel_ecc_crc16(0, data, len);
 }
 
-static void atmel_ecc_init_read_cmd(struct atmel_ecc_cmd *cmd)
+static void atmel_ecc_init_read_config_word(struct atmel_ecc_cmd *cmd,
+					    u16 config_word)
 {
 	cmd->word_addr = COMMAND;
 	cmd->opcode = OPCODE_READ;
-	/*
-	 * Read the word from Configuration zone that contains the lock bytes
-	 * (UserExtra, Selector, LockValue, LockConfig).
-	 */
 	cmd->param1 = CONFIG_ZONE;
-	cmd->param2 = CONFIG_ZONE_FOOTER;
+	cmd->param2 = config_word;
 	cmd->count = READ_COUNT;
 
 	atmel_ecc_checksum(cmd);
@@ -626,7 +623,7 @@ static int device_sanity_check(struct i2c_client *client)
 	if (!cmd)
 		return -ENOMEM;
 
-	atmel_ecc_init_read_cmd(cmd);
+	atmel_ecc_init_read_config_word(cmd, CONFIG_ZONE_FOOTER);
 
 	ret = atmel_ecc_send_receive(client, cmd);
 	if (ret) {
-- 
2.17.0




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

  Powered by Linux