aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorFrans Pop <elendil@planet.nl>2009-06-22 05:08:36 -0400
committerJiri Kosina <jkosina@suse.cz>2009-09-21 09:14:52 -0400
commitb519c15d4aacb3706bfff86ba316f9ed81b5032a (patch)
tree71d061e5dab05645667dd93a32859c462abb6230 /Documentation
parentcf83011d8faec99de51d6ba8879c0c61cf31e836 (diff)
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>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/hwmon/hpfall.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c
index bbea1ccfd46a..d2f6711b468b 100644
--- a/Documentation/hwmon/hpfall.c
+++ b/Documentation/hwmon/hpfall.c
@@ -57,45 +57,43 @@ void ignore_me(void)
57{ 57{
58 protect(0); 58 protect(0);
59 set_led(0); 59 set_led(0);
60
61} 60}
62 61
63int main(int argc, char* argv[]) 62int main(int argc, char *argv[])
64{ 63{
65 int fd, ret; 64 int fd, ret;
66 65
67 fd = open("/dev/freefall", O_RDONLY); 66 fd = open("/dev/freefall", O_RDONLY);
68 if (fd < 0) { 67 if (fd < 0) {
69 perror("open"); 68 perror("open");
70 return EXIT_FAILURE; 69 return EXIT_FAILURE;
71 } 70 }
72 71
73 signal(SIGALRM, ignore_me); 72 signal(SIGALRM, ignore_me);
74 73
75 for (;;) { 74 for (;;) {
76 unsigned char count; 75 unsigned char count;
77 76
78 ret = read(fd, &count, sizeof(count)); 77 ret = read(fd, &count, sizeof(count));
79 alarm(0); 78 alarm(0);
80 if ((ret == -1) && (errno == EINTR)) { 79 if ((ret == -1) && (errno == EINTR)) {
81 /* Alarm expired, time to unpark the heads */ 80 /* Alarm expired, time to unpark the heads */
82 continue; 81 continue;
83 } 82 }
84 83
85 if (ret != sizeof(count)) { 84 if (ret != sizeof(count)) {
86 perror("read"); 85 perror("read");
87 break; 86 break;
88 } 87 }
89 88
90 protect(21); 89 protect(21);
91 set_led(1); 90 set_led(1);
92 if (1 || on_ac() || lid_open()) { 91 if (1 || on_ac() || lid_open())
93 alarm(2); 92 alarm(2);
94 } else { 93 else
95 alarm(20); 94 alarm(20);
96 } 95 }
97 }
98 96
99 close(fd); 97 close(fd);
100 return EXIT_SUCCESS; 98 return EXIT_SUCCESS;
101} 99}