mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@suse.de>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthias Kaehlcke <matthias.kaehlcke@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [patch 1/2] hdaps: fix locking
Date: Sun, 14 Oct 2007 09:25:23 +0200	[thread overview]
Message-ID: <20071014072523.GB2766@wotan.suse.de> (raw)

Here are a couple of fixes for the hdaps driver. I have kind of been
blocking out the bug traces caused by these (the 2nd patch, actually)
thinking that it's one of those transient / churn things... but it's
getting annoying now because I think it turns off lockdep. After this
patch it no longer produces warnings, but I don't actually know if it
does the right thing (because I don't really know what the driver
does or how to test it anyway!).

---

hdaps was using incorrect mutex_trylock return code.

Signed-off-by: Nick Piggin <npiggin@suse.de>

---
Index: linux-2.6/drivers/hwmon/hdaps.c
===================================================================
--- linux-2.6.orig/drivers/hwmon/hdaps.c
+++ linux-2.6/drivers/hwmon/hdaps.c
@@ -328,22 +328,20 @@ static void hdaps_mousedev_poll(unsigned
 	int x, y;
 
 	/* Cannot sleep.  Try nonblockingly.  If we fail, try again later. */
-	if (mutex_trylock(&hdaps_mtx)) {
-		mod_timer(&hdaps_timer,jiffies + HDAPS_POLL_PERIOD);
-		return;
-	}
+	if (!mutex_trylock(&hdaps_mtx))
+		goto out;
 
 	if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y))
-		goto out;
+		goto out_lock;
 
 	input_report_abs(hdaps_idev, ABS_X, x - rest_x);
 	input_report_abs(hdaps_idev, ABS_Y, y - rest_y);
 	input_sync(hdaps_idev);
 
-	mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD);
-
-out:
+out_lock:
 	mutex_unlock(&hdaps_mtx);
+out:
+	mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD);
 }
 
 

             reply	other threads:[~2007-10-14  7:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-14  7:25 Nick Piggin [this message]
2007-10-14  7:28 ` Nick Piggin

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=20071014072523.GB2766@wotan.suse.de \
    --to=npiggin@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.kaehlcke@gmail.com \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®