Skip to contentSkip to conversation

drm/omap: switch to drm_of_find_panel_or_bridge

PATCH In review José Expósito 3 participants 5 messages Feb 20, 2022 – Mar 3, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/omap: switch to drm_of_find_panel_or_bridge

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

---
 drivers/gpu/drm/omapdrm/dss/output.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
drivers/gpu/drm/omapdrm/dss/output.c +8 -13
index 7378e855c278..00af27589296 100644
@@ -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;
 
Signature · 1 line
2.25.1
#1 lore raw

Hi José,

Quoted 2 lines · José Expósito

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

#2 lore raw
Quoted 6 lines · Sam Ravnborg

Hi José,

Quoted 2 lines · José Expósito

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.

Quoted 11 lines

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

#3 lore raw
In reply to José Expósito
Thank you for the patch! Yet something to improve:

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/[email protected]/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

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/[email protected]

#4 lore raw
In reply to José Expósito
Thank you for the patch! Yet something to improve:

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/[email protected]/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

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/[email protected]