aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorAndy Shevchenko <ext-andriy.shevchenko@nokia.com>2010-08-10 21:01:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-11 11:59:02 -0400
commitecc3099002c1cc87e9e4b3dc5fdf7821828f6733 (patch)
tree7dff340773a244ef2eac7907a6b88c0c4131ac3a /drivers/scsi/lpfc/lpfc_attr.c
parent3094141c6532a4f748425c21c091001f218da8ae (diff)
drivers: scsi: use newly introduced hex_to_bin() method
Signed-off-by: Andy Shevchenko <ext-andriy.shevchenko@nokia.com> Cc: Adaptec OEM Raid Solutions <aacraid@adaptec.com> Cc: "James E.J. Bottomley" <James.Bottomley@suse.de> Cc: James Smart <james.smart@emulex.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 162704cf6a96..ad05b266e950 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/aer.h> 26#include <linux/aer.h>
27#include <linux/gfp.h> 27#include <linux/gfp.h>
28#include <linux/kernel.h>
28 29
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
30#include <scsi/scsi_device.h> 31#include <scsi/scsi_device.h>
@@ -1795,12 +1796,11 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr,
1795 1796
1796 /* Validate and store the new name */ 1797 /* Validate and store the new name */
1797 for (i=0, j=0; i < 16; i++) { 1798 for (i=0, j=0; i < 16; i++) {
1798 if ((*buf >= 'a') && (*buf <= 'f')) 1799 int value;
1799 j = ((j << 4) | ((*buf++ -'a') + 10)); 1800
1800 else if ((*buf >= 'A') && (*buf <= 'F')) 1801 value = hex_to_bin(*buf++);
1801 j = ((j << 4) | ((*buf++ -'A') + 10)); 1802 if (value >= 0)
1802 else if ((*buf >= '0') && (*buf <= '9')) 1803 j = (j << 4) | value;
1803 j = ((j << 4) | (*buf++ -'0'));
1804 else 1804 else
1805 return -EINVAL; 1805 return -EINVAL;
1806 if (i % 2) { 1806 if (i % 2) {
@@ -1888,12 +1888,11 @@ lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr,
1888 1888
1889 /* Validate and store the new name */ 1889 /* Validate and store the new name */
1890 for (i=0, j=0; i < 16; i++) { 1890 for (i=0, j=0; i < 16; i++) {
1891 if ((*buf >= 'a') && (*buf <= 'f')) 1891 int value;
1892 j = ((j << 4) | ((*buf++ -'a') + 10)); 1892
1893 else if ((*buf >= 'A') && (*buf <= 'F')) 1893 value = hex_to_bin(*buf++);
1894 j = ((j << 4) | ((*buf++ -'A') + 10)); 1894 if (value >= 0)
1895 else if ((*buf >= '0') && (*buf <= '9')) 1895 j = (j << 4) | value;
1896 j = ((j << 4) | (*buf++ -'0'));
1897 else 1896 else
1898 return -EINVAL; 1897 return -EINVAL;
1899 if (i % 2) { 1898 if (i % 2) {