input: ads7846.c sparse lock annotation
Subsystems (2)
PATCH 3/9 input: ads7846.c sparse lock annotation
From: Harvey Harrison <[email protected]>
---
drivers/input/touchscreen/ads7846.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/input/touchscreen/ads7846.c renamed from drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation +2 -0
@@ -769,6 +769,8 @@ static irqreturn_t ads7846_irq(int irq,/* Must be called with ts->lock held */ static void ads7846_disable (struct ads7846 *ts) +__releases(&ts->lock) +__acquires(&ts->lock) {if (ts->disabled)return ;
_
Dmitry Torokhov
maintainerQuoted 14 lines · On Tue, May 12, 2009 at 01:43:06PM -0700, [email protected] wrote:
From: Harvey Harrison <[email protected]>
Signed-off-by Harvey Harrison <[email protected]>Cc Dmitry Torokhov <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
drivers/input/touchscreen/ads7846.c | 2 ++ 1 file changed, 2 insertions(+)diff -puN
drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotationdrivers/input/touchscreen/ads7846.c
drivers/input/touchscreen/ads7846.c static irqreturn_t ads7846_irq(int irq, · line 774
Quoted 6 lines
drivers/input/touchscreen/ads7846.c renamed from drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation +2
-0@@ -769,6 +769,8 @@ static irqreturn_t ads7846_irq(int irq,/* Must be called with ts->lock held */ static void ads7846_disable (struct ads7846 *ts) +__releases(&ts->lock) +__acquires(&ts->lock) {
I still haven't gotten any explanation why this is needed and also I am still getting sparce warnings with this patch applied. Please drop.
Signature · 1 line
Dmitry
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · On Tue, May 12, 2009 at 01:43:06PM -0700, [email protected] wrote:
From: Harvey Harrison <[email protected]>
Signed-off-by Harvey Harrison <[email protected]>Cc Dmitry Torokhov <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
Quoted 9 lines
drivers/input/touchscreen/ads7846.c static irqreturn_t ads7846_irq(int irq, · line 774
Quoted 5 lines
/* Must be called with
ts->lockheld */
static voidads7846_disable(struct ads7846 *ts)drivers/input/touchscreen/ads7846.c renamed from drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation +2
-0+__releases(&ts->lock) +__acquires(&ts->lock) {I still haven't gotten any explanation why this is needed and also I am still getting sparce warnings with this patch applied. Please drop.
Sorry, I didn't realize I had a local patchset doing extra context checking of what lock is passed in to spin_lock/unlock...it helps to document when a function requires a lock held (see the comment)
The culprit in this function:
while (ts->pending) {
spin_unlock_irq(&ts->lock);
msleep(1);
spin_lock_irq(&ts->lock);
}Anyways, as current sparse will still warn please drop.
Harvey
Dmitry Torokhov
maintainerQuoted 19 lines · Harvey Harrison
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · On Tue, May 12, 2009 at 01:43:06PM -0700, [email protected] wrote:
From: Harvey Harrison <[email protected]>
Signed-off-by Harvey Harrison <[email protected]>Cc Dmitry Torokhov <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
Quoted 9 lines
drivers/input/touchscreen/ads7846.c static irqreturn_t ads7846_irq(int irq, · line 774
Quoted 5 lines
/* Must be called with
ts->lockheld */
static voidads7846_disable(struct ads7846 *ts)drivers/input/touchscreen/ads7846.c renamed from drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation +2
-0+__releases(&ts->lock) +__acquires(&ts->lock) {I still haven't gotten any explanation why this is needed and also I am still getting sparce warnings with this patch applied. Please drop.
Quoted 4 lines
Sorry, I didn't realize I had a local patchset doing extra context checking of what lock is passed in to spin_lock/unlock...it helps to document when a function requires a lock held (see the comment)
I understand the comment ;) The annotation syntax is confusing though... Maybe if instead of __releases and __acquires it said __needs_lock() and __leaves_locked() that would make more sense...
Quoted 11 lines
The culprit in this function:
while (ts->pending) { spin_unlock_irq(&ts->lock); msleep(1); spin_lock_irq(&ts->lock); }Anyways, as current sparse will still warn please drop.
Harvey
Signature · 1 line
Dmitry
Quoted 7 lines · Dmitry Torokhov
Quoted 7 lines
Quoted 7 lines
drivers/input/touchscreen/ads7846.c static irqreturn_t ads7846_irq(int irq, · line 774
Quoted 5 lines
/* Must be called with
ts->lockheld */
static voidads7846_disable(struct ads7846 *ts)drivers/input/touchscreen/ads7846.c renamed from drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation +2
-0+__releases(&ts->lock) +__acquires(&ts->lock) {I still haven't gotten any explanation why this is needed and also I am still getting sparce warnings with this patch applied. Please drop.
Quoted 6 lines
Quoted 3 lines
Sorry, I didn't realize I had a local patchset doing extra context checking of what lock is passed in to spin_lock/unlock...it helps to document when a function requires a lock held (see the comment)
I understand the comment ;) The annotation syntax is confusing though... Maybe if instead of
__releasesand__acquiresit said__needs_lock()and__leaves_locked()that would make more sense...
I fully agree. __acquires() and __releases() is used to annotate a completely different thing -- it should be used solely to avoid false positives about locking inbalances across functions (i.e. one function deliberately not unlocking lock that it has locked), shoudldn't it?
Signature · 2 lines
Jiri Kosina SUSE Labs