misc: tegra-profiler: fix sparse warnings
Igor Nabirushkin [Sun, 7 Dec 2014 12:26:34 +0000 (15:26 +0300)]
Tegra Profiler: fix sparse static warnings.

Bug 1587428
Bug 1598009

Change-Id: Ic07b4d6247a506109144ceb1b7401f25373d2137
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/660600
(cherry picked from commit c197f471258f8eb99aa1402ec3a1144b1b34dd65)
Reviewed-on: http://git-master/r/672041
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

drivers/misc/tegra-profiler/dwarf_unwind.c
drivers/misc/tegra-profiler/eh_unwind.c
drivers/misc/tegra-profiler/hrt.h
drivers/misc/tegra-profiler/quadd.h
drivers/misc/tegra-profiler/version.h

index c71e266..8699bec 100644 (file)
@@ -70,7 +70,7 @@ enum {
        DW_CFA_UNSET,
        DW_CFA_REG_OFFSET,
        DW_CFA_EXP,
-} cfa_how;
+};
 
 struct dw_eh_frame_hdr {
        unsigned char version;
@@ -104,7 +104,7 @@ struct dwarf_cpu_context {
 };
 
 struct quadd_dwarf_context {
-       struct dwarf_cpu_context * __percpu cpu_ctx;
+       struct dwarf_cpu_context __percpu *cpu_ctx;
        atomic_t started;
 };
 
@@ -1634,7 +1634,7 @@ unwind_frame(struct ex_region_info *ri,
                if (!validate_stack_addr(addr, vma_sp, sizeof(unsigned long)))
                        return -QUADD_URC_SP_INCORRECT;
 
-               err = read_user_data((unsigned long *)addr, return_addr);
+               err = read_user_data((unsigned long __user *)addr, return_addr);
                if (err < 0)
                        return err;
 
@@ -1656,7 +1656,7 @@ unwind_frame(struct ex_region_info *ri,
                if (!validate_stack_addr(addr, vma_sp, sizeof(unsigned long)))
                        return -QUADD_URC_SP_INCORRECT;
 
-               err = read_user_data((unsigned long *)addr, fp);
+               err = read_user_data((unsigned long __user *)addr, fp);
                if (err < 0)
                        return err;
 
index a097fd8..0fecf0b 100644 (file)
@@ -119,7 +119,7 @@ validate_mmap_addr(struct quadd_mmap_area *mmap,
 
 #define read_user_data(addr, retval)                           \
 ({                                                             \
-       int ret;                                                \
+       long ret;                                               \
                                                                \
        pagefault_disable();                                    \
        ret = __get_user(retval, addr);                         \
@@ -728,7 +728,7 @@ unwind_exec_insn(struct quadd_mmap_area *mmap,
                        ((insn & 0x3f) << 2) + 4, ctrl->vrs[SP]);
        } else if ((insn & 0xf0) == 0x80) {
                unsigned long mask;
-               u32 *vsp = (u32 *)(unsigned long)ctrl->vrs[SP];
+               u32 __user *vsp = (u32 __user *)(unsigned long)ctrl->vrs[SP];
                int load_sp, reg = 4;
 
                insn = (insn << 8) | unwind_get_byte(mmap, ctrl, &err);
@@ -764,7 +764,7 @@ unwind_exec_insn(struct quadd_mmap_area *mmap,
                ctrl->vrs[SP] = ctrl->vrs[insn & 0x0f];
                pr_debug("CMD_REG_TO_SP: vsp = {r%lu}\n", insn & 0x0f);
        } else if ((insn & 0xf0) == 0xa0) {
-               u32 *vsp = (u32 *)(unsigned long)ctrl->vrs[SP];
+               u32 __user *vsp = (u32 __user *)(unsigned long)ctrl->vrs[SP];
                unsigned int reg;
 
                /* pop R4-R[4+bbb] */
@@ -795,7 +795,7 @@ unwind_exec_insn(struct quadd_mmap_area *mmap,
                pr_debug("CMD_FINISH\n");
        } else if (insn == 0xb1) {
                unsigned long mask = unwind_get_byte(mmap, ctrl, &err);
-               u32 *vsp = (u32 *)(unsigned long)ctrl->vrs[SP];
+               u32 __user *vsp = (u32 __user *)(unsigned long)ctrl->vrs[SP];
                int reg = 0;
 
                if (err < 0)
@@ -840,7 +840,7 @@ unwind_exec_insn(struct quadd_mmap_area *mmap,
                         ctrl->vrs[SP]);
        } else if (insn == 0xb3 || insn == 0xc8 || insn == 0xc9) {
                unsigned long data, reg_from, reg_to;
-               u32 *vsp = (u32 *)(unsigned long)ctrl->vrs[SP];
+               u32 __user *vsp = (u32 __user *)(unsigned long)ctrl->vrs[SP];
 
                data = unwind_get_byte(mmap, ctrl, &err);
                if (err < 0)
@@ -869,7 +869,7 @@ unwind_exec_insn(struct quadd_mmap_area *mmap,
        } else if ((insn & 0xf8) == 0xb8 || (insn & 0xf8) == 0xd0) {
                unsigned long reg_to;
                unsigned long data = insn & 0x07;
-               u32 *vsp = (u32 *)(unsigned long)ctrl->vrs[SP];
+               u32 __user *vsp = (u32 __user *)(unsigned long)ctrl->vrs[SP];
 
                reg_to = 8 + data;
 
index 3361c61..9fd9c97 100644 (file)
@@ -42,7 +42,7 @@ struct quadd_cpu_context {
 struct timecounter;
 
 struct quadd_hrt_ctx {
-       struct quadd_cpu_context * __percpu cpu_ctx;
+       struct quadd_cpu_context __percpu *cpu_ctx;
 
        u64 sample_period;
        unsigned long low_addr;
index c25835e..bb47f71 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * drivers/misc/tegra-profiler/quadd.h
  *
- * Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2015, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -67,4 +67,7 @@ struct quadd_ctx {
 
 void quadd_get_state(struct quadd_module_state *state);
 
+int tegra_profiler_try_lock(void);
+void tegra_profiler_unlock(void);
+
 #endif /* __QUADD_H */
index 98728a3..c96c507 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef __QUADD_VERSION_H
 #define __QUADD_VERSION_H
 
-#define QUADD_MODULE_VERSION           "1.86"
+#define QUADD_MODULE_VERSION           "1.87"
 #define QUADD_MODULE_BRANCH            "Dev"
 
 #endif /* __QUADD_VERSION_H */