diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2011-07-19 09:26:40 +0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 13:37:49 +0400 |
commit | 11650b859681e03fdbf26277fcfc5f1f62186703 (patch) | |
tree | 1073305aa356589d05cf59c70dae748c4c0e8b75 /drivers/target/target_core_fabric_lib.c | |
parent | 163cd5fa9fcb7ccc73a9e39d5f601cfd41a23bfa (diff) | |
download | linux-11650b859681e03fdbf26277fcfc5f1f62186703.tar.xz |
target: remove custom hex2bin() implementation
This patch drops transport_asciihex_to_binaryhex() in favor of proper
hex2bin usage from include/linux/kernel.h:hex2bin()
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_fabric_lib.c')
-rw-r--r-- | drivers/target/target_core_fabric_lib.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c index a29968806cfc..c4ea3a9a555b 100644 --- a/drivers/target/target_core_fabric_lib.c +++ b/drivers/target/target_core_fabric_lib.c @@ -25,6 +25,7 @@ * ******************************************************************************/ +#include <linux/kernel.h> #include <linux/string.h> #include <linux/ctype.h> #include <linux/spinlock.h> @@ -61,9 +62,8 @@ u32 sas_get_pr_transport_id( int *format_code, unsigned char *buf) { - unsigned char binary, *ptr; - int i; - u32 off = 4; + unsigned char *ptr; + /* * Set PROTOCOL IDENTIFIER to 6h for SAS */ @@ -74,10 +74,8 @@ u32 sas_get_pr_transport_id( */ ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */ - for (i = 0; i < 16; i += 2) { - binary = transport_asciihex_to_binaryhex(&ptr[i]); - buf[off++] = binary; - } + hex2bin(&buf[4], ptr, 8); + /* * The SAS Transport ID is a hardcoded 24-byte length */ @@ -157,7 +155,7 @@ u32 fc_get_pr_transport_id( int *format_code, unsigned char *buf) { - unsigned char binary, *ptr; + unsigned char *ptr; int i; u32 off = 8; /* @@ -176,8 +174,7 @@ u32 fc_get_pr_transport_id( i++; continue; } - binary = transport_asciihex_to_binaryhex(&ptr[i]); - buf[off++] = binary; + hex2bin(&buf[off++], &ptr[i], 1); i += 2; } /* |