Message ID | 20200630120140.30733-1-andy.yan@rock-chips.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/connector: Add of_drm_find_connector | expand |
Hi Andy, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.8-rc3 next-20200701] [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/Andy-Yan/drm-connector-Add-of_drm_find_connector/20200701-151333 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7c30b859a947535f2213277e827d7ac7dcff9c84 config: x86_64-randconfig-a002-20200701 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project c8f1d442d0858f66fd4128fde6f67eb5202fa2b1) 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 x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 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/drm_connector.c:756:23: warning: no previous prototype for function 'of_drm_find_connector' [-Wmissing-prototypes] struct drm_connector *of_drm_find_connector(struct drm_device *dev, const struct device_node *np) ^ drivers/gpu/drm/drm_connector.c:756:1: note: declare 'static' if the function is not intended to be used outside of this translation unit struct drm_connector *of_drm_find_connector(struct drm_device *dev, const struct device_node *np) ^ static 1 warning generated. vim +/of_drm_find_connector +756 drivers/gpu/drm/drm_connector.c 745 746 #ifdef CONFIG_OF 747 /** 748 * of_drm_find_connector - look up a connector using a device tree node 749 * @np: device tree node of the connector 750 * 751 * 752 * Return: A pointer to the connector which match the specified device tree 753 * node or NULL if no panel matching the device tree node can be found, or 754 * -ENODEV: the device is not available (status != "okay" or "ok") 755 */ > 756 struct drm_connector *of_drm_find_connector(struct drm_device *dev, const struct device_node *np) 757 { 758 struct drm_connector *connector; 759 struct drm_connector_list_iter conn_iter; 760 761 if (!of_device_is_available(np)) 762 return ERR_PTR(-ENODEV); 763 764 drm_connector_list_iter_begin(dev, &conn_iter); 765 drm_for_each_connector_iter(connector, &conn_iter) { 766 if (connector->of_node == np) { 767 drm_connector_list_iter_end(&conn_iter); 768 return connector; 769 } 770 } 771 drm_connector_list_iter_end(&conn_iter); 772 773 return NULL; 774 } 775 EXPORT_SYMBOL(of_drm_find_connector); 776 #endif 777 778 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index d877ddc6dc57..516376cd1868 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -743,6 +743,39 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter) } EXPORT_SYMBOL(drm_connector_list_iter_end); +#ifdef CONFIG_OF +/** + * of_drm_find_connector - look up a connector using a device tree node + * @np: device tree node of the connector + * + * + * Return: A pointer to the connector which match the specified device tree + * node or NULL if no panel matching the device tree node can be found, or + * -ENODEV: the device is not available (status != "okay" or "ok") + */ +struct drm_connector *of_drm_find_connector(struct drm_device *dev, const struct device_node *np) +{ + struct drm_connector *connector; + struct drm_connector_list_iter conn_iter; + + if (!of_device_is_available(np)) + return ERR_PTR(-ENODEV); + + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + if (connector->of_node == np) { + drm_connector_list_iter_end(&conn_iter); + return connector; + } + } + drm_connector_list_iter_end(&conn_iter); + + return NULL; +} +EXPORT_SYMBOL(of_drm_find_connector); +#endif + + static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { { SubPixelUnknown, "Unknown" }, { SubPixelHorizontalRGB, "Horizontal RGB" }, diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index fd543d1db9b2..63932bfae84a 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1129,6 +1129,9 @@ struct drm_connector { /** @attr: sysfs attributes */ struct device_attribute *attr; + /** @of_node: device tree node */ + struct device_node *of_node; + /** * @head: *
Add a function to look up a connector by device tree node, like what of_drm_find_bridge/panel does. Signed-off-by: Andy Yan <andy.yan@rock-chips.com> --- drivers/gpu/drm/drm_connector.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 3 +++ 2 files changed, 36 insertions(+)