public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Piel <eric.piel@tremplin-utc.net>
To: Pavel Machek <pavel@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, burman.yan@gmail.com,
	pau@eslack.org
Subject: Re: [PATCH] LIS3LV02Dx Accelerometer driver (take 4)
Date: Wed, 22 Oct 2008 13:34:15 +0200	[thread overview]
Message-ID: <48FF0FB7.5070706@tremplin-utc.net> (raw)
In-Reply-To: <20081022102713.GA7843@atrey.karlin.mff.cuni.cz>

Pavel Machek schreef:
Hello,


> Ok, I guess you have better eyeballs. Yes, the locking was totaly
> broken (and disabled by initing semaphore to 1 by default).
To which value the semaphore should have been initialised? I can see
DECLARE_MUTEX(name) declared as:
	struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)

(I'm still learning about the locking in the kernel. To me, it looks
like a maze, and I couldn't find one simple document detailing all the
mechanisms.)

> Sorry
> about that.
> 
> This strips some more code, turns semaphore into mutex, and should
> solve more problems.
> 
> I killed the "power down on timer" thingie. I guess we can reintroduce
> it when we get the basics right (and driver works just fine without
> that... I did not detect unusual slowness).
I inserted the timer thingie because I have a program on my laptop which
reads the position twice per second. Using the joystick interface uses
two much CPU (it's 20 Hz) and so it's using the sysfs interface.
However, turning on and off the device twice per second is rather costly
(especially due to the ACPI access). That's why I made it delayed... and
I'd like to keep it this way.

I'll send this evening a "delayed power down" based on workqueue. Within
the  work of a workqueue, it's not possible to use a mutex, right? Only
semaphores are allowed?

Eric

  reply	other threads:[~2008-10-22 11:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-18 19:05 [PATCH] LIS3LV02Dx Accelerometer driver (take 4) Eric Piel
2008-10-19 16:34 ` Jonathan Cameron
2008-10-19 23:07   ` Eric Piel
2008-10-20 13:32     ` Jonathan Cameron
2008-10-21  8:38 ` Pavel Machek
2008-10-21 18:42   ` Andrew Morton
2008-10-22 10:27     ` Pavel Machek
2008-10-22 11:34       ` Eric Piel [this message]
2008-10-22 11:58         ` Pavel Machek
2008-10-21 18:41 ` Andrew Morton
2008-10-21 18:53   ` Randy Dunlap
2008-10-21 20:48     ` Eric Piel
2008-10-21 22:13   ` Eric Piel
2008-10-21 22:21     ` Andrew Morton
2008-10-22 15:20 ` Pavel Machek
2008-10-22 18:51   ` Len Brown
2008-10-23  8:11     ` Eric Piel
2008-10-23  8:24       ` Pavel Machek

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=48FF0FB7.5070706@tremplin-utc.net \
    --to=eric.piel@tremplin-utc.net \
    --cc=akpm@linux-foundation.org \
    --cc=burman.yan@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pau@eslack.org \
    --cc=pavel@suse.cz \
    /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