[2/2] drm/msm: Quiet error during failure in optional resource mappings.
diff mbox series

Message ID 20200629181921.3019271-2-eric@anholt.net
State New
Headers show
Series
  • [1/2] drm/msm: Garbage collect unused resource _len fields.
Related show

Commit Message

Eric Anholt June 29, 2020, 6:19 p.m. UTC
We don't expect to find vbif_nrt or regdma on cheza, but were clogging
up dmesg with errors about it.

Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  4 ++--
 drivers/gpu/drm/msm/msm_drv.c           | 22 ++++++++++++++++++----
 drivers/gpu/drm/msm/msm_drv.h           |  2 ++
 3 files changed, 22 insertions(+), 6 deletions(-)

Comments

Rob Clark June 29, 2020, 7:57 p.m. UTC | #1
On Mon, Jun 29, 2020 at 11:19 AM Eric Anholt <eric@anholt.net> wrote:
>
> We don't expect to find vbif_nrt or regdma on cheza, but were clogging
> up dmesg with errors about it.

nit: s/cheza/sdm845/ (since this really applies to the SoC rather than
the board..

also, maybe msm_ioremap_optional() ?

BR,
-R

>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  4 ++--
>  drivers/gpu/drm/msm/msm_drv.c           | 22 ++++++++++++++++++----
>  drivers/gpu/drm/msm/msm_drv.h           |  2 ++
>  3 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index a4ab802fee6d..d9aef2b5e930 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -838,13 +838,13 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
>                 dpu_kms->vbif[VBIF_RT] = NULL;
>                 goto error;
>         }
> -       dpu_kms->vbif[VBIF_NRT] = msm_ioremap(dpu_kms->pdev, "vbif_nrt", "vbif_nrt");
> +       dpu_kms->vbif[VBIF_NRT] = msm_ioremap_quiet(dpu_kms->pdev, "vbif_nrt", "vbif_nrt");
>         if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) {
>                 dpu_kms->vbif[VBIF_NRT] = NULL;
>                 DPU_DEBUG("VBIF NRT is not defined");
>         }
>
> -       dpu_kms->reg_dma = msm_ioremap(dpu_kms->pdev, "regdma", "regdma");
> +       dpu_kms->reg_dma = msm_ioremap_quiet(dpu_kms->pdev, "regdma", "regdma");
>         if (IS_ERR(dpu_kms->reg_dma)) {
>                 dpu_kms->reg_dma = NULL;
>                 DPU_DEBUG("REG_DMA is not defined");
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index f6ce40bf3699..df4a3c6a49cd 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -120,8 +120,8 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name)
>         return clk;
>  }
>
> -void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
> -               const char *dbgname)
> +void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
> +                          const char *dbgname, bool quiet)
>  {
>         struct resource *res;
>         unsigned long size;
> @@ -133,7 +133,8 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>                 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
>         if (!res) {
> -               DRM_DEV_ERROR(&pdev->dev, "failed to get memory resource: %s\n", name);
> +               if (!quiet)
> +                       DRM_DEV_ERROR(&pdev->dev, "failed to get memory resource: %s\n", name);
>                 return ERR_PTR(-EINVAL);
>         }
>
> @@ -141,7 +142,8 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>
>         ptr = devm_ioremap(&pdev->dev, res->start, size);
>         if (!ptr) {
> -               DRM_DEV_ERROR(&pdev->dev, "failed to ioremap: %s\n", name);
> +               if (!quiet)
> +                       DRM_DEV_ERROR(&pdev->dev, "failed to ioremap: %s\n", name);
>                 return ERR_PTR(-ENOMEM);
>         }
>
> @@ -151,6 +153,18 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>         return ptr;
>  }
>
> +void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
> +                         const char *dbgname)
> +{
> +       return _msm_ioremap(pdev, name, dbgname, false);
> +}
> +
> +void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
> +                               const char *dbgname)
> +{
> +       return _msm_ioremap(pdev, name, dbgname, true);
> +}
> +
>  void msm_writel(u32 data, void __iomem *addr)
>  {
>         if (reglog)
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index e2d6a6056418..2687f7a42c15 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -411,6 +411,8 @@ struct clk *msm_clk_bulk_get_clock(struct clk_bulk_data *bulk, int count,
>         const char *name);
>  void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
>                 const char *dbgname);
> +void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
> +               const char *dbgname);
>  void msm_writel(u32 data, void __iomem *addr);
>  u32 msm_readl(const void __iomem *addr);
>
> --
> 2.26.2
>
kernel test robot July 3, 2020, 4:13 p.m. UTC | #2
Hi Eric,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master v5.8-rc3 next-20200703]
[cannot apply to drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Eric-Anholt/drm-msm-Garbage-collect-unused-resource-_len-fields/20200630-022449
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: arm64-randconfig-r031-20200703 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project ca464639a1c9dd3944eb055ffd2796e8c2e7639f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/msm/msm_drv.c:123:15: warning: no previous prototype for function '_msm_ioremap' [-Wmissing-prototypes]
   void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
                 ^
   drivers/gpu/drm/msm/msm_drv.c:123:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
   ^
   static 
   1 warning generated.

vim +/_msm_ioremap +123 drivers/gpu/drm/msm/msm_drv.c

   122	
 > 123	void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
   124				   const char *dbgname, bool quiet)
   125	{
   126		struct resource *res;
   127		unsigned long size;
   128		void __iomem *ptr;
   129	
   130		if (name)
   131			res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
   132		else
   133			res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   134	
   135		if (!res) {
   136			if (!quiet)
   137				DRM_DEV_ERROR(&pdev->dev, "failed to get memory resource: %s\n", name);
   138			return ERR_PTR(-EINVAL);
   139		}
   140	
   141		size = resource_size(res);
   142	
   143		ptr = devm_ioremap(&pdev->dev, res->start, size);
   144		if (!ptr) {
   145			if (!quiet)
   146				DRM_DEV_ERROR(&pdev->dev, "failed to ioremap: %s\n", name);
   147			return ERR_PTR(-ENOMEM);
   148		}
   149	
   150		if (reglog)
   151			printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
   152	
   153		return ptr;
   154	}
   155	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Patch
