Em Mon, 23 Nov 2020 19:45:42 -0400
Jason Gunthorpe <[email protected]> escreveu:

> On Mon, Nov 16, 2020 at 11:18:03AM +0100, Mauro Carvalho Chehab wrote:
> 
> > +/**
> > + * ib_alloc_pd - Allocates an unused protection domain.
> > + * @device: The device on which to allocate the protection domain.
> > + * @flags: protection domain flags
> > + *
> > + * A protection domain object provides an association between QPs, shared
> > + * receive queues, address handles, memory regions, and memory windows.
> > + *
> > + * Every PD has a local_dma_lkey which can be used as the lkey value for 
> > local
> > + * memory operations.
> > + */
> >  #define ib_alloc_pd(device, flags) \
> >     __ib_alloc_pd((device), (flags), KBUILD_MODNAME)  
> 
> Why this hunk adding a completely new description in this patch?

In order to document ib_alloc_pd().

See, currently, verbs.c has this kernel-doc markup:

        /**
         * ib_alloc_pd - Allocates an unused protection domain.
         * @device: The device on which to allocate the protection domain.
         * @flags: protection domain flags
         * @caller: caller's build-time module name
         *
         * A protection domain object provides an association between QPs, 
shared
         * receive queues, address handles, memory regions, and memory windows.
         *
         * Every PD has a local_dma_lkey which can be used as the lkey value 
for local
         * memory operations.
         */
        struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int 
flags,
                        const char *caller)

Which doesn't actually work as expected, as kernel-doc will, instead,
document __ib_alloc_pd():

        $ ./scripts/kernel-doc -sphinx-version 3.1 -function ib_alloc_pd 
drivers/infiniband/core/verbs.c 
        drivers/infiniband/core/verbs.c:1: warning: 'ib_alloc_pd' not found

        $ ./scripts/kernel-doc -sphinx-version 3.1 -function __ib_alloc_pd 
drivers/infiniband/core/verbs.c 
        .. c:function:: struct ib_pd * __ib_alloc_pd (struct ib_device *device, 
unsigned int flags, const char *caller)

           Allocates an unused protection domain.

        **Parameters**

        ``struct ib_device *device``
          The device on which to allocate the protection domain.

        ``unsigned int flags``
          protection domain flags
        
        ``const char *caller``
          caller's build-time module name

        **Description**

        A protection domain object provides an association between QPs, shared
        receive queues, address handles, memory regions, and memory windows.

        Every PD has a local_dma_lkey which can be used as the lkey value for 
local
        memory operations.

So, what this patch does is to fix the kernel-doc markup at verbs.c for
it to reflect the function that it is documented, adding a new markup for
ib_alloc_pd(), which is identical to __ib_alloc_pd(), except for the
@caller field, which is set to KBUILD_MODNAME by this macro.

Thanks,
Mauro

Reply via email to