Skip to contentSkip to conversation

selftests: timers: Fix grammar and clarify comments in nanosleep.c

PATCH In review Rahul Kumar 2 participants 2 messages May 14, 2025 – May 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: timers: Fix grammar and clarify comments in nanosleep.c

Improved the clarity and grammar in the header comment of nanosleep.c for better readability and consistency with kernel documentation style.

---
 tools/testing/selftests/timers/nanosleep.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
tools/testing/selftests/timers/nanosleep.c +11 -11
index 252c6308c569..84adf8a4ab5d 100644
@@ -1,12 +1,12 @@
-/* Make sure timers don't return early
- *              by: john stultz ([email protected])
- *		    John Stultz ([email protected])
- *              (C) Copyright IBM 2012
- *              (C) Copyright Linaro 2013 2015
- *              Licensed under the GPLv2
+ /*
+ * Ensure timers do not return early.
+ * Author: John Stultz ([email protected])
+ * Copyright (C) IBM 2012
+ * Copyright (C) Linaro 2013, 2015
+ * Licensed under the GPLv2
  *
- *  To build:
- *	$ gcc nanosleep.c -o nanosleep -lrt
+ * To build:
+ *     $ gcc nanosleep.c -o nanosleep -lrt
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ char *clockstring(int clockid)
 	case CLOCK_TAI:
 		return "CLOCK_TAI";
 	};
-	return "UNKNOWN_CLOCKID";
+	return "UNKNOWN_CLOCKID"; // Could not identify clockid
 }
 
 /* returns 1 if a <= b, 0 otherwise */
@@ -90,7 +90,7 @@ int nanosleep_test(int clockid, long long ns)
 {
 	struct timespec now, target, rel;
 
-	/* First check abs time */
+	/* First, check absolute time using clock_nanosleep with TIMER_ABSTIME */
 	if (clock_gettime(clockid, &now))
 		return UNSUPPORTED;
 	target = timespec_add(now, ns);
@@ -102,7 +102,7 @@ int nanosleep_test(int clockid, long long ns)
 	if (!in_order(target, now))
 		return -1;
 
-	/* Second check reltime */
+	/* Then, test relative time sleep */
 	clock_gettime(clockid, &now);
 	rel.tv_sec = 0;
 	rel.tv_nsec = 0;
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 2 lines · Rahul Kumar

Improved the clarity and grammar in the header comment of nanosleep.c for better readability and consistency with kernel documentation style.

This patch isn't really fixing anything. I won't be taking this one. Sorry.

thanks,
-- Shuah