linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: core: Fix handle of OF disabled MFD cells
@ 2020-08-01  7:01 Icenowy Zheng
  2020-08-19  8:11 ` Lee Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Icenowy Zheng @ 2020-08-01  7:01 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Icenowy Zheng

When rewriting the OF match code of MFD core, addition of cells disabled
in OF will result in a failure with error -ENODEV. This is an unexpected
behavior, as the previous behavior is silently ignore the cell. On
SBCs with AXP20x PMICs, this leads to boot failure if AXP20x PMIC
support is built-in and some cells (especially power supply ones) are
disabled.

Silently ignore the cell when -ENODEV occurs.

Fixes: e49aa9a9bd22 ("mfd: core: Make a best effort attempt to match devices with the correct of_nodes")
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
---
 drivers/mfd/mfd-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index c3ef58a802bee..31b363c64f4b4 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -215,8 +215,13 @@ static int mfd_add_device(struct device *parent, int id,
 				ret = mfd_match_of_node_to_dev(pdev, np, cell);
 				if (ret == -EAGAIN)
 					continue;
-				if (ret)
+				if (ret) {
+					if (ret == -ENODEV) {
+						/* Ignore disabled devices error free */
+						ret = 0;
+					}
 					goto fail_alias;
+				}
 
 				break;
 			}
-- 
2.27.0

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

* Re: [PATCH] mfd: core: Fix handle of OF disabled MFD cells
  2020-08-01  7:01 [PATCH] mfd: core: Fix handle of OF disabled MFD cells Icenowy Zheng
@ 2020-08-19  8:11 ` Lee Jones
  2020-08-19  8:16   ` Icenowy Zheng
  0 siblings, 1 reply; 4+ messages in thread
From: Lee Jones @ 2020-08-19  8:11 UTC (permalink / raw)
  To: Icenowy Zheng; +Cc: linux-kernel

On Sat, 01 Aug 2020, Icenowy Zheng wrote:

> When rewriting the OF match code of MFD core, addition of cells disabled
> in OF will result in a failure with error -ENODEV. This is an unexpected
> behavior, as the previous behavior is silently ignore the cell. On
> SBCs with AXP20x PMICs, this leads to boot failure if AXP20x PMIC
> support is built-in and some cells (especially power supply ones) are
> disabled.

Thanks for reporting this.

Do you mind if I fix this another way?  I plan to reinstate the old
code that was removed as part of the offending patch.  I will of
course add your Reported-by tag.

> Silently ignore the cell when -ENODEV occurs.
> 
> Fixes: e49aa9a9bd22 ("mfd: core: Make a best effort attempt to match devices with the correct of_nodes")
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> ---
>  drivers/mfd/mfd-core.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> index c3ef58a802bee..31b363c64f4b4 100644
> --- a/drivers/mfd/mfd-core.c
> +++ b/drivers/mfd/mfd-core.c
> @@ -215,8 +215,13 @@ static int mfd_add_device(struct device *parent, int id,
>  				ret = mfd_match_of_node_to_dev(pdev, np, cell);
>  				if (ret == -EAGAIN)
>  					continue;
> -				if (ret)
> +				if (ret) {
> +					if (ret == -ENODEV) {
> +						/* Ignore disabled devices error free */
> +						ret = 0;
> +					}
>  					goto fail_alias;
> +				}
>  
>  				break;
>  			}

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH] mfd: core: Fix handle of OF disabled MFD cells
  2020-08-19  8:11 ` Lee Jones
@ 2020-08-19  8:16   ` Icenowy Zheng
  2020-08-19  8:26     ` Lee Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Icenowy Zheng @ 2020-08-19  8:16 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel

在 2020-08-19星期三的 09:11 +0100,Lee Jones写道:
> On Sat, 01 Aug 2020, Icenowy Zheng wrote:
> 
> > When rewriting the OF match code of MFD core, addition of cells
> > disabled
> > in OF will result in a failure with error -ENODEV. This is an
> > unexpected
> > behavior, as the previous behavior is silently ignore the cell. On
> > SBCs with AXP20x PMICs, this leads to boot failure if AXP20x PMIC
> > support is built-in and some cells (especially power supply ones)
> > are
> > disabled.
> 
> Thanks for reporting this.
> 
> Do you mind if I fix this another way?  I plan to reinstate the old
> code that was removed as part of the offending patch.  I will of
> course add your Reported-by tag.

I think it's okay.

I will test it once it's out.

> 
> > Silently ignore the cell when -ENODEV occurs.
> > 
> > Fixes: e49aa9a9bd22 ("mfd: core: Make a best effort attempt to
> > match devices with the correct of_nodes")
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > ---
> >  drivers/mfd/mfd-core.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
> > index c3ef58a802bee..31b363c64f4b4 100644
> > --- a/drivers/mfd/mfd-core.c
> > +++ b/drivers/mfd/mfd-core.c
> > @@ -215,8 +215,13 @@ static int mfd_add_device(struct device
> > *parent, int id,
> >  				ret = mfd_match_of_node_to_dev(pdev,
> > np, cell);
> >  				if (ret == -EAGAIN)
> >  					continue;
> > -				if (ret)
> > +				if (ret) {
> > +					if (ret == -ENODEV) {
> > +						/* Ignore disabled
> > devices error free */
> > +						ret = 0;
> > +					}
> >  					goto fail_alias;
> > +				}
> >  
> >  				break;
> >  			}

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

* Re: [PATCH] mfd: core: Fix handle of OF disabled MFD cells
  2020-08-19  8:16   ` Icenowy Zheng
@ 2020-08-19  8:26     ` Lee Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2020-08-19  8:26 UTC (permalink / raw)
  To: Icenowy Zheng; +Cc: linux-kernel

On Wed, 19 Aug 2020, Icenowy Zheng wrote:

> 在 2020-08-19星期三的 09:11 +0100,Lee Jones写道:
> > On Sat, 01 Aug 2020, Icenowy Zheng wrote:
> > 
> > > When rewriting the OF match code of MFD core, addition of cells
> > > disabled
> > > in OF will result in a failure with error -ENODEV. This is an
> > > unexpected
> > > behavior, as the previous behavior is silently ignore the cell. On
> > > SBCs with AXP20x PMICs, this leads to boot failure if AXP20x PMIC
> > > support is built-in and some cells (especially power supply ones)
> > > are
> > > disabled.
> > 
> > Thanks for reporting this.
> > 
> > Do you mind if I fix this another way?  I plan to reinstate the old
> > code that was removed as part of the offending patch.  I will of
> > course add your Reported-by tag.
> 
> I think it's okay.
> 
> I will test it once it's out.

That would be great.  Then I can add your Tested-by also.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

end of thread, other threads:[~2020-08-19  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  7:01 [PATCH] mfd: core: Fix handle of OF disabled MFD cells Icenowy Zheng
2020-08-19  8:11 ` Lee Jones
2020-08-19  8:16   ` Icenowy Zheng
2020-08-19  8:26     ` Lee Jones

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