Skip to content

Commit 63f3cd5

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
tty: tty_driver: document both {,__}tty_alloc_driver() properly
__tty_alloc_driver()'s kernel-doc needed some care: describe the return value using the standard "Returns:", and use the new enum tty_driver_flag for @flags. Then, the tty_alloc_driver() macro was undocumented, but referenced many times in the docs. Copy the docs from the above (except the @owner parameter, obviously). Signed-off-by: Jiri Slaby (SUSE) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 109e06a commit 63f3cd5

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Documentation/driver-api/tty/tty_driver.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ freed.
2525
For reference, both allocation and deallocation functions are explained here in
2626
detail:
2727

28+
.. kernel-doc:: include/linux/tty_driver.h
29+
:identifiers: tty_alloc_driver
2830
.. kernel-doc:: drivers/tty/tty_io.c
2931
:identifiers: __tty_alloc_driver tty_driver_kref_put
3032

drivers/tty/tty_io.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3329,10 +3329,12 @@ EXPORT_SYMBOL(tty_unregister_device);
33293329
* __tty_alloc_driver - allocate tty driver
33303330
* @lines: count of lines this driver can handle at most
33313331
* @owner: module which is responsible for this driver
3332-
* @flags: some of %TTY_DRIVER_ flags, will be set in driver->flags
3332+
* @flags: some of enum tty_driver_flag, will be set in driver->flags
33333333
*
3334-
* This should not be called directly, some of the provided macros should be
3335-
* used instead. Use IS_ERR() and friends on @retval.
3334+
* This should not be called directly, tty_alloc_driver() should be used
3335+
* instead.
3336+
*
3337+
* Returns: struct tty_driver or a PTR-encoded error (use IS_ERR() and friends).
33363338
*/
33373339
struct tty_driver *__tty_alloc_driver(unsigned int lines, struct module *owner,
33383340
unsigned long flags)

include/linux/tty_driver.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,13 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line);
564564

565565
void tty_driver_kref_put(struct tty_driver *driver);
566566

567-
/* Use TTY_DRIVER_* flags below */
567+
/**
568+
* tty_alloc_driver - allocate tty driver
569+
* @lines: count of lines this driver can handle at most
570+
* @flags: some of enum tty_driver_flag, will be set in driver->flags
571+
*
572+
* Returns: struct tty_driver or a PTR-encoded error (use IS_ERR() and friends).
573+
*/
568574
#define tty_alloc_driver(lines, flags) \
569575
__tty_alloc_driver(lines, THIS_MODULE, flags)
570576

0 commit comments

Comments
 (0)