Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
[platform/upstream/kernel-adaptation-pc.git] / drivers / scsi / lpfc / lpfc_attr.c
index fac26e4..23ce457 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/interrupt.h>
 #include <linux/aer.h>
 #include <linux/gfp.h>
+#include <linux/kernel.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
@@ -1835,12 +1836,11 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr,
 
        /* Validate and store the new name */
        for (i=0, j=0; i < 16; i++) {
-               if ((*buf >= 'a') && (*buf <= 'f'))
-                       j = ((j << 4) | ((*buf++ -'a') + 10));
-               else if ((*buf >= 'A') && (*buf <= 'F'))
-                       j = ((j << 4) | ((*buf++ -'A') + 10));
-               else if ((*buf >= '0') && (*buf <= '9'))
-                       j = ((j << 4) | (*buf++ -'0'));
+               int value;
+
+               value = hex_to_bin(*buf++);
+               if (value >= 0)
+                       j = (j << 4) | value;
                else
                        return -EINVAL;
                if (i % 2) {
@@ -1928,12 +1928,11 @@ lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr,
 
        /* Validate and store the new name */
        for (i=0, j=0; i < 16; i++) {
-               if ((*buf >= 'a') && (*buf <= 'f'))
-                       j = ((j << 4) | ((*buf++ -'a') + 10));
-               else if ((*buf >= 'A') && (*buf <= 'F'))
-                       j = ((j << 4) | ((*buf++ -'A') + 10));
-               else if ((*buf >= '0') && (*buf <= '9'))
-                       j = ((j << 4) | (*buf++ -'0'));
+               int value;
+
+               value = hex_to_bin(*buf++);
+               if (value >= 0)
+                       j = (j << 4) | value;
                else
                        return -EINVAL;
                if (i % 2) {
@@ -2818,7 +2817,6 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = {
        .attr = {
                .name = "lpfc_drvr_stat_data",
                .mode = S_IRUSR,
-               .owner = THIS_MODULE,
        },
        .size = LPFC_MAX_TARGET * MAX_STAT_DATA_SIZE_PER_TARGET,
        .read = sysfs_drvr_stat_data_read,