linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge
@ 2022-02-20 19:52 José Expósito
  2022-02-20 21:36 ` Sam Ravnborg
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: José Expósito @ 2022-02-20 19:52 UTC (permalink / raw)
  To: tomba
  Cc: airlied, daniel, maxime, dri-devel, linux-kernel,
	José Expósito

Use the "drm_of_find_panel_or_bridge" function instead of a custom
version of it to reduce the boilerplate.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/gpu/drm/omapdrm/dss/output.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
index 7378e855c278..00af27589296 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -20,23 +20,18 @@
 int omapdss_device_init_output(struct omap_dss_device *out,
 			       struct drm_bridge *local_bridge)
 {
-	struct device_node *remote_node;
 	int ret;
 
-	remote_node = of_graph_get_remote_node(out->dev->of_node,
-					       out->of_port, 0);
-	if (!remote_node) {
-		dev_dbg(out->dev, "failed to find video sink\n");
-		return 0;
+	ret = drm_of_find_panel_or_bridge(out->dev->of_node, out->of_port, 0,
+					  &out->panel, &out->bridge);
+	if (ret) {
+		if (ret == -ENODEV) {
+			dev_dbg(out->dev, "failed to find video sink\n");
+			return 0;
+		}
+		goto error;
 	}
 
-	out->bridge = of_drm_find_bridge(remote_node);
-	out->panel = of_drm_find_panel(remote_node);
-	if (IS_ERR(out->panel))
-		out->panel = NULL;
-
-	of_node_put(remote_node);
-
 	if (out->panel) {
 		struct drm_bridge *bridge;
 
-- 
2.25.1


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

* Re: [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge
  2022-02-20 19:52 [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge José Expósito
@ 2022-02-20 21:36 ` Sam Ravnborg
  2022-03-03 18:11   ` José Expósito
  2022-02-21  2:01 ` kernel test robot
  2022-02-21 20:16 ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2022-02-20 21:36 UTC (permalink / raw)
  To: José Expósito; +Cc: tomba, airlied, linux-kernel, dri-devel, maxime

Hi José,

On Sun, Feb 20, 2022 at 08:52:12PM +0100, José Expósito wrote:
> Use the "drm_of_find_panel_or_bridge" function instead of a custom
> version of it to reduce the boilerplate.
Thanks for looking into this.


From the documentation of drm_of_find_panel_or_bridge():

 * This function is deprecated and should not be used in new drivers. Use
 * devm_drm_of_get_bridge() instead.

Are you OK to give this a second try with the above referenced function?

There is a good chance the deprecation happened after you looked into
this first, sometimes things moves fast in the drm sub-system.

	Sam

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

