diff options
author | Andy Shevchenko <ext-andriy.shevchenko@nokia.com> | 2010-08-10 21:01:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:02 -0400 |
commit | ecc3099002c1cc87e9e4b3dc5fdf7821828f6733 (patch) | |
tree | 7dff340773a244ef2eac7907a6b88c0c4131ac3a /drivers | |
parent | 3094141c6532a4f748425c21c091001f218da8ae (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')
-rw-r--r-- | drivers/scsi/aacraid/rx.c | 5 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 23 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 12 |
3 files changed, 19 insertions, 21 deletions
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 04057ab72a8..84d77fd86e5 100644 --- a/drivers/scsi/aacraid/rx.c +++ b/drivers/scsi/aacraid/rx.c | |||
@@ -352,9 +352,8 @@ static int aac_rx_check_health(struct aac_dev *dev) | |||
352 | pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), | 352 | pci_free_consistent(dev->pdev, sizeof(struct POSTSTATUS), |
353 | post, paddr); | 353 | post, paddr); |
354 | if (likely((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X')))) { | 354 | if (likely((buffer[0] == '0') && ((buffer[1] == 'x') || (buffer[1] == 'X')))) { |
355 | ret = (buffer[2] <= '9') ? (buffer[2] - '0') : (buffer[2] - 'A' + 10); | 355 | ret = (hex_to_bin(buffer[2]) << 4) + |
356 | ret <<= 4; | 356 | hex_to_bin(buffer[3]); |
357 | ret += (buffer[3] <= '9') ? (buffer[3] - '0') : (buffer[3] - 'A' + 10); | ||
358 | } | 357 | } |
359 | pci_free_consistent(dev->pdev, 512, buffer, baddr); | 358 | pci_free_consistent(dev->pdev, 512, buffer, baddr); |
360 | return ret; | 359 | return ret; |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 162704cf6a9..ad05b266e95 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) { |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index edb6b362a8f..d7e470a0618 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/kernel.h> | ||
32 | #include <scsi/scsi_device.h> | 33 | #include <scsi/scsi_device.h> |
33 | #include <scsi/scsi_host.h> | 34 | #include <scsi/scsi_host.h> |
34 | #include <scsi/scsi_transport.h> | 35 | #include <scsi/scsi_transport.h> |
@@ -1730,12 +1731,11 @@ fc_parse_wwn(const char *ns, u64 *nm) | |||
1730 | 1731 | ||
1731 | /* Validate and store the new name */ | 1732 | /* Validate and store the new name */ |
1732 | for (i=0, j=0; i < 16; i++) { | 1733 | for (i=0, j=0; i < 16; i++) { |
1733 | if ((*ns >= 'a') && (*ns <= 'f')) | 1734 | int value; |
1734 | j = ((j << 4) | ((*ns++ -'a') + 10)); | 1735 | |
1735 | else if ((*ns >= 'A') && (*ns <= 'F')) | 1736 | value = hex_to_bin(*ns++); |
1736 | j = ((j << 4) | ((*ns++ -'A') + 10)); | 1737 | if (value >= 0) |
1737 | else if ((*ns >= '0') && (*ns <= '9')) | 1738 | j = (j << 4) | value; |
1738 | j = ((j << 4) | (*ns++ -'0')); | ||
1739 | else | 1739 | else |
1740 | return -EINVAL; | 1740 | return -EINVAL; |
1741 | if (i % 2) { | 1741 | if (i % 2) { |