public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm•com>
To: Lee Jones <lee.jones@linaro•org>,
	broonie@kernel•org, linus.walleij@linaro•org,
	daniel.thompson@linaro•org, arnd@arndb•de
Cc: linux-arm-kernel@lists•infradead.org, baohua@kernel•org,
	linux-kernel@vger•kernel.org, stephan@gerhold•net
Subject: Re: [PATCH 2/2] mfd: mfd-core: Honour Device Tree's request to disable a child-device
Date: Fri, 18 Oct 2019 17:21:35 +0100	[thread overview]
Message-ID: <b7c59d6e-2ad8-30a1-013a-53c116f7b6ba@arm.com> (raw)
In-Reply-To: <20191018122647.3849-3-lee.jones@linaro.org>

On 18/10/2019 13:26, Lee Jones wrote:
> Until now, MFD has assumed all child devices passed to it (via
> mfd_cells) are to be registered.  It does not take into account
> requests from Device Tree and the like to disable child devices
> on a per-platform basis.
> 
> Well now it does.
> 
> Reported-by: Barry Song <Baohua.Song@csr•com>
> Reported-by: Stephan Gerhold <stephan@gerhold•net>
> Signed-off-by: Lee Jones <lee.jones@linaro•org>
> ---
>   drivers/mfd/mfd-core.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index eafdadd58e8b..24c139633524 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -182,6 +182,11 @@ static int mfd_add_device(struct device *parent, int id,
>   	if (parent->of_node && cell->of_compatible) {
>   		for_each_child_of_node(parent->of_node, np) {
>   			if (of_device_is_compatible(np, cell->of_compatible)) {
> +				if (!of_device_is_available(np)) {
> +					/* Ignore disabled devices error free */
> +					ret = 0;
> +					goto fail_alias;
> +				}

Is it possible for a device to have multiple children of the same type? 
If so, it seems like this might not work as desired if, say, the first 
child was disabled but subsequent ones weren't.

It might make sense to use for_each_available_child_of_node() for the 
outer loop, then check afterwards if anything was found.

Robin.

>   				pdev->dev.of_node = np;
>   				pdev->dev.fwnode = &np->fwnode;
>   				break;
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-10-18 16:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18 12:26 [PATCH 0/2] mfd: mfd-core: Honour disabled devices Lee Jones
2019-10-18 12:26 ` [PATCH 1/2] mfd: mfd-core: Allocate reference counting memory directly to the platform device Lee Jones
2019-10-18 16:04   ` Daniel Thompson
2019-10-19  7:31     ` Lee Jones
2019-10-18 12:26 ` [PATCH 2/2] mfd: mfd-core: Honour Device Tree's request to disable a child-device Lee Jones
2019-10-18 16:21   ` Robin Murphy [this message]
2019-10-19  7:28     ` Lee Jones
2019-10-22 18:15       ` Robin Murphy

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=b7c59d6e-2ad8-30a1-013a-53c116f7b6ba@arm.com \
    --to=robin.murphy@arm$(echo .)com \
    --cc=arnd@arndb$(echo .)de \
    --cc=baohua@kernel$(echo .)org \
    --cc=broonie@kernel$(echo .)org \
    --cc=daniel.thompson@linaro$(echo .)org \
    --cc=lee.jones@linaro$(echo .)org \
    --cc=linus.walleij@linaro$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=stephan@gerhold$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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