]> www.infradead.org Git - mtd-utils.git/commitdiff
mtd-utils: improve simple_strtoX usage commentary
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 8 Apr 2011 15:05:10 +0000 (18:05 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Sat, 9 Apr 2011 14:49:22 +0000 (17:49 +0300)
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
include/common.h

index 2e5c2a0f4be502d8416b94b9586d86e56b560011..c37660c50ad4bc81482a58694adf7bae64b21b6e 100644 (file)
@@ -93,6 +93,17 @@ static inline int is_power_of_2(unsigned long long n)
  * simple_strtoX - convert a hex/dec/oct string into a number
  * @snum: buffer to convert
  * @error: set to 1 when buffer isn't fully consumed
+ *
+ * These functions are similar to the standard strtoX() functions, but they are
+ * a little bit easier to use if you want to convert full string of digits into
+ * the binary form. The typical usage:
+ *
+ * int error = 0;
+ * unsigned long num;
+ *
+ * num = simple_strtoul(str, &error);
+ * if (error || ... if needed, your check that num is not out of range ...)
+ *     error_happened();
  */
 #define simple_strtoX(func, type) \
 static inline type simple_##func(const char *snum, int *error) \