Commit 6efe4d18 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Steven Rostedt (Google)

seq_buf: Fix kernel documentation

There are plenty of issues with the kernel documentation here:
  - misspelled word "sequence"
  - different style of returned value descriptions
  - missed Return sections
  - unaligned style of ASCII / NUL-terminated / etc
  - wrong function references

Fix all these.

Link: https://lkml.kernel.org/r/20240215152506.598340-1-andriy.shevchenko@linux.intel.com

Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 8a566f94
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
*/ */
/** /**
* seq_buf - seq buffer structure * struct seq_buf - seq buffer structure
* @buffer: pointer to the buffer * @buffer: pointer to the buffer
* @size: size of the buffer * @size: size of the buffer
* @len: the amount of data inside the buffer * @len: the amount of data inside the buffer
...@@ -80,10 +80,10 @@ static inline unsigned int seq_buf_used(struct seq_buf *s) ...@@ -80,10 +80,10 @@ static inline unsigned int seq_buf_used(struct seq_buf *s)
} }
/** /**
* seq_buf_str - get %NUL-terminated C string from seq_buf * seq_buf_str - get NUL-terminated C string from seq_buf
* @s: the seq_buf handle * @s: the seq_buf handle
* *
* This makes sure that the buffer in @s is nul terminated and * This makes sure that the buffer in @s is NUL-terminated and
* safe to read as a string. * safe to read as a string.
* *
* Note, if this is called when the buffer has overflowed, then * Note, if this is called when the buffer has overflowed, then
...@@ -93,7 +93,7 @@ static inline unsigned int seq_buf_used(struct seq_buf *s) ...@@ -93,7 +93,7 @@ static inline unsigned int seq_buf_used(struct seq_buf *s)
* After this function is called, s->buffer is safe to use * After this function is called, s->buffer is safe to use
* in string operations. * in string operations.
* *
* Returns @s->buf after making sure it is terminated. * Returns: @s->buf after making sure it is terminated.
*/ */
static inline const char *seq_buf_str(struct seq_buf *s) static inline const char *seq_buf_str(struct seq_buf *s)
{ {
...@@ -113,7 +113,7 @@ static inline const char *seq_buf_str(struct seq_buf *s) ...@@ -113,7 +113,7 @@ static inline const char *seq_buf_str(struct seq_buf *s)
* @s: the seq_buf handle * @s: the seq_buf handle
* @bufp: the beginning of the buffer is stored here * @bufp: the beginning of the buffer is stored here
* *
* Return the number of bytes available in the buffer, or zero if * Returns: the number of bytes available in the buffer, or zero if
* there's no space. * there's no space.
*/ */
static inline size_t seq_buf_get_buf(struct seq_buf *s, char **bufp) static inline size_t seq_buf_get_buf(struct seq_buf *s, char **bufp)
...@@ -135,7 +135,7 @@ static inline size_t seq_buf_get_buf(struct seq_buf *s, char **bufp) ...@@ -135,7 +135,7 @@ static inline size_t seq_buf_get_buf(struct seq_buf *s, char **bufp)
* @num: the number of bytes to commit * @num: the number of bytes to commit
* *
* Commit @num bytes of data written to a buffer previously acquired * Commit @num bytes of data written to a buffer previously acquired
* by seq_buf_get. To signal an error condition, or that the data * by seq_buf_get_buf(). To signal an error condition, or that the data
* didn't fit in the available space, pass a negative @num value. * didn't fit in the available space, pass a negative @num value.
*/ */
static inline void seq_buf_commit(struct seq_buf *s, int num) static inline void seq_buf_commit(struct seq_buf *s, int num)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* @s: the seq_buf descriptor * @s: the seq_buf descriptor
* @len: The length to see if it can fit in the current buffer * @len: The length to see if it can fit in the current buffer
* *
* Returns true if there's enough unused space in the seq_buf buffer * Returns: true if there's enough unused space in the seq_buf buffer
* to fit the amount of new data according to @len. * to fit the amount of new data according to @len.
*/ */
static bool seq_buf_can_fit(struct seq_buf *s, size_t len) static bool seq_buf_can_fit(struct seq_buf *s, size_t len)
...@@ -45,7 +45,7 @@ static bool seq_buf_can_fit(struct seq_buf *s, size_t len) ...@@ -45,7 +45,7 @@ static bool seq_buf_can_fit(struct seq_buf *s, size_t len)
* @m: the seq_file descriptor that is the destination * @m: the seq_file descriptor that is the destination
* @s: the seq_buf descriptor that is the source. * @s: the seq_buf descriptor that is the source.
* *
* Returns zero on success, non zero otherwise * Returns: zero on success, non-zero otherwise.
*/ */
int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s) int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s)
{ {
...@@ -60,9 +60,9 @@ int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s) ...@@ -60,9 +60,9 @@ int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s)
* @fmt: printf format string * @fmt: printf format string
* @args: va_list of arguments from a printf() type function * @args: va_list of arguments from a printf() type function
* *
* Writes a vnprintf() format into the sequencce buffer. * Writes a vnprintf() format into the sequence buffer.
* *
* Returns zero on success, -1 on overflow. * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args) int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args)
{ {
...@@ -88,7 +88,7 @@ int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args) ...@@ -88,7 +88,7 @@ int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args)
* *
* Writes a printf() format into the sequence buffer. * Writes a printf() format into the sequence buffer.
* *
* Returns zero on success, -1 on overflow. * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_printf(struct seq_buf *s, const char *fmt, ...) int seq_buf_printf(struct seq_buf *s, const char *fmt, ...)
{ {
...@@ -104,12 +104,12 @@ int seq_buf_printf(struct seq_buf *s, const char *fmt, ...) ...@@ -104,12 +104,12 @@ int seq_buf_printf(struct seq_buf *s, const char *fmt, ...)
EXPORT_SYMBOL_GPL(seq_buf_printf); EXPORT_SYMBOL_GPL(seq_buf_printf);
/** /**
* seq_buf_do_printk - printk seq_buf line by line * seq_buf_do_printk - printk() seq_buf line by line
* @s: seq_buf descriptor * @s: seq_buf descriptor
* @lvl: printk level * @lvl: printk level
* *
* printk()-s a multi-line sequential buffer line by line. The function * printk()-s a multi-line sequential buffer line by line. The function
* makes sure that the buffer in @s is nul terminated and safe to read * makes sure that the buffer in @s is NUL-terminated and safe to read
* as a string. * as a string.
*/ */
void seq_buf_do_printk(struct seq_buf *s, const char *lvl) void seq_buf_do_printk(struct seq_buf *s, const char *lvl)
...@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(seq_buf_do_printk); ...@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(seq_buf_do_printk);
* This function will take the format and the binary array and finish * This function will take the format and the binary array and finish
* the conversion into the ASCII string within the buffer. * the conversion into the ASCII string within the buffer.
* *
* Returns zero on success, -1 on overflow. * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary) int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary)
{ {
...@@ -177,7 +177,7 @@ int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary) ...@@ -177,7 +177,7 @@ int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary)
* *
* Copy a simple string into the sequence buffer. * Copy a simple string into the sequence buffer.
* *
* Returns zero on success, -1 on overflow * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_puts(struct seq_buf *s, const char *str) int seq_buf_puts(struct seq_buf *s, const char *str)
{ {
...@@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(seq_buf_puts); ...@@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(seq_buf_puts);
* *
* Copy a single character into the sequence buffer. * Copy a single character into the sequence buffer.
* *
* Returns zero on success, -1 on overflow * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_putc(struct seq_buf *s, unsigned char c) int seq_buf_putc(struct seq_buf *s, unsigned char c)
{ {
...@@ -222,7 +222,7 @@ int seq_buf_putc(struct seq_buf *s, unsigned char c) ...@@ -222,7 +222,7 @@ int seq_buf_putc(struct seq_buf *s, unsigned char c)
EXPORT_SYMBOL_GPL(seq_buf_putc); EXPORT_SYMBOL_GPL(seq_buf_putc);
/** /**
* seq_buf_putmem - write raw data into the sequenc buffer * seq_buf_putmem - write raw data into the sequence buffer
* @s: seq_buf descriptor * @s: seq_buf descriptor
* @mem: The raw memory to copy into the buffer * @mem: The raw memory to copy into the buffer
* @len: The length of the raw memory to copy (in bytes) * @len: The length of the raw memory to copy (in bytes)
...@@ -231,7 +231,7 @@ EXPORT_SYMBOL_GPL(seq_buf_putc); ...@@ -231,7 +231,7 @@ EXPORT_SYMBOL_GPL(seq_buf_putc);
* buffer and a strcpy() would not work. Using this function allows * buffer and a strcpy() would not work. Using this function allows
* for such cases. * for such cases.
* *
* Returns zero on success, -1 on overflow * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len) int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len)
{ {
...@@ -259,7 +259,7 @@ int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len) ...@@ -259,7 +259,7 @@ int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len)
* raw memory into the buffer it writes its ASCII representation of it * raw memory into the buffer it writes its ASCII representation of it
* in hex characters. * in hex characters.
* *
* Returns zero on success, -1 on overflow * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
unsigned int len) unsigned int len)
...@@ -307,7 +307,7 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem, ...@@ -307,7 +307,7 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
* *
* Write a path name into the sequence buffer. * Write a path name into the sequence buffer.
* *
* Returns the number of written bytes on success, -1 on overflow * Returns: the number of written bytes on success, -1 on overflow.
*/ */
int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc) int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc)
{ {
...@@ -342,6 +342,7 @@ int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc) ...@@ -342,6 +342,7 @@ int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc)
* or until it reaches the end of the content in the buffer (@s->len), * or until it reaches the end of the content in the buffer (@s->len),
* whichever comes first. * whichever comes first.
* *
* Returns:
* On success, it returns a positive number of the number of bytes * On success, it returns a positive number of the number of bytes
* it copied. * it copied.
* *
...@@ -392,11 +393,11 @@ int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, size_t start, int cnt) ...@@ -392,11 +393,11 @@ int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, size_t start, int cnt)
* linebuf size is maximal length for one line. * linebuf size is maximal length for one line.
* 32 * 3 - maximum bytes per line, each printed into 2 chars + 1 for * 32 * 3 - maximum bytes per line, each printed into 2 chars + 1 for
* separating space * separating space
* 2 - spaces separating hex dump and ascii representation * 2 - spaces separating hex dump and ASCII representation
* 32 - ascii representation * 32 - ASCII representation
* 1 - terminating '\0' * 1 - terminating '\0'
* *
* Returns zero on success, -1 on overflow * Returns: zero on success, -1 on overflow.
*/ */
int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str, int prefix_type, int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str, int prefix_type,
int rowsize, int groupsize, int rowsize, int groupsize,
......
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