summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2011-07-14 15:11:51 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-07-14 20:31:58 -0700
commit7ca174c85ecae8c6a2a2796e60061350a96e6480 (patch)
tree84b1b6ca684850d2a5dd643229aeb7a495f7f793
parent75d2e5100cb2e74bb27141a2afac708d5f760540 (diff)
arm: tegra: fuse: accept strings starting with 0x/x
some users might enter fuse data starting with 0x/x. this will mess up the fuse programming. do not consider 0x/x while programming the fuses. also fix some compilation warnings Reviewed-on: http://git-master/r/#change,38933 Change-Id: I36b525c71b6d5c437affbaf0724667f8e5984aa6 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/41016 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/tegra_odm_fuses.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/tegra_odm_fuses.c b/arch/arm/mach-tegra/tegra_odm_fuses.c
index 3d70ec409984..6f6d22362fd1 100644
--- a/arch/arm/mach-tegra/tegra_odm_fuses.c
+++ b/arch/arm/mach-tegra/tegra_odm_fuses.c
@@ -760,9 +760,6 @@ static ssize_t fuse_store(struct kobject *kobj, struct kobj_attribute *attr,
return -EINVAL;
}
- if (!isxdigit(*buf))
- return -EINVAL;
-
if (fuse_odm_prod_mode()) {
pr_err("%s: device locked. odm fuse already blown\n", __func__);
return -EPERM;
@@ -775,6 +772,15 @@ static ssize_t fuse_store(struct kobject *kobj, struct kobj_attribute *attr,
return -EINVAL;
}
+ /* see if the string has 0x/x at the start */
+ if (*buf == 'x') {
+ count -= 1;
+ buf++;
+ } else if (*(buf + 1) == 'x') {
+ count -= 2;
+ buf += 2;
+ }
+
/* wakelock to avoid device powering down while programming */
wake_lock_init(&fuse_wk_lock, WAKE_LOCK_SUSPEND, "fuse_wk_lock");
wake_lock(&fuse_wk_lock);
@@ -850,7 +856,7 @@ static ssize_t fuse_show(struct kobject *kobj, struct kobj_attribute *attr, char
return ret;
}
- strcpy(buf, "");
+ strcpy(buf, "0x");
for (i = (fuse_info_tbl[param].sz/sizeof(u32)) - 1; i >= 0 ; i--) {
sprintf(str, "%08x", data[i]);
strcat(buf, str);