Linux-SPI Archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Charles Keepax <ckeepax@opensource.cirrus.com>
Cc: broonie@kernel.org, linus.walleij@linaro.org, brgl@bgdev.pl,
	linux-gpio@vger.kernel.org, linux-spi@vger.kernel.org,
	patches@opensource.cirrus.com
Subject: Re: [PATCH v2 3/3] spi: cs42l43: Add bridged cs35l56 amplifiers
Date: Thu, 28 Mar 2024 18:37:49 +0300	[thread overview]
Message-ID: <1123a418-c3c4-4f2b-b957-3737f3837b41@moroto.mountain> (raw)
In-Reply-To: <20240328140119.1784350-4-ckeepax@opensource.cirrus.com>

On Thu, Mar 28, 2024 at 02:01:19PM +0000, Charles Keepax wrote:
> +static bool cs42l43_has_sidecar(struct fwnode_handle *fwnode)
> +{
> +	static const int func_smart_amp = 0x1;
> +	struct fwnode_handle *child_fwnode, *ext_fwnode;
> +	unsigned long long function;
> +	unsigned int val;
> +	int ret;
> +
> +	if (!is_acpi_node(fwnode))
> +		return false;
> +
> +	fwnode_for_each_child_node(fwnode, child_fwnode) {
> +		struct acpi_device *adev = to_acpi_device_node(child_fwnode);
> +
> +		ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &function);
> +		if (ACPI_FAILURE(ret))
> +			continue;
> +
> +		if (function != func_smart_amp)
> +			continue;
> +
> +		ext_fwnode = fwnode_get_named_child_node(child_fwnode,
> +				"mipi-sdca-function-expansion-subproperties");
> +		if (!ext_fwnode)
> +			continue;
> +
> +		ret = fwnode_property_read_u32(ext_fwnode,
> +					       "01fa-cirrus-sidecar-instances",
> +					       &val);
> +		if (ret)
> +			continue;
> +
> +		return !!val;

This should call fwnode_handle_put(child_fwnode) before returning.  An
alternative fix would be to use the new device_for_each_child_node_scoped()
macro.

regards,
dan carpenter

> +	}
> +
> +	return false;
> +}


      reply	other threads:[~2024-03-28 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 14:01 [PATCH 0/3] Add bridged amplifiers to cs42l43 Charles Keepax
2024-03-28 14:01 ` [PATCH v2 1/3] gpio: swnode: Add ability to specify native chip selects for SPI Charles Keepax
2024-03-28 14:01 ` [PATCH v2 2/3] spi: Add a mechanism to use the fwnode name for the SPI device Charles Keepax
2024-03-28 14:01 ` [PATCH v2 3/3] spi: cs42l43: Add bridged cs35l56 amplifiers Charles Keepax
2024-03-28 15:37   ` Dan Carpenter [this message]

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=1123a418-c3c4-4f2b-b957-3737f3837b41@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).