lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190415131002.GC775@localhost>
Date:   Mon, 15 Apr 2019 15:10:02 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Madhumitha Prabakaran <madhumithabiw@...il.com>
Cc:     johan@...nel.org, elder@...nel.org, gregkh@...uxfoundation.org,
        greybus-dev@...ts.linaro.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Staging: greybus: Cleanup in header file control.h

On Fri, Apr 05, 2019 at 03:14:37PM -0500, Madhumitha Prabakaran wrote:
> Fix a blank line after function/struct/union/enum
> declarations. Also, convert to_gb_control()  macro into an inline
> function in order to maintain Linux kernel coding style based
> on which the inline function is preferable over the macro.

There are about 1200 macros wrapping container_of() in the kernel, so
this is a common pattern which does not need to be changed (by contrast,
only a handful container_of are wrapped by functions).

> Signed-off-by: Madhumitha Prabakaran <madhumithabiw@...il.com>
> ---
>  drivers/staging/greybus/control.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/control.h b/drivers/staging/greybus/control.h
> index 3a29ec05f631..a681ef74e7fe 100644
> --- a/drivers/staging/greybus/control.h
> +++ b/drivers/staging/greybus/control.h
> @@ -24,7 +24,11 @@ struct gb_control {
>  	char *vendor_string;
>  	char *product_string;
>  };
> -#define to_gb_control(d) container_of(d, struct gb_control, dev)
> +

No need for a blank line either as the macro is closely related to the
preceding struct declaration.

> +static inline struct gb_control *to_gb_control(struct device *d)
> +{
> +	return container_of(d, struct gb_control, dev);
> +}

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