Commit b519c15d authored by Frans Pop's avatar Frans Pop Committed by Jiri Kosina

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: default avatarFrans Pop <elendil@planet.nl>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent cf83011d
...@@ -57,45 +57,43 @@ void ignore_me(void) ...@@ -57,45 +57,43 @@ void ignore_me(void)
{ {
protect(0); protect(0);
set_led(0); set_led(0);
} }
int main(int argc, char* argv[]) int main(int argc, char *argv[])
{ {
int fd, ret; int fd, ret;
fd = open("/dev/freefall", O_RDONLY); fd = open("/dev/freefall", O_RDONLY);
if (fd < 0) { if (fd < 0) {
perror("open"); perror("open");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
signal(SIGALRM, ignore_me); signal(SIGALRM, ignore_me);
for (;;) { for (;;) {
unsigned char count; unsigned char count;
ret = read(fd, &count, sizeof(count)); ret = read(fd, &count, sizeof(count));
alarm(0); alarm(0);
if ((ret == -1) && (errno == EINTR)) { if ((ret == -1) && (errno == EINTR)) {
/* Alarm expired, time to unpark the heads */ /* Alarm expired, time to unpark the heads */
continue; continue;
} }
if (ret != sizeof(count)) { if (ret != sizeof(count)) {
perror("read"); perror("read");
break; break;
} }
protect(21); protect(21);
set_led(1); set_led(1);
if (1 || on_ac() || lid_open()) { if (1 || on_ac() || lid_open())
alarm(2); alarm(2);
} else { else
alarm(20); alarm(20);
} }
}
close(fd); close(fd);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment