aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/hw_breakpoint.c
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2010-11-29 12:06:53 -0500
committerWill Deacon <will.deacon@arm.com>2010-12-06 06:55:57 -0500
commit4a55c18e2023096c8684fae5fa1cfa96a03172ff (patch)
treed97cd84ed4c91eae3876aabd919cc1ddcc7505de /arch/arm/kernel/hw_breakpoint.c
parentce9b1b09520789223f72a9fefd5f0e329f8d89d0 (diff)
ARM: hw_breakpoint: fix warnings generated by sparse
sparse doesn't like per-cpu accesses such as: static DEFINE_PER_CPU(struct perf_event *, foo[MAXLEN]); struct perf_event **bar = __get_cpu_var(foo); and shouts quite loudly about it: | warning: incorrect type in assignment (different modifiers) | expected struct perf_event **slots | got struct perf_event *[noderef] *<noident> This patch adds casts to these sorts of assignments in hw_breakpoint.c in order to silence the warnings. Reported-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm/kernel/hw_breakpoint.c')
-rw-r--r--arch/arm/kernel/hw_breakpoint.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index eef1b1e235a7..56ed9a62013b 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -337,7 +337,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
337 /* Breakpoint */ 337 /* Breakpoint */
338 ctrl_base = ARM_BASE_BCR; 338 ctrl_base = ARM_BASE_BCR;
339 val_base = ARM_BASE_BVR; 339 val_base = ARM_BASE_BVR;
340 slots = __get_cpu_var(bp_on_reg); 340 slots = (struct perf_event **)__get_cpu_var(bp_on_reg);
341 max_slots = core_num_brps; 341 max_slots = core_num_brps;
342 if (info->step_ctrl.enabled) { 342 if (info->step_ctrl.enabled) {
343 /* Override the breakpoint data with the step data. */ 343 /* Override the breakpoint data with the step data. */
@@ -357,7 +357,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
357 ctrl_base = ARM_BASE_WCR; 357 ctrl_base = ARM_BASE_WCR;
358 val_base = ARM_BASE_WVR; 358 val_base = ARM_BASE_WVR;
359 } 359 }
360 slots = __get_cpu_var(wp_on_reg); 360 slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
361 max_slots = core_num_wrps; 361 max_slots = core_num_wrps;
362 } 362 }
363 363
@@ -394,7 +394,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
394 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) { 394 if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {
395 /* Breakpoint */ 395 /* Breakpoint */
396 base = ARM_BASE_BCR; 396 base = ARM_BASE_BCR;
397 slots = __get_cpu_var(bp_on_reg); 397 slots = (struct perf_event **)__get_cpu_var(bp_on_reg);
398 max_slots = core_num_brps; 398 max_slots = core_num_brps;
399 } else { 399 } else {
400 /* Watchpoint */ 400 /* Watchpoint */
@@ -402,7 +402,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
402 base = ARM_BASE_BCR + core_num_brps; 402 base = ARM_BASE_BCR + core_num_brps;
403 else 403 else
404 base = ARM_BASE_WCR; 404 base = ARM_BASE_WCR;
405 slots = __get_cpu_var(wp_on_reg); 405 slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
406 max_slots = core_num_wrps; 406 max_slots = core_num_wrps;
407 } 407 }
408 408
@@ -662,9 +662,11 @@ static void disable_single_step(struct perf_event *bp)
662static void watchpoint_handler(unsigned long unknown, struct pt_regs *regs) 662static void watchpoint_handler(unsigned long unknown, struct pt_regs *regs)
663{ 663{
664 int i; 664 int i;
665 struct perf_event *wp, **slots = __get_cpu_var(wp_on_reg); 665 struct perf_event *wp, **slots;
666 struct arch_hw_breakpoint *info; 666 struct arch_hw_breakpoint *info;
667 667
668 slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
669
668 /* Without a disassembler, we can only handle 1 watchpoint. */ 670 /* Without a disassembler, we can only handle 1 watchpoint. */
669 BUG_ON(core_num_wrps > 1); 671 BUG_ON(core_num_wrps > 1);
670 672
@@ -703,9 +705,11 @@ static void watchpoint_handler(unsigned long unknown, struct pt_regs *regs)
703static void watchpoint_single_step_handler(unsigned long pc) 705static void watchpoint_single_step_handler(unsigned long pc)
704{ 706{
705 int i; 707 int i;
706 struct perf_event *wp, **slots = __get_cpu_var(wp_on_reg); 708 struct perf_event *wp, **slots;
707 struct arch_hw_breakpoint *info; 709 struct arch_hw_breakpoint *info;
708 710
711 slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
712
709 for (i = 0; i < core_num_reserved_brps; ++i) { 713 for (i = 0; i < core_num_reserved_brps; ++i) {
710 rcu_read_lock(); 714 rcu_read_lock();
711 715
@@ -734,10 +738,12 @@ static void breakpoint_handler(unsigned long unknown, struct pt_regs *regs)
734{ 738{
735 int i; 739 int i;
736 u32 ctrl_reg, val, addr; 740 u32 ctrl_reg, val, addr;
737 struct perf_event *bp, **slots = __get_cpu_var(bp_on_reg); 741 struct perf_event *bp, **slots;
738 struct arch_hw_breakpoint *info; 742 struct arch_hw_breakpoint *info;
739 struct arch_hw_breakpoint_ctrl ctrl; 743 struct arch_hw_breakpoint_ctrl ctrl;
740 744
745 slots = (struct perf_event **)__get_cpu_var(bp_on_reg);
746
741 /* The exception entry code places the amended lr in the PC. */ 747 /* The exception entry code places the amended lr in the PC. */
742 addr = regs->ARM_pc; 748 addr = regs->ARM_pc;
743 749