diff mbox series

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index a4ab802fee6d..d9aef2b5e930 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -838,13 +838,13 @@  static int dpu_kms_hw_init(struct msm_kms *kms)
 		dpu_kms->vbif[VBIF_RT] = NULL;
 		goto error;
 	}
-	dpu_kms->vbif[VBIF_NRT] = msm_ioremap(dpu_kms->pdev, "vbif_nrt", "vbif_nrt");
+	dpu_kms->vbif[VBIF_NRT] = msm_ioremap_quiet(dpu_kms->pdev, "vbif_nrt", "vbif_nrt");
 	if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) {
 		dpu_kms->vbif[VBIF_NRT] = NULL;
 		DPU_DEBUG("VBIF NRT is not defined");
 	}
 
-	dpu_kms->reg_dma = msm_ioremap(dpu_kms->pdev, "regdma", "regdma");
+	dpu_kms->reg_dma = msm_ioremap_quiet(dpu_kms->pdev, "regdma", "regdma");
 	if (IS_ERR(dpu_kms->reg_dma)) {
 		dpu_kms->reg_dma = NULL;
 		DPU_DEBUG("REG_DMA is not defined");
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index f6ce40bf3699..df4a3c6a49cd 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -120,8 +120,8 @@  struct clk *msm_clk_get(struct platform_device *pdev, const char *name)
 	return clk;
 }
 
-void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
-		const char *dbgname)
+void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
+			   const char *dbgname, bool quiet)
 {
 	struct resource *res;
 	unsigned long size;
@@ -133,7 +133,8 @@  void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 	if (!res) {
-		DRM_DEV_ERROR(&pdev->dev, "failed to get memory resource: %s\n", name);
+		if (!quiet)
+			DRM_DEV_ERROR(&pdev->dev, "failed to get memory resource: %s\n", name);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -141,7 +142,8 @@  void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
 
 	ptr = devm_ioremap(&pdev->dev, res->start, size);
 	if (!ptr) {
-		DRM_DEV_ERROR(&pdev->dev, "failed to ioremap: %s\n", name);
+		if (!quiet)
+			DRM_DEV_ERROR(&pdev->dev, "failed to ioremap: %s\n", name);
 		return ERR_PTR(-ENOMEM);
 	}
 
@@ -151,6 +153,18 @@  void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
 	return ptr;
 }
 
+void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
+			  const char *dbgname)
+{
+	return _msm_ioremap(pdev, name, dbgname, false);
+}
+
+void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
+				const char *dbgname)
+{
+	return _msm_ioremap(pdev, name, dbgname, true);
+}
+
 void msm_writel(u32 data, void __iomem *addr)
 {
 	if (reglog)
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index e2d6a6056418..2687f7a42c15 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -411,6 +411,8 @@  struct clk *msm_clk_bulk_get_clock(struct clk_bulk_data *bulk, int count,
 	const char *name);
 void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
 		const char *dbgname);
+void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
+		const char *dbgname);
 void msm_writel(u32 data, void __iomem *addr);
 u32 msm_readl(const void __iomem *addr);