linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device
@ 2019-11-07 11:19 Lee Jones
  2019-11-07 11:54 ` Daniel Thompson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lee Jones @ 2019-11-07 11:19 UTC (permalink / raw)
  To: daniel.thompson, broonie, arnd, linus.walleij
  Cc: baohua, stephan, linux-kernel, Barry Song, Lee Jones, linux-arm-kernel

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.

Link: https://www.spinics.net/lists/arm-kernel/msg366309.html
Link: https://lkml.org/lkml/2019/8/22/1350

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 cb3e0a14bbdd..f5a73af60dd4 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -152,6 +152,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;
+				}
 				pdev->dev.of_node = np;
 				pdev->dev.fwnode = &np->fwnode;
 				break;
-- 
2.24.0


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device
  2019-11-07 11:19 [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device Lee Jones
@ 2019-11-07 11:54 ` Daniel Thompson
  2019-11-07 13:06 ` Mark Brown
  2019-11-07 18:26 ` Stephan Gerhold
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Thompson @ 2019-11-07 11:54 UTC (permalink / raw)
  To: Lee Jones
  Cc: baohua, stephan, arnd, linus.walleij, linux-kernel, broonie,
	Barry Song, linux-arm-kernel

On Thu, Nov 07, 2019 at 11:19:50AM +0000, 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.
> 
> Link: https://www.spinics.net/lists/arm-kernel/msg366309.html
> Link: https://lkml.org/lkml/2019/8/22/1350
> 
> Reported-by: Barry Song <Baohua.Song@csr.com>
> Reported-by: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Reviewed-by: Daniel Thompson <daniel.thompson@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 cb3e0a14bbdd..f5a73af60dd4 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -152,6 +152,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;
> +				}
>  				pdev->dev.of_node = np;
>  				pdev->dev.fwnode = &np->fwnode;
>  				break;
> -- 
> 2.24.0
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device
  2019-11-07 11:19 [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device Lee Jones
  2019-11-07 11:54 ` Daniel Thompson
@ 2019-11-07 13:06 ` Mark Brown
  2019-11-07 18:26 ` Stephan Gerhold
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-11-07 13:06 UTC (permalink / raw)
  To: Lee Jones
  Cc: baohua, stephan, arnd, linus.walleij, daniel.thompson,
	linux-kernel, Barry Song, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 328 bytes --]

On Thu, Nov 07, 2019 at 11:19:50AM +0000, 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.

Reviewed-by: Mark Brown <broonie@kernel.org>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device
  2019-11-07 11:19 [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device Lee Jones
  2019-11-07 11:54 ` Daniel Thompson
  2019-11-07 13:06 ` Mark Brown
@ 2019-11-07 18:26 ` Stephan Gerhold
  2 siblings, 0 replies; 4+ messages in thread
From: Stephan Gerhold @ 2019-11-07 18:26 UTC (permalink / raw)
  To: Lee Jones
  Cc: daniel.thompson, arnd, baohua, linus.walleij, linux-kernel,
	broonie, Barry Song, linux-arm-kernel

On Thu, Nov 07, 2019 at 11:19:50AM +0000, 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.
> 
> Link: https://www.spinics.net/lists/arm-kernel/msg366309.html
> Link: https://lkml.org/lkml/2019/8/22/1350
> 
> Reported-by: Barry Song <Baohua.Song@csr.com>
> Reported-by: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Thanks for all your work on this issue!

FWIW:
Tested-by: Stephan Gerhold <stephan@gerhold.net>

> ---
>  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 cb3e0a14bbdd..f5a73af60dd4 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -152,6 +152,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;
> +				}
>  				pdev->dev.of_node = np;
>  				pdev->dev.fwnode = &np->fwnode;
>  				break;
> -- 
> 2.24.0
> 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-07 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 11:19 [PATCH 1/1] mfd: mfd-core: Honour Device Tree's request to disable a child-device Lee Jones
2019-11-07 11:54 ` Daniel Thompson
2019-11-07 13:06 ` Mark Brown
2019-11-07 18:26 ` Stephan Gerhold

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).