public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Daniel Scally <djrscally@gmail.com>
Cc: linux-acpi@vger.kernel.org, linux-clk@vger.kernel.org,
	platform-driver-x86@vger.kernel.org, rafael@kernel.org,
	lenb@kernel.org, mturquette@baylibre.com, sboyd@kernel.org,
	hdegoede@redhat.com, markgross@kernel.org,
	robert.moore@intel.com
Subject: Re: [PATCH v3 3/5] platform/x86: int3472: Support multiple clock consumers
Date: Tue, 27 Sep 2022 15:48:26 +0300	[thread overview]
Message-ID: <YzLxGmesitf6G0Ve@smile.fi.intel.com> (raw)
In-Reply-To: <YzLw1VVWDGF1YVu5@smile.fi.intel.com>

On Tue, Sep 27, 2022 at 03:47:17PM +0300, Andy Shevchenko wrote:
> On Thu, Sep 22, 2022 at 12:04:37AM +0100, Daniel Scally wrote:
> > At present, the tps68470.c only supports a single clock consumer when
> > passing platform data to the clock driver. In some devices multiple
> > sensors depend on the clock provided by a single TPS68470 and so all
> > need to be able to acquire the clock. Support passing multiple
> > consumers as platform data.

...

> > +static int
> > +skl_int3472_fill_clk_pdata(struct device *dev, struct tps68470_clk_platform_data **clk_pdata)
> > +{
> > +	struct acpi_device *adev = ACPI_COMPANION(dev);
> > +	struct acpi_device *consumer;
> > +	unsigned int n_consumers = 0;
> > +	const char *sensor_name;
> > +	unsigned int i = 0;
> > +
> > +	for_each_acpi_consumer_dev(adev, consumer)
> > +		n_consumers++;
> 
> Here no put for consumer (and IIUC it's correct).
> 
> > +
> 
> (Also no need to have a blank line here, the condition is tighten to
>  the for-loop.)
> 
> > +	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;
> > +
> > +	for_each_acpi_consumer_dev(adev, consumer) {
> > +		sensor_name = devm_kasprintf(dev, GFP_KERNEL, I2C_DEV_NAME_FORMAT,
> > +					     acpi_dev_name(consumer));
> > +		if (!sensor_name)
> > +			return -ENOMEM;
> > +
> > +		(*clk_pdata)->consumers[i].consumer_dev_name = sensor_name;
> > +		i++;
> > +	}
> 
> > +	acpi_dev_put(consumer);

> Why is it here?

Now I got it, you need to move it to the error path before returning from
inside the for-loop.

> > +	return n_consumers;
> > +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-09-27 12:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 23:04 [PATCH v3 0/5] Add multiple-consumer support to int3472-tps68470 driver Daniel Scally
2022-09-21 23:04 ` [PATCH v3 1/5] ACPI: scan: Add acpi_dev_get_next_consumer_dev() Daniel Scally
2022-09-21 23:04 ` [PATCH v3 2/5] ACPI: bus: Add iterator for dependent devices Daniel Scally
2022-09-21 23:04 ` [PATCH v3 3/5] platform/x86: int3472: Support multiple clock consumers Daniel Scally
2022-09-22  8:49   ` Hans de Goede
2022-09-27 12:47   ` Andy Shevchenko
2022-09-27 12:48     ` Andy Shevchenko [this message]
2022-09-21 23:04 ` [PATCH v3 4/5] platform/x86: int3472: Support multiple gpio lookups in board data Daniel Scally
2022-09-21 23:04 ` [PATCH v3 5/5] platform/x86: int3472: Add board data for Surface Go2 IR camera Daniel Scally
2022-09-22  8:55 ` [PATCH v3 0/5] Add multiple-consumer support to int3472-tps68470 driver Hans de Goede
2022-09-22  9:07   ` Daniel Scally
2022-09-24 17:15   ` Rafael J. Wysocki
2022-09-25  9:23     ` 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=YzLxGmesitf6G0Ve@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=djrscally@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    --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