Re: [PATCH] module: Clarify documentation of module_param_call()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 5, 2023 at 9:13 PM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
> Commit 9bbb9e5a3310 ("param: use ops in struct kernel_param, rather than
> get and set fns directly") added the comment that module_param_call()
> was deprecated, during a large scale refactoring to bring sanity to type
> casting back then. In 2017 following more cleanups, it became useful
> against as it wraps a common pattern of creating an ops struct for a

s/against/again/

> Many users of module_param_cb() appear to be almost universally
> open-coding the same thing that module_param_call() does now. Don't
> discourage[1] people from using module_param_call() but clarifying the
> comment: module_param_cb() is useful if you repeatedly use the same pair
> of get/set functions.

s/clarifying/clarify/

I sampled some, and indeed many define the ops struct.

> [1] https://lore.kernel.org/lkml/202308301546.5C789E5EC@keescook/

Link: tag here? It is actually quite nicely explained there.

> -/* Obsolete - use module_param_cb() */
> +/* For repeated _set & _get usage use module_param_cb() */

Perhaps add "instead"? Or perhaps add a bit more detail, something like:

    Useful for describing a set/get pair used only once (i.e. for this
parameter). For repeated set/get pairs (i.e. the same kernel_param_ops
struct), use module_param_cb() instead.

Reviewed-by: Miguel Ojeda <ojeda@xxxxxxxxxx>

Cheers,
Miguel




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux