linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kernel-doc headers for assembly language functions
@ 2022-12-03  0:31 Elliott, Robert (Servers)
  2022-12-03 10:51 ` Jonathan Corbet
  0 siblings, 1 reply; 2+ messages in thread
From: Elliott, Robert (Servers) @ 2022-12-03  0:31 UTC (permalink / raw)
  To: corbet@lwn.net, linux-doc@vger.kernel.org

Is there a recommended way to document assembly language functions
with the kernel-doc format?

scripts/kernel-doc doesn't understand assembly language files and
using SYM_FUNC_START to identify a function entry point. Unlike
a C function header, that line just identifies the function name,
not any of the arguments.

Example: arch/x86/crypto/crc32c-pcl-intel-asm_64.S provides a
function for use by C code:

    # unsigned int crc_pcl(u8 *buffer, int len, unsigned int crc_init);

    .text
    SYM_FUNC_START(crc_pcl)

Most of them have the recommended C prototype as a comment
somewhere nearby.

arch/x86/crypto/crc32c-intel_glue.c has a prototype for it (not in
a .h file):
    asmlinkage unsigned int crc_pcl(const u8 *buffer, int len,
                                    unsigned int crc_init);
    ...
        *crcp = crc_pcl(data, len, *crcp);

Perhaps scripts/kernel-doc could detect a special "Prototype" line
or look for a comment starting with "asmlinkage", something like:

/**
 * crc_pcl - Calculate crc32c using x86 CRC32 and PCLMULQDQ instructions
 * @buffer:   %rdi address of data
 * @len:      %rsi number of bytes of data
 * @crc_init: %rdx initial crc32c value
 * Return:    %eax crc32c checksum
 * Prototype: asmlinkage unsigned int crc_pcl(const u8 *buffer, int len, unsigned int crc_init);
 */
SYM_FUNC_START(crc_pcl)



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: kernel-doc headers for assembly language functions
  2022-12-03  0:31 kernel-doc headers for assembly language functions Elliott, Robert (Servers)
@ 2022-12-03 10:51 ` Jonathan Corbet
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2022-12-03 10:51 UTC (permalink / raw)
  To: Elliott, Robert (Servers), linux-doc@vger.kernel.org

"Elliott, Robert (Servers)" <elliott@hpe.com> writes:

> Is there a recommended way to document assembly language functions
> with the kernel-doc format?
>
> scripts/kernel-doc doesn't understand assembly language files and
> using SYM_FUNC_START to identify a function entry point. Unlike
> a C function header, that line just identifies the function name,
> not any of the arguments.

As you note, it doesn't work currently.  The most common way of dealing
with this, I think, is to put the kerneldoc comments with the declaration
of the function that is (usually) found in a C header file somewhere.

Thanks,

jon

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-03 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-03  0:31 kernel-doc headers for assembly language functions Elliott, Robert (Servers)
2022-12-03 10:51 ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).