* [PATCH] mfd: mfd-core: Don't overwrite the dma_mask of the child device
@ 2020-06-04 21:30 Michael Walle
2020-06-05 13:16 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Michael Walle @ 2020-06-04 21:30 UTC (permalink / raw)
To: linux-kernel
Cc: Lee Jones, Mark Brown, Andy Shevchenko, Robin Murphy, Gene Chen,
Michael Walle
Commit cdfee5623290 ("driver core: initialize a default DMA mask for
platform device") initialize the DMA of a platform device. But if the
parent doesn't have a dma_mask set, for example if it's an I2C device,
the dma_mask of the child platform device will be set to zero again.
Which leads to many "DMA mask not set" warnings, if the MFD cell has the
of_compatible property set.
[ 1.877937] sl28cpld-pwm sl28cpld-pwm: DMA mask not set
[ 1.883282] sl28cpld-pwm sl28cpld-pwm.0: DMA mask not set
[ 1.888795] sl28cpld-gpio sl28cpld-gpio: DMA mask not set
Thus don't overwrite the dma_mask of the children. Instead set the
dma_mask of the platform device.
Signed-off-by: Michael Walle <michael@walle.cc>
Suggested-by: Robin Murphy <robin.murphy@arm.com>
---
Former discussion was here:
https://lore.kernel.org/lkml/20200423174543.17161-3-michael@walle.cc/
Because my MFD driver now uses of_platform_populate() it doesn't trigger
this anymore. But it may be useful for others, e.g. if I'm not mistaken it
should apply to the mt6360 sub devices.
Thus I'm submitting this patch seperately.
drivers/mfd/mfd-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index f5a73af60dd4..e735565969b3 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -138,7 +138,7 @@ static int mfd_add_device(struct device *parent, int id,
pdev->dev.parent = parent;
pdev->dev.type = &mfd_dev_type;
- pdev->dev.dma_mask = parent->dma_mask;
+ pdev->platform_dma_mask = parent->dma_mask ? *parent->dma_mask : 0;
pdev->dev.dma_parms = parent->dma_parms;
pdev->dev.coherent_dma_mask = parent->coherent_dma_mask;
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: mfd-core: Don't overwrite the dma_mask of the child device
2020-06-04 21:30 [PATCH] mfd: mfd-core: Don't overwrite the dma_mask of the child device Michael Walle
@ 2020-06-05 13:16 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2020-06-05 13:16 UTC (permalink / raw)
To: Michael Walle
Cc: linux-kernel, Lee Jones, Mark Brown, Robin Murphy, Gene Chen
On Thu, Jun 04, 2020 at 11:30:37PM +0200, Michael Walle wrote:
> Commit cdfee5623290 ("driver core: initialize a default DMA mask for
> platform device") initialize the DMA of a platform device. But if the
> parent doesn't have a dma_mask set, for example if it's an I2C device,
> the dma_mask of the child platform device will be set to zero again.
> Which leads to many "DMA mask not set" warnings, if the MFD cell has the
> of_compatible property set.
>
> [ 1.877937] sl28cpld-pwm sl28cpld-pwm: DMA mask not set
> [ 1.883282] sl28cpld-pwm sl28cpld-pwm.0: DMA mask not set
> [ 1.888795] sl28cpld-gpio sl28cpld-gpio: DMA mask not set
>
> Thus don't overwrite the dma_mask of the children. Instead set the
> dma_mask of the platform device.
> ---
> Former discussion was here:
> https://lore.kernel.org/lkml/20200423174543.17161-3-michael@walle.cc/
>
> Because my MFD driver now uses of_platform_populate() it doesn't trigger
> this anymore. But it may be useful for others, e.g. if I'm not mistaken it
> should apply to the mt6360 sub devices.
Yeah, I'm not sure it's right thing to do, but let maintainers and more
experienced in topic developers to speak up.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-05 13:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 21:30 [PATCH] mfd: mfd-core: Don't overwrite the dma_mask of the child device Michael Walle
2020-06-05 13:16 ` Andy Shevchenko
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).