Skip to content

Commit 6efe4d1

Browse files
andy-shevrostedt
authored andcommitted
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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 8a566f9 commit 6efe4d1

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

include/linux/seq_buf.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*/
1414

1515
/**
16-
* seq_buf - seq buffer structure
16+
* struct seq_buf - seq buffer structure
1717
* @buffer: pointer to the buffer
1818
* @size: size of the buffer
1919
* @len: the amount of data inside the buffer
@@ -80,10 +80,10 @@ static inline unsigned int seq_buf_used(struct seq_buf *s)
8080
}
8181

8282
/**
83-
* seq_buf_str - get %NUL-terminated C string from seq_buf
83+
* seq_buf_str - get NUL-terminated C string from seq_buf
8484
* @s: the seq_buf handle
8585
*
86-
* This makes sure that the buffer in @s is nul terminated and
86+
* This makes sure that the buffer in @s is NUL-terminated and
8787
* safe to read as a string.
8888
*
8989
* 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)
9393
* After this function is called, s->buffer is safe to use
9494
* in string operations.
9595
*
96-
* Returns @s->buf after making sure it is terminated.
96+
* Returns: @s->buf after making sure it is terminated.
9797
*/
9898
static inline const char *seq_buf_str(struct seq_buf *s)
9999
{
@@ -113,7 +113,7 @@ static inline const char *seq_buf_str(struct seq_buf *s)
113113
* @s: the seq_buf handle
114114
* @bufp: the beginning of the buffer is stored here
115115
*
116-
* Return the number of bytes available in the buffer, or zero if
116+
* Returns: the number of bytes available in the buffer, or zero if
117117
* there's no space.
118118
*/
119119
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)
135135
* @num: the number of bytes to commit
136136
*
137137
* Commit @num bytes of data written to a buffer previously acquired
138-
* by seq_buf_get. To signal an error condition, or that the data
138+
* by seq_buf_get_buf(). To signal an error condition, or that the data
139139
* didn't fit in the available space, pass a negative @num value.
140140
*/
141141
static inline void seq_buf_commit(struct seq_buf *s, int num)