* Re: [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge
  2022-02-20 19:52 [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge José Expósito
  2022-02-20 21:36 ` Sam Ravnborg
@ 2022-02-21  2:01 ` kernel test robot
  2022-02-21 20:16 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-21  2:01 UTC (permalink / raw)
  To: José Expósito, tomba
  Cc: llvm, kbuild-all, airlied, linux-kernel, dri-devel, maxime,
	José Expósito

Hi "José,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v5.17-rc5 next-20220217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jos-Exp-sito/drm-omap-switch-to-drm_of_find_panel_or_bridge/20220221-035403
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: arm-randconfig-r022-20220220 (https://download.01.org/0day-ci/archive/20220221/202202210942.gGqf3SNb-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/9a465e2c1dba123efe08cf2f4a5ae11b07be4142
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jos-Exp-sito/drm-omap-switch-to-drm_of_find_panel_or_bridge/20220221-035403
        git checkout 9a465e2c1dba123efe08cf2f4a5ae11b07be4142
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/omapdrm/dss/output.c:25:8: error: implicit declaration of function 'drm_of_find_panel_or_bridge' [-Werror,-Wimplicit-function-declaration]
           ret = drm_of_find_panel_or_bridge(out->dev->of_node, out->of_port, 0,
                 ^
   1 error generated.


vim +/drm_of_find_panel_or_bridge +25 drivers/gpu/drm/omapdrm/dss/output.c

    19	
    20	int omapdss_device_init_output(struct omap_dss_device *out,
    21				       struct drm_bridge *local_bridge)
    22	{
    23		int ret;
    24	
  > 25		ret = drm_of_find_panel_or_bridge(out->dev->of_node, out->of_port, 0,
    26						  &out->panel, &out->bridge);
    27		if (ret) {
    28			if (ret == -ENODEV) {
    29				dev_dbg(out->dev, "failed to find video sink\n");
    30				return 0;
    31			}
    32			goto error;
    33		}
    34	
    35		if (out->panel) {
    36			struct drm_bridge *bridge;
    37	
    38			bridge = drm_panel_bridge_add(out->panel);
    39			if (IS_ERR(bridge)) {
    40				dev_err(out->dev,
    41					"unable to create panel bridge (%ld)\n",
    42					PTR_ERR(bridge));
    43				ret = PTR_ERR(bridge);
    44				goto error;
    45			}
    46	
    47			out->bridge = bridge;
    48		}
    49	
    50		if (local_bridge) {
    51			if (!out->bridge) {
    52				ret = -EPROBE_DEFER;
    53				goto error;
    54			}
    55	
    56			out->next_bridge = out->bridge;
    57			out->bridge = local_bridge;
    58		}
    59	
    60		if (!out->bridge) {
    61			ret = -EPROBE_DEFER;
    62			goto error;
    63		}
    64	
    65		return 0;
    66	
    67	error:
    68		omapdss_device_cleanup_output(out);
    69		return ret;
    70	}
    71	

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

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

* Re: [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge
  2022-02-20 19:52 [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge José Expósito
  2022-02-20 21:36 ` Sam Ravnborg
  2022-02-21  2:01 ` kernel test robot
@ 2022-02-21 20:16 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-21 20:16 UTC (permalink / raw)
  To: José Expósito, tomba
  Cc: kbuild-all, airlied, linux-kernel, dri-devel, maxime,
	José Expósito

Hi "José,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v5.17-rc5 next-20220217]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jos-Exp-sito/drm-omap-switch-to-drm_of_find_panel_or_bridge/20220221-035403
base:   git://anongit.freedesktop.org/drm/drm drm-next
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20220222/202202220451.VbtgFzSa-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
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
        # https://github.com/0day-ci/linux/commit/9a465e2c1dba123efe08cf2f4a5ae11b07be4142
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jos-Exp-sito/drm-omap-switch-to-drm_of_find_panel_or_bridge/20220221-035403
        git checkout 9a465e2c1dba123efe08cf2f4a5ae11b07be4142
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm SHELL=/bin/bash

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

All errors (new ones prefixed by >>):

   drivers/gpu/drm/omapdrm/dss/output.c: In function 'omapdss_device_init_output':
>> drivers/gpu/drm/omapdrm/dss/output.c:25:15: error: implicit declaration of function 'drm_of_find_panel_or_bridge' [-Werror=implicit-function-declaration]
      25 |         ret = drm_of_find_panel_or_bridge(out->dev->of_node, out->of_port, 0,
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/drm_of_find_panel_or_bridge +25 drivers/gpu/drm/omapdrm/dss/output.c

    19	
    20	int omapdss_device_init_output(struct omap_dss_device *out,
    21				       struct drm_bridge *local_bridge)
    22	{
    23		int ret;
    24	
  > 25		ret = drm_of_find_panel_or_bridge(out->dev->of_node, out->of_port, 0,
    26						  &out->panel, &out->bridge);
    27		if (ret) {
    28			if (ret == -ENODEV) {
    29				dev_dbg(out->dev, "failed to find video sink\n");
    30				return 0;
    31			}
    32			goto error;
    33		}
    34	
    35		if (out->panel) {
    36			struct drm_bridge *bridge;
    37	
    38			bridge = drm_panel_bridge_add(out->panel);
    39			if (IS_ERR(bridge)) {
    40				dev_err(out->dev,
    41					"unable to create panel bridge (%ld)\n",
    42					PTR_ERR(bridge));
    43				ret = PTR_ERR(bridge);
    44				goto error;
    45			}
    46	
    47			out->bridge = bridge;
    48		}
    49	
    50		if (local_bridge) {
    51			if (!out->bridge) {
    52				ret = -EPROBE_DEFER;
    53				goto error;
    54			}
    55	
    56			out->next_bridge = out->bridge;
    57			out->bridge = local_bridge;
    58		}
    59	
    60		if (!out->bridge) {
    61			ret = -EPROBE_DEFER;
    62			goto error;
    63		}
    64	
    65		return 0;
    66	
    67	error:
    68		omapdss_device_cleanup_output(out);
    69		return ret;
    70	}
    71	

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

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

* Re: [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge
  2022-02-20 21:36 ` Sam Ravnborg
@ 2022-03-03 18:11   ` José Expósito
  0 siblings, 0 replies; 5+ messages in thread
From: José Expósito @ 2022-03-03 18:11 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: tomba, airlied, linux-kernel, dri-devel, maxime

On Sun, Feb 20, 2022 at 10:36:35PM +0100, Sam Ravnborg wrote:
> Hi José,
> 
> On Sun, Feb 20, 2022 at 08:52:12PM +0100, José Expósito wrote:
> > Use the "drm_of_find_panel_or_bridge" function instead of a custom
> > version of it to reduce the boilerplate.
> Thanks for looking into this.

Hi Sam,

Thanks for your quick review, and sorry for the error in my patch.
I thought my toolchain was properly configured, but it wasn't and
I missed an include:

  #include <drm/drm_bridge.h>
 +#include <drm/drm_of.h>
  #include <drm/drm_panel.h>

I apologize for the mistake.

> From the documentation of drm_of_find_panel_or_bridge():
>
>  * This function is deprecated and should not be used in new drivers. Use
>  * devm_drm_of_get_bridge() instead.
>
> Are you OK to give this a second try with the above referenced function?
>
> There is a good chance the deprecation happened after you looked into
> this first, sometimes things moves fast in the drm sub-system.
>
>       Sam

I'm getting started in the DRM subsystem, so I might have overlooked
a function, but I think that in this case, since we need to store the
panel in "out->panel" we can not use "devm_drm_of_get_bridge".

"devm_drm_of_get_bridge" returns the bridge and I didn't find a way
to access the panel from it... But as I mentioned, I probably
overlooked the required function or pointer.

Thanks again for your review,
Jose

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

end of thread, other threads:[~2022-03-03 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-20 19:52 [PATCH] drm/omap: switch to drm_of_find_panel_or_bridge José Expósito
2022-02-20 21:36 ` Sam Ravnborg
2022-03-03 18:11   ` José Expósito
2022-02-21  2:01 ` kernel test robot
2022-02-21 20:16 ` kernel test robot

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