[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZBh/s5lyONaF37gs@kroah.com>
Date: Mon, 20 Mar 2023 16:45:55 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Sumitra Sharma <sumitraartsy@...il.com>
Cc: Marc Dietrich <marvin24@....de>, ac100@...ts.launchpad.net,
linux-tegra@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org, outreachy@...ts.linux.dev
Subject: Re: [PATCH v2] Staging: nvec: Convert to_nvec_led from a macro to an
inline function
On Sat, Mar 18, 2023 at 10:52:50AM -0700, Sumitra Sharma wrote:
> Convert to_nvec_led from a macro to a static inline function, to make the
> relevant types apparent in the definition and to benefit from the type
> checking performed by the compiler at call sites.
>
> Signed-off-by: Sumitra Sharma <sumitraartsy@...il.com>
> ---
>
> v2: Change patch subject and description, noted by
> Julia Lawall <julia.lawall@...ia.fr>
>
> drivers/staging/nvec/nvec_paz00.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c
> index 8b4da95081c8..9573ba762cdd 100644
> --- a/drivers/staging/nvec/nvec_paz00.c
> +++ b/drivers/staging/nvec/nvec_paz00.c
> @@ -14,8 +14,10 @@
> #include <linux/platform_device.h>
> #include "nvec.h"
>
> -#define to_nvec_led(led_cdev) \
> - container_of(led_cdev, struct nvec_led, cdev)
> +static inline struct nvec_led *to_nvec_led(struct led_classdev *led_cdev)
> +{
> + return container_of(led_cdev, struct nvec_led, cdev);
> +}
There is no need for a function, or a macro, for this, as it is only
used once. Please just open-code it in the one place it is used
instead.
thanks,
greg k-h
Powered by blists - more mailing lists