All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleh Kravchenko <oleg@kaa.org.ua>
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Pavel Machek" <pavel@ucw.cz>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Amireddy Mallikarjuna reddy"
	<mallikarjunax.reddy@linux.intel.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Marek Behún" <marek.behun@nic.cz>,
	"Abanoub Sameh" <abanoubsameh8@gmail.com>,
	"Dan Murphy" <dmurphy@ti.com>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 06/28] leds: el15203000: Introduce to_el15203000_led() helper
Date: Sat, 29 May 2021 00:01:56 +0300	[thread overview]
Message-ID: <e01c875b-7317-cd00-23c5-d9736f7533ec@kaa.org.ua> (raw)
In-Reply-To: <20210510095045.3299382-7-andy.shevchenko@gmail.com>

10.05.21 12:50, Andy Shevchenko пише:
> Introduce a helper to replace open coded container_of() calls.
> At the same time move ldev member to be first in the struct el15203000_led,
> that makes container_of() effectivelly a no-op.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  drivers/leds/leds-el15203000.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/leds/leds-el15203000.c b/drivers/leds/leds-el15203000.c
> index fcb90d7cd42f..e81a93d57210 100644
> --- a/drivers/leds/leds-el15203000.c
> +++ b/drivers/leds/leds-el15203000.c
> @@ -69,8 +69,8 @@ enum el15203000_command {
>  };
>  
>  struct el15203000_led {
> -	struct el15203000	*priv;
>  	struct led_classdev	ldev;
> +	struct el15203000	*priv;
>  	u32			reg;
>  };
>  
> @@ -83,6 +83,8 @@ struct el15203000 {
>  	struct el15203000_led	leds[];
>  };
>  
> +#define to_el15203000_led(d)	container_of(d, struct el15203000_led, ldev)
> +
>  static int el15203000_cmd(struct el15203000_led *led, u8 brightness)
>  {
>  	int		ret;
> @@ -124,9 +126,7 @@ static int el15203000_cmd(struct el15203000_led *led, u8 brightness)
>  static int el15203000_set_blocking(struct led_classdev *ldev,
>  				   enum led_brightness brightness)
>  {
> -	struct el15203000_led *led = container_of(ldev,
> -						  struct el15203000_led,
> -						  ldev);
> +	struct el15203000_led *led = to_el15203000_led(ldev);
>  
>  	return el15203000_cmd(led, brightness == LED_OFF ? EL_OFF : EL_ON);
>  }
> @@ -135,9 +135,7 @@ static int el15203000_pattern_set_S(struct led_classdev *ldev,
>  				    struct led_pattern *pattern,
>  				    u32 len, int repeat)
>  {
> -	struct el15203000_led *led = container_of(ldev,
> -						  struct el15203000_led,
> -						  ldev);
> +	struct el15203000_led *led = to_el15203000_led(ldev);
>  
>  	if (repeat > 0 || len != 2 ||
>  	    pattern[0].delta_t != 4000 || pattern[0].brightness != 0 ||
> @@ -188,10 +186,8 @@ static int el15203000_pattern_set_P(struct led_classdev *ldev,
>  				    struct led_pattern *pattern,
>  				    u32 len, int repeat)
>  {
> +	struct el15203000_led	*led = to_el15203000_led(ldev);
>  	u8			cmd;
> -	struct el15203000_led	*led = container_of(ldev,
> -						    struct el15203000_led,
> -						    ldev);
>  
>  	if (repeat > 0)
>  		return -EINVAL;
> @@ -228,9 +224,7 @@ static int el15203000_pattern_set_P(struct led_classdev *ldev,
>  
>  static int el15203000_pattern_clear(struct led_classdev *ldev)
>  {
> -	struct el15203000_led	*led = container_of(ldev,
> -						    struct el15203000_led,
> -						    ldev);
> +	struct el15203000_led *led = to_el15203000_led(ldev);
>  
>  	return el15203000_cmd(led, EL_OFF);
>  }
> 

Reviewed-by: Oleh Kravchenko <oleg@kaa.org.ua>

  reply	other threads:[~2021-05-28 21:07 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  9:50 [PATCH v1 00/28] leds: cleanups and fwnode refcounting bug fixes Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 01/28] leds: class: The -ENOTSUPP should never be seen by user space Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 02/28] leds: core: " Andy Shevchenko
2021-05-28 10:03   ` Pavel Machek
2021-05-28 10:43     ` Andy Shevchenko
2021-05-29  9:42       ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 03/28] leds: el15203000: Give better margin for usleep_range() Andy Shevchenko
2021-05-28 10:04   ` Pavel Machek
2021-05-28 10:45     ` Andy Shevchenko
2021-05-29  9:41       ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 04/28] leds: el15203000: Make error handling more robust Andy Shevchenko
2021-05-28 20:59   ` Oleh Kravchenko
2021-05-10  9:50 ` [PATCH v1 05/28] leds: el15203000: Correct headers (of*.h -> mod_devicetable.h) Andy Shevchenko
2021-05-28 21:00   ` Oleh Kravchenko
2021-05-29  9:45     ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 06/28] leds: el15203000: Introduce to_el15203000_led() helper Andy Shevchenko
2021-05-28 21:01   ` Oleh Kravchenko [this message]
2021-05-10  9:50 ` [PATCH v1 07/28] leds: lgm-sso: Fix clock handling Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 08/28] leds: lgm-sso: Put fwnode in any case during ->probe() Andy Shevchenko
2021-05-28 10:08   ` Pavel Machek
2021-05-28 10:46     ` Andy Shevchenko
2021-05-29  9:28     ` Andy Shevchenko
2021-05-29 10:46       ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 09/28] leds: lgm-sso: Don't spam logs when probe is deferred Andy Shevchenko
2021-05-28 10:11   ` Pavel Machek
2021-05-28 10:47     ` Andy Shevchenko
2021-05-29  9:54       ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 10/28] leds: lgm-sso: Remove unneeded of_match_ptr() Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 11/28] leds: lgm-sso: Remove explicit managed resource cleanups Andy Shevchenko
2021-05-28 10:09   ` Pavel Machek
2021-05-28 10:49     ` Andy Shevchenko
2021-05-29  9:46       ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 12/28] leds: lgm-sso: Drop duplicate NULL check for GPIO operations Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 13/28] leds: lgm-sso: Convert to use list_for_each_entry*() API Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 14/28] leds: lm3532: select regmap I2C API Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 15/28] leds: lm3532: Make error handling more robust Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 16/28] leds: lm36274: Put fwnode in error case during ->probe() Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 17/28] leds: lm36274: Correct headers (of*.h -> mod_devicetable.h) Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 18/28] leds: lm3692x: Put fwnode in any case during ->probe() Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 19/28] leds: lm3692x: Correct headers (of*.h -> mod_devicetable.h) Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 20/28] leds: lm3697: Update header block to reflect reality Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 21/28] leds: lm3697: Make error handling more robust Andy Shevchenko
2021-05-28 10:10   ` Pavel Machek
2021-05-28 10:50     ` Andy Shevchenko
2021-05-29  9:50       ` Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 22/28] leds: lm3697: Don't spam logs when probe is deferred Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 23/28] leds: lp50xx: Put fwnode in error case during ->probe() Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 24/28] leds: lt3593: Put fwnode in any " Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 25/28] leds: lt3593: Make use of device properties Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 26/28] leds: pwm: Make error handling more robust Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 27/28] leds: rt8515: Put fwnode in any case during ->probe() Andy Shevchenko
2021-05-10  9:50 ` [PATCH v1 28/28] leds: sgm3140: " Andy Shevchenko
2021-05-28 10:14   ` Pavel Machek
2021-05-28 10:59     ` Andy Shevchenko
2021-05-29  9:58       ` Andy Shevchenko
2021-05-17  7:30 ` [PATCH v1 00/28] leds: cleanups and fwnode refcounting bug fixes Andy Shevchenko
2021-05-24 14:56   ` Andy Shevchenko
2021-05-24 17:49     ` Pavel Machek
2021-05-24 18:39       ` Andy Shevchenko
2021-05-28 10:02   ` Pavel Machek
2021-05-28 11:05     ` Andy Shevchenko
2021-05-28 20:34       ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e01c875b-7317-cd00-23c5-d9736f7533ec@kaa.org.ua \
    --to=oleg@kaa.org.ua \
    --cc=abanoubsameh8@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=krzk@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=mallikarjunax.reddy@linux.intel.com \
    --cc=marek.behun@nic.cz \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.