Skip to contentSkip to conversation

trivial: cleanup hpfall example code (checkpatch)

PATCH Applied Frans Pop 3 participants 3 messages Jun 22, 2009 – Jun 23, 2009

Subsystems (2)
lore
Share & tools
lore

Frans Pop

author
#0 lore raw

PATCH 1/1 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

Cc Pavel Machek <[email protected]>
Documentation/hwmon/hpfall.c +31 -33
index bbea1cc..d2f6711 100644
@@ -57,45 +57,43 @@ void ignore_me(void)
 {
 	protect(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);
-       if (fd < 0) {
-               perror("open");
-               return EXIT_FAILURE;
-       }
+	fd = open("/dev/freefall", O_RDONLY);
+	if (fd < 0) {
+		perror("open");
+		return EXIT_FAILURE;
+	}
 
 	signal(SIGALRM, ignore_me);
 
-       for (;;) {
-	       unsigned char count;
-
-               ret = read(fd, &count, sizeof(count));
-	       alarm(0);
-	       if ((ret == -1) && (errno == EINTR)) {
-		       /* Alarm expired, time to unpark the heads */
-		       continue;
-	       }
-
-               if (ret != sizeof(count)) {
-                       perror("read");
-                       break;
-               }
-
-	       protect(21);
-	       set_led(1);
-	       if (1 || on_ac() || lid_open()) {
-		       alarm(2);
-	       } else {
-		       alarm(20);
-	       }
-       }
+	for (;;) {
+		unsigned char count;
+
+		ret = read(fd, &count, sizeof(count));
+		alarm(0);
+		if ((ret == -1) && (errno == EINTR)) {
+			/* Alarm expired, time to unpark the heads */
+			continue;
+		}
+
+		if (ret != sizeof(count)) {
+			perror("read");
+			break;
+		}
+
+		protect(21);
+		set_led(1);
+		if (1 || on_ac() || lid_open())
+			alarm(2);
+		else
+			alarm(20);
+	}
 
-       close(fd);
-       return EXIT_SUCCESS;
+	close(fd);
+	return EXIT_SUCCESS;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Frans Pop

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.

Quoted 6 lines

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

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Applied
#2 lore raw
Quoted 7 lines · Pavel Machek
Quoted 6 lines · Frans Pop

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.

Quoted 8 lines
Quoted 6 lines

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

Applied, thanks Frans.

Signature · 2 lines
Jiri Kosina
SUSE Labs