lib/seq_buf.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @s: the seq_buf descriptor
3333
* @len: The length to see if it can fit in the current buffer
3434
*
35-
* Returns true if there's enough unused space in the seq_buf buffer
35+
* Returns: true if there's enough unused space in the seq_buf buffer
3636
* to fit the amount of new data according to @len.
3737
*/
3838
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)
4545
* @m: the seq_file descriptor that is the destination
4646
* @s: the seq_buf descriptor that is the source.
4747
*
48-
* Returns zero on success, non zero otherwise
48+
* Returns: zero on success, non-zero otherwise.
4949
*/
5050
int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s)
5151
{
@@ -60,9 +60,9 @@ int seq_buf_print_seq(struct seq_file *m, struct seq_buf *s)
6060
* @fmt: printf format string
6161
* @args: va_list of arguments from a printf() type function
6262
*
63-
* Writes a vnprintf() format into the sequencce buffer.
63+
* Writes a vnprintf() format into the sequence buffer.
6464
*
65-
* Returns zero on success, -1 on overflow.
65+
* Returns: zero on success, -1 on overflow.
6666
*/
6767
int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args)
6868
{
@@ -88,7 +88,7 @@ int seq_buf_vprintf(struct seq_buf *s, const char *fmt, va_list args)
8888
*
8989
* Writes a printf() format into the sequence buffer.
9090
*
91-
* Returns zero on success, -1 on overflow.
91+
* Returns: zero on success, -1 on overflow.
9292
*/
9393
int seq_buf_printf(struct seq_buf *s, const char *fmt, ...)
9494
{
@@ -104,12 +104,12 @@ int seq_buf_printf(struct seq_buf *s, const char *fmt, ...)
104104
EXPORT_SYMBOL_GPL(seq_buf_printf);
105105

106106
/**
107-
* seq_buf_do_printk - printk seq_buf line by line
107+
* seq_buf_do_printk - printk() seq_buf line by line
108108
* @s: seq_buf descriptor
109109
* @lvl: printk level
110110
*
111111
* printk()-s a multi-line sequential buffer line by line. The function
112-
* makes sure that the buffer in @s is nul terminated and safe to read
112+
* makes sure that the buffer in @s is NUL-terminated and safe to read
113113
* as a string.
114114
*/
115115
void seq_buf_do_printk(struct seq_buf *s, const char *lvl)
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(seq_buf_do_printk);
149149
* This function will take the format and the binary array and finish
150150
* the conversion into the ASCII string within the buffer.
151151
*
152-
* Returns zero on success, -1 on overflow.
152+
* Returns: zero on success, -1 on overflow.
153153
*/
154154
int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary)
155155
{
@@ -177,7 +177,7 @@ int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary)
177177
*
178178
* Copy a simple string into the sequence buffer.
179179
*
180-
* Returns zero on success, -1 on overflow
180+
* Returns: zero on success, -1 on overflow.
181181
*/
182182
int seq_buf_puts(struct seq_buf *s, const char *str)
183183
{
@@ -206,7 +206,7 @@ EXPORT_SYMBOL_GPL(seq_buf_puts);
206206
*
207207
* Copy a single character into the sequence buffer.
208208
*
209-
* Returns zero on success, -1 on overflow
209+
* Returns: zero on success, -1 on overflow.
210210
*/
211211
int seq_buf_putc(struct seq_buf *s, unsigned char c)
212212
{
@@ -222,7 +222,7 @@ int seq_buf_putc(struct seq_buf *s, unsigned char c)
222222
EXPORT_SYMBOL_GPL(seq_buf_putc);
223223

224224
/**
225-
* seq_buf_putmem - write raw data into the sequenc buffer
225+
* seq_buf_putmem - write raw data into the sequence buffer
226226
* @s: seq_buf descriptor
227227
* @mem: The raw memory to copy into the buffer
228228
* @len: The length of the raw memory to copy (in bytes)
@@ -231,7 +231,7 @@ EXPORT_SYMBOL_GPL(seq_buf_putc);
231231
* buffer and a strcpy() would not work. Using this function allows
232232
* for such cases.
233233
*
234-
* Returns zero on success, -1 on overflow
234+
* Returns: zero on success, -1 on overflow.
235235
*/
236236
int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len)
237237
{
@@ -259,7 +259,7 @@ int seq_buf_putmem(struct seq_buf *s, const void *mem, unsigned int len)
259259
* raw memory into the buffer it writes its ASCII representation of it
260260
* in hex characters.
261261
*
262-
* Returns zero on success, -1 on overflow
262+
* Returns: zero on success, -1 on overflow.
263263
*/
264264
int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
265265
unsigned int len)
@@ -307,7 +307,7 @@ int seq_buf_putmem_hex(struct seq_buf *s, const void *mem,
307307
*
308308
* Write a path name into the sequence buffer.
309309
*
310-
* Returns the number of written bytes on success, -1 on overflow
310+
* Returns: the number of written bytes on success, -1 on overflow.
311311
*/
312312
int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc)
313313
{
@@ -342,6 +342,7 @@ int seq_buf_path(struct seq_buf *s, const struct path *path, const char *esc)
342342
* or until it reaches the end of the content in the buffer (@s->len),
343343
* whichever comes first.
344344
*
345+
* Returns:
345346
* On success, it returns a positive number of the number of bytes
346347
* it copied.
347348
*
@@ -392,11 +393,11 @@ int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, size_t start, int cnt)
392393
* linebuf size is maximal length for one line.
393394
* 32 * 3 - maximum bytes per line, each printed into 2 chars + 1 for
394395
* separating space
395-
* 2 - spaces separating hex dump and ascii representation
396-
* 32 - ascii representation
396+
* 2 - spaces separating hex dump and ASCII representation
397+
* 32 - ASCII representation
397398
* 1 - terminating '\0'
398399
*
399-
* Returns zero on success, -1 on overflow
400+
* Returns: zero on success, -1 on overflow.
400401
*/
401402
int seq_buf_hex_dump(struct seq_buf *s, const char *prefix_str, int prefix_type,
402403
int rowsize, int groupsize,

0 commit comments

Comments
 (0)