linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	kernel@pengutronix.de, Pavel Machek <pavel@ucw.cz>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Anjelique Melendez <quic_amelende@quicinc.com>,
	Luca Weiss <luca@z3ntu.xyz>, Lu Hongfei <luhongfei@vivo.com>,
	Kees Cook <keescook@chromium.org>,
	linux-leds@vger.kernel.org
Subject: Re: [PATCH v4 005/115] leds: qcom-lpg: Introduce a wrapper for getting driver data from a pwm chip
Date: Thu, 7 Dec 2023 17:05:40 +0000	[thread overview]
Message-ID: <20231207170540.GD111411@google.com> (raw)
In-Reply-To: <4785982785812615d15c7dd6d2755270bd8670b2.1701860672.git.u.kleine-koenig@pengutronix.de>

On Wed, 06 Dec 2023, Uwe Kleine-König wrote:

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Note this patch was already sent out individually, find it at
> https://lore.kernel.org/linux-leds/20231124215208.616551-3-u.kleine-koenig@pengutronix.de
> 
>  drivers/leds/rgb/leds-qcom-lpg.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Acked-by: Lee Jones <lee@kernel.org>

> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index 54c90ee43ef8..156b73d1f4a2 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> @@ -976,9 +976,14 @@ static int lpg_pattern_mc_clear(struct led_classdev *cdev)
>  	return lpg_pattern_clear(led);
>  }
>  
> +static inline struct lpg *lpg_pwm_from_chip(struct pwm_chip *chip)
> +{
> +	return container_of(chip, struct lpg, pwm);
> +}
> +
>  static int lpg_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
>  {
> -	struct lpg *lpg = container_of(chip, struct lpg, pwm);
> +	struct lpg *lpg = lpg_pwm_from_chip(chip);
>  	struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
>  
>  	return chan->in_use ? -EBUSY : 0;
> @@ -994,7 +999,7 @@ static int lpg_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
>  static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  			 const struct pwm_state *state)
>  {
> -	struct lpg *lpg = container_of(chip, struct lpg, pwm);
> +	struct lpg *lpg = lpg_pwm_from_chip(chip);
>  	struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
>  	int ret = 0;
>  
> @@ -1025,7 +1030,7 @@ static int lpg_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
>  static int lpg_pwm_get_state(struct pwm_chip *chip, struct pwm_device *pwm,
>  			     struct pwm_state *state)
>  {
> -	struct lpg *lpg = container_of(chip, struct lpg, pwm);
> +	struct lpg *lpg = lpg_pwm_from_chip(chip);
>  	struct lpg_channel *chan = &lpg->channels[pwm->hwpwm];
>  	unsigned int resolution;
>  	unsigned int pre_div;
> -- 
> 2.42.0
> 

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2023-12-07 17:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-06 11:43 [PATCH v4 000/115] pwm: Fix lifetime issues for pwm_chips Uwe Kleine-König
2023-12-06 11:43 ` [PATCH v4 003/115] leds: qcom-lpg: Use devm_pwmchip_add() simplifying driver removal Uwe Kleine-König
2023-12-07 17:06   ` Lee Jones
2023-12-07 17:58     ` Uwe Kleine-König
2023-12-13 15:48   ` Lee Jones
2023-12-13 15:51   ` (subset) " Lee Jones
2023-12-06 11:43 ` [PATCH v4 004/115] leds: qcom-lpg: Consistenly use dev_err_probe() in .probe()'s error path Uwe Kleine-König
2023-12-07 17:06   ` Lee Jones
2023-12-13 15:50   ` Lee Jones
2023-12-06 11:43 ` [PATCH v4 005/115] leds: qcom-lpg: Introduce a wrapper for getting driver data from a pwm chip Uwe Kleine-König
2023-12-07 17:05   ` Lee Jones [this message]
2023-12-13 15:51   ` (subset) " Lee Jones
2023-12-06 11:45 ` [PATCH v4 108/115] leds: qcom-lpg: Make use of devm_pwmchip_alloc() function Uwe Kleine-König
2023-12-07 17:05   ` Lee Jones
2023-12-08 15:41 ` [PATCH v4 000/115] pwm: Fix lifetime issues for pwm_chips Thierry Reding
2023-12-08 18:50   ` Uwe Kleine-König
2023-12-11 11:33     ` Thierry Reding
2023-12-11 12:18       ` Uwe Kleine-König
2023-12-12 21:05       ` Uwe Kleine-König

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=20231207170540.GD111411@google.com \
    --to=lee@kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-leds@vger.kernel.org \
    --cc=luca@z3ntu.xyz \
    --cc=luhongfei@vivo.com \
    --cc=pavel@ucw.cz \
    --cc=quic_amelende@quicinc.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).