From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 8/8] ARM: hw_breakpoint: fix warnings generated by sparse
Date: Mon, 29 Nov 2010 17:34:48 +0000 [thread overview]
Message-ID: <1291052088-17243-9-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1291052088-17243-1-git-send-email-will.deacon@arm.com>
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.
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
arch/arm/kernel/hw_breakpoint.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 4ee9a7d..97dc36a 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -335,7 +335,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
/* Breakpoint */
ctrl_base = ARM_BASE_BCR;
val_base = ARM_BASE_BVR;
- slots = __get_cpu_var(bp_on_reg);
+ slots = (struct perf_event **)__get_cpu_var(bp_on_reg);
max_slots = core_num_brps;
} else {
/* Watchpoint */
@@ -350,7 +350,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
ctrl_base = ARM_BASE_WCR;
val_base = ARM_BASE_WVR;
}
- slots = __get_cpu_var(wp_on_reg);
+ slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
max_slots = core_num_wrps;
}
@@ -387,7 +387,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
if (info->ctrl.type == ARM_BREAKPOINT_EXECUTE) {
/* Breakpoint */
base = ARM_BASE_BCR;
- slots = __get_cpu_var(bp_on_reg);
+ slots = (struct perf_event **)__get_cpu_var(bp_on_reg);
max_slots = core_num_brps;
} else {
/* Watchpoint */
@@ -395,7 +395,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
base = ARM_BASE_BCR + core_num_brps;
else
base = ARM_BASE_WCR;
- slots = __get_cpu_var(wp_on_reg);
+ slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
max_slots = core_num_wrps;
}
@@ -647,9 +647,11 @@ static void update_mismatch_flag(int idx, int flag)
static void watchpoint_handler(unsigned long unknown, struct pt_regs *regs)
{
int i;
- struct perf_event *wp, **slots = __get_cpu_var(wp_on_reg);
+ struct perf_event *wp, **slots;
struct arch_hw_breakpoint *info;
+ slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
+
/* Without a disassembler, we can only handle 1 watchpoint. */
BUG_ON(core_num_wrps > 1);
@@ -696,9 +698,11 @@ static void watchpoint_handler(unsigned long unknown, struct pt_regs *regs)
static void watchpoint_single_step_handler(unsigned long pc)
{
int i;
- struct perf_event *wp, **slots = __get_cpu_var(wp_on_reg);
+ struct perf_event *wp, **slots;
struct arch_hw_breakpoint *info;
+ slots = (struct perf_event **)__get_cpu_var(wp_on_reg);
+
for (i = 0; i < core_num_reserved_brps; ++i) {
rcu_read_lock();
@@ -731,10 +735,12 @@ static void breakpoint_handler(unsigned long unknown, struct pt_regs *regs)
int i;
int mismatch;
u32 ctrl_reg, val, addr;
- struct perf_event *bp, **slots = __get_cpu_var(bp_on_reg);
+ struct perf_event *bp, **slots;
struct arch_hw_breakpoint *info;
struct arch_hw_breakpoint_ctrl ctrl;
+ slots = (struct perf_event **)__get_cpu_var(bp_on_reg);
+
/* The exception entry code places the amended lr in the PC. */
addr = regs->ARM_pc;
--
1.7.0.4
prev parent reply other threads:[~2010-11-29 17:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 17:34 [PATCH 0/8] ARM: hw_breakpoint: fixes and improvements (v2) Will Deacon
2010-11-29 17:34 ` [PATCH 1/8] ARM: hw_breakpoint: ensure OS lock is clear before writing to debug registers Will Deacon
2010-11-29 17:34 ` [PATCH 2/8] ARM: hw_breakpoint: reset control registers in hotplug path Will Deacon
2010-11-29 17:34 ` [PATCH 3/8] ARM: hw_breakpoint: correct and simplify alignment fixup code Will Deacon
2010-11-29 17:34 ` [PATCH 4/8] ARM: hw_breakpoint: disable preemption during debug exception handling Will Deacon
2010-11-29 17:34 ` [PATCH 5/8] ARM: hw_breakpoint: don't advertise reserved breakpoints Will Deacon
2010-11-30 10:01 ` Jamie Iles
2010-11-30 10:12 ` Will Deacon
2010-11-30 11:02 ` Jamie Iles
2010-11-30 13:50 ` Will Deacon
2010-11-29 17:34 ` [PATCH 6/8] ARM: hw_breakpoint: do not allocate new breakpoints with rcu_read_lock held Will Deacon
2010-11-29 17:34 ` [PATCH 7/8] ARM: ptrace: fix style issue with hw_breakpoint interface Will Deacon
2010-11-29 17:34 ` Will Deacon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291052088-17243-9-git-send-email-will.deacon@arm.com \
--to=will.deacon@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.