Linux LED subsystem development
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Daniel Scally <dan.scally@ideasonboard.com>,
	linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org
Cc: pavel@ucw.cz, lee@kernel.org, markgross@kernel.org,
	sboyd@kernel.org, hpa@redhat.com
Subject: Re: [PATCH 4/8] platform/x86: int3472: Add tps68470-led as clock consumer
Date: Wed, 22 Mar 2023 18:19:48 +0100	[thread overview]
Message-ID: <2d7d8ed7-0511-b30e-71a8-35f1cc76397e@redhat.com> (raw)
In-Reply-To: <20230322160926.948687-5-dan.scally@ideasonboard.com>

Hi,

On 3/22/23 17:09, Daniel Scally wrote:
> Some of the LEDs provided by the TPS68470 require the clock that it
> provides to be active in order to function. Add the platform driver
> for the leds as a consumer of the clock so that the led driver can
> discover it during .probe()
> 
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
> ---
>  drivers/platform/x86/intel/int3472/tps68470.c | 21 ++++++++++++-------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/platform/x86/intel/int3472/tps68470.c b/drivers/platform/x86/intel/int3472/tps68470.c
> index 53b0459f278a..818f2fc5bf2a 100644
> --- a/drivers/platform/x86/intel/int3472/tps68470.c
> +++ b/drivers/platform/x86/intel/int3472/tps68470.c
> @@ -105,25 +105,30 @@ skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data
>  {
>  	struct acpi_device *adev = ACPI_COMPANION(dev);
>  	struct acpi_device *consumer;
> -	unsigned int n_consumers = 0;
> +	unsigned int n_consumers = 1;
>  	const char *sensor_name;
> -	unsigned int i = 0;
> +	const char *led_name;
> +	unsigned int i = 1;

Nitpick: please just don't init i here at all.

>  
>  	for_each_acpi_consumer_dev(adev, consumer)
>  		n_consumers++;
>  
> -	if (!n_consumers) {
> -		dev_err(dev, "INT3472 seems to have no dependents\n");
> -		return -ENODEV;
> -	}
> -
>  	*clk_pdata = devm_kzalloc(dev, struct_size(*clk_pdata, consumers, n_consumers),
>  				  GFP_KERNEL);
>  	if (!*clk_pdata)
>  		return -ENOMEM;
>  
>  	(*clk_pdata)->n_consumers = n_consumers;
> -	i = 0;
> +
> +	/*
> +	 * The TPS68470 includes an LED driver which requires the clock be active
> +	 * to function. Add the led platform device as a consumer of the clock.
> +	 */
> +	led_name = devm_kstrdup(dev, "tps68470-led", GFP_KERNEL);
> +	if (!led_name)
> +		return -ENOMEM;
> +
> +	(*clk_pdata)->consumers[0].consumer_dev_name = led_name;
>  

And add a:

	i = 1;

here, to make it clear that after setting consumers[0] we now
start adding more consumers at index 1.

>  	for_each_acpi_consumer_dev(adev, consumer) {
>  		sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT,

With that fixed:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


  reply	other threads:[~2023-03-22 17:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 16:09 [PATCH 0/8] Add WLED support to TPS68470 LED driver Daniel Scally
2023-03-22 16:09 ` [PATCH 1/8] platform/x86: int3472: Add platform data for LEDs Daniel Scally
2023-03-22 17:14   ` Hans de Goede
2023-03-22 16:09 ` [PATCH 2/8] platform/x86: int3472: Init LED registers using platform data Daniel Scally
2023-03-22 17:16   ` Hans de Goede
2023-03-22 16:09 ` [PATCH 3/8] platform/x86: int3472: Add TPS68470 LED Board Data Daniel Scally
2023-03-22 17:17   ` Hans de Goede
2023-03-22 16:09 ` [PATCH 4/8] platform/x86: int3472: Add tps68470-led as clock consumer Daniel Scally
2023-03-22 17:19   ` Hans de Goede [this message]
2023-03-22 16:09 ` [PATCH 5/8] leds: tps68470: Refactor tps68470_brightness_get() Daniel Scally
2023-03-22 17:22   ` Hans de Goede
2023-03-23  7:43     ` Dan Scally
2023-03-23  9:52       ` Hans de Goede
2023-03-23  9:53         ` Dan Scally
2023-03-22 16:09 ` [PATCH 6/8] leds: tps68470: Support the WLED driver Daniel Scally
2023-03-22 17:24   ` Hans de Goede
2023-03-23 11:22   ` Pavel Machek
2023-03-23 16:25     ` Dan Scally
2023-03-27 13:23       ` Hans de Goede
2023-03-22 16:09 ` [PATCH 7/8] platform/x86: int3472: Support LED lookups in board data Daniel Scally
2023-03-22 17:25   ` Hans de Goede
2023-03-22 16:09 ` [PATCH 8/8] platform/x86: int3472: Define LED lookup data for MS Surface Go Daniel Scally
2023-03-22 17:34   ` Hans de Goede
2023-03-23 10:31     ` Dan Scally
2023-03-23 11:15       ` Hans de Goede
2023-03-22 17:40 ` [PATCH 0/8] Add WLED support to TPS68470 LED driver Hans de Goede

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=2d7d8ed7-0511-b30e-71a8-35f1cc76397e@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=hpa@redhat.com \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=pavel@ucw.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sboyd@kernel.org \
    /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