Message ID | 20230914102038.2944844-1-xu.yang_2@nxp.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] perf: imx9_ddr_perf: resolve resource map conflict | expand |
On 14/09/2023 12:20, Xu Yang wrote: > Usually, the ddr pmu node will be a subnode of DDR controller, then using > devm_platform_ioremap_resource will report conflict with DDR controller > resource. So update the driver to use devm_ioremap to avoid such > resource check. > Why would you like to map same region twice? The resource check is for purpose there... > Signed-off-by: Ye Li <ye.li@nxp.com> > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> > --- > drivers/perf/fsl_imx9_ddr_perf.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c > index 5cf770a1bc31..885024665968 100644 > --- a/drivers/perf/fsl_imx9_ddr_perf.c > +++ b/drivers/perf/fsl_imx9_ddr_perf.c > @@ -602,8 +602,15 @@ static int ddr_perf_probe(struct platform_device *pdev) > void __iomem *base; > int ret, irq; > char *name; > + struct resource *r; > > - base = devm_platform_ioremap_resource(pdev, 0); > + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!r) { > + dev_err(&pdev->dev, "platform_get_resource() failed\n"); > + return -ENOMEM; > + } > + > + base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); You need to document this, otherwise someone will revert your commit soon. Best regards, Krzysztof
Hi Krzysztof, > On 14/09/2023 12:20, Xu Yang wrote: > > Usually, the ddr pmu node will be a subnode of DDR controller, then using > > devm_platform_ioremap_resource will report conflict with DDR controller > > resource. So update the driver to use devm_ioremap to avoid such > > resource check. > > > > Why would you like to map same region twice? The resource check is for > purpose there... > Because the ddr pmu region is a subset of ddr controller region. When edac driver is enabled, it will map the whole region firstly. I will check if this can be changed. > > Signed-off-by: Ye Li <ye.li@nxp.com> > > Signed-off-by: Xu Yang <xu.yang_2@nxp.com> > > --- > > drivers/perf/fsl_imx9_ddr_perf.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c > > index 5cf770a1bc31..885024665968 100644 > > --- a/drivers/perf/fsl_imx9_ddr_perf.c > > +++ b/drivers/perf/fsl_imx9_ddr_perf.c > > @@ -602,8 +602,15 @@ static int ddr_perf_probe(struct platform_device *pdev) > > void __iomem *base; > > int ret, irq; > > char *name; > > + struct resource *r; > > > > - base = devm_platform_ioremap_resource(pdev, 0); > > + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > > + if (!r) { > > + dev_err(&pdev->dev, "platform_get_resource() failed\n"); > > + return -ENOMEM; > > + } > > + > > + base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); > > You need to document this, otherwise someone will revert your commit soon. > > > Best regards, > Krzysztof Thanks, Xu Yang
diff --git a/drivers/perf/fsl_imx9_ddr_perf.c b/drivers/perf/fsl_imx9_ddr_perf.c index 5cf770a1bc31..885024665968 100644 --- a/drivers/perf/fsl_imx9_ddr_perf.c +++ b/drivers/perf/fsl_imx9_ddr_perf.c @@ -602,8 +602,15 @@ static int ddr_perf_probe(struct platform_device *pdev) void __iomem *base; int ret, irq; char *name; + struct resource *r; - base = devm_platform_ioremap_resource(pdev, 0); + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!r) { + dev_err(&pdev->dev, "platform_get_resource() failed\n"); + return -ENOMEM; + } + + base = devm_ioremap(&pdev->dev, r->start, resource_size(r)); if (IS_ERR(base)) return PTR_ERR(base);