Commit Graph

4 Commits

Author SHA1 Message Date
Frans Pop be3990b7ef trivial: doc: hpfall: accept disk device to unload as argument
Allows users who use an IDE driver for their disk to use hpfall without
having to modify the source. By default /dev/sda is used.
Suggested by Christian Thaeter in http://lkml.org/lkml/2009/3/25/505.

While we're add it, improve error message if opening /dev/freefall fails.

Signed-off-by: Frans Pop <elendil@planet.nl>
Cc: Christian Thaeter <ct@pipapo.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-21 15:14:57 +02:00
Christian Thaeter 2bace8b951 trivial: doc: hpfall: reduce risk that hpfall can do harm
Improve the example code to be at least useable, as in not causing
harm (as shown below). Code can still be improved further, but this
adds some basic safeguards.

1. hpfall *MUST* mlockall(MCL_CURRENT|MCL_FUTURE); itself!
Since the Program sits and waits most of the time it becomes very likely
swapped out. If it gets woken up when the laptop drops from the table
while it is swapped out it actually triggers harddrive activity!

2. Daemonize hpfall using 'daemon(0,0)' (quick and dirty).

3. Give hpfall realtime priority.
Should give a chance that it has less latency when woken up.

Signed-off-by: Christian Thaeter <ct@pipapo.org>
Signed-off-by: Frans Pop <elendil@planet.nl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-21 15:14:57 +02:00
Frans Pop b519c15d4a trivial: cleanup hpfall example code (checkpatch)
This patch makes hpfall.c conform to kernel coding style.

I have not fixed the C99 // comments on two lines as they
help indicate that those are not actually comments but
incomplete code.

Before:
 total: 10 errors, 6 warnings, 101 lines checked
After:
 total: 2 errors, 0 warnings, 99 lines checked

Signed-off-by: Frans Pop <elendil@planet.nl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-09-21 15:14:52 +02:00
Pavel Machek ef2cfc790b hp accelerometer: add freefall detection
This adds freefall handling to hp_accel driver.  According to HP, it
should just work, without us having to set the chip up by hand.

hpfall.c is example .c program that parks the disk when accelerometer
detects free fall.  It should work; for now, it uses fixed 20seconds
protection period.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Cc: Thomas Renninger <trenn@suse.de>
Cc: Éric Piel <eric.piel@tremplin-utc.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-02-18 15:37:54 -08:00