fbdev: Use of_property_present() for testing DT property presence
PATCH 1/1 fbdev: Use of_property_present() for testing DT property presence
It is preferred to use typed property access functions (i.e. of_property_read_<type> functions) rather than low-level of_get_property/of_find_property functions for reading properties. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more.
--- drivers/video/fbdev/amba-clcd.c | 2 +- drivers/video/fbdev/bw2.c | 2 +- drivers/video/fbdev/cg3.c | 2 +- drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/video/fbdev/amba-clcd.c +1 -1
@@ -854,7 +854,7 @@ static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev) board->caps =CLCD_CAP_ALL ; board->check = clcdfb_check; board->decode = clcdfb_decode; -if (of_find_property (node,"memory-region" ,NULL )) { +if (of_property_present (node,"memory-region" )) { board->setup = clcdfb_of_vram_setup; board->mmap = clcdfb_of_vram_mmap; board->remove = clcdfb_of_vram_remove;
drivers/video/fbdev/bw2.c +1 -1
@@ -306,7 +306,7 @@ static int bw2_probe(struct platform_device *op)if (!par->regs) goto out_release_fb; -if (!of_find_property (dp,"width" ,NULL )) { +if (!of_property_present (dp,"width" )) { err =bw2_do_default_mode (par, info, &linebytes);if (err) goto out_unmap_regs;
drivers/video/fbdev/cg3.c +1 -1
@@ -393,7 +393,7 @@ static int cg3_probe(struct platform_device *op)cg3_blank (FB_BLANK_UNBLANK , info); -if (!of_find_property (dp,"width" ,NULL )) { +if (!of_property_present (dp,"width" )) { err =cg3_do_default_mode (par);if (err) goto out_unmap_screen;
drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c +1 -1
@@ -192,7 +192,7 @@ static int __init omapdss_boot_init(void)omapdss_walk_device (dss, true);for_each_available_child_of_node (dss, child) { -if (!of_find_property (child,"compatible" ,NULL )) +if (!of_property_present (child,"compatible" ))continue ;omapdss_walk_device (child, true);
Signature · 1 line
2.39.2
kernel test robot
build botI love your patch! Yet something to improve:
Hi Rob,
I love your patch! Yet something to improve:
[auto build test ERROR on drm-misc/drm-misc-next]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230310144729.1545943-1-robh%40kernel.org patch subject: [PATCH] fbdev: Use of_property_present() for testing DT property presence config: arm64-randconfig-r032-20230310 (https://download.01.org/0day-ci/archive/20230311/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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
# https://github.com/intel-lab-lkp/linux/commit/c013f4111f36b0b4327e7fbf46c0dd93399e9209
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 git checkout c013f4111f36b0b4327e7fbf46c0dd93399e9209
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/video/fbdev/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> drivers/video/fbdev/amba-clcd.c:857:6: error: call to undeclared function 'of_property_present'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (of_property_present(node, "memory-region")) {
^
drivers/video/fbdev/amba-clcd.c:857:6: note: did you mean 'fwnode_property_present'?
include/linux/property.h:59:6: note: 'fwnode_property_present' declared here
bool fwnode_property_present(const struct fwnode_handle *fwnode,
^1 error generated.
vim +/of_property_present +857 drivers/video/fbdev/amba-clcd.c
843
844 static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
845 {
846 struct clcd_board *board = devm_kzalloc(&dev->dev, sizeof(*board),
847 GFP_KERNEL);
848 struct device_node *node = dev->dev.of_node;
849
850 if (!board)
851 return NULL;
852
853 board->name = of_node_full_name(node);
854 board->caps = CLCD_CAP_ALL;
855 board->check = clcdfb_check;
856 board->decode = clcdfb_decode;
> 857 if (of_property_present(node, "memory-region")) { 858 board->setup = clcdfb_of_vram_setup;
859 board->mmap = clcdfb_of_vram_mmap;
860 board->remove = clcdfb_of_vram_remove;
861 } else {
862 board->setup = clcdfb_of_dma_setup;
863 board->mmap = clcdfb_of_dma_mmap;
864 board->remove = clcdfb_of_dma_remove;
865 }
866
867 return board;
868 }
869 #else
870 static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
871 {
872 return NULL;
873 }
874 #endif
875
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botI love your patch! Yet something to improve:
Hi Rob,
I love your patch! Yet something to improve:
[auto build test ERROR on drm-misc/drm-misc-next]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230310144729.1545943-1-robh%40kernel.org patch subject: [PATCH] fbdev: Use of_property_present() for testing DT property presence config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20230311/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.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/intel-lab-lkp/linux/commit/c013f4111f36b0b4327e7fbf46c0dd93399e9209
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 git checkout c013f4111f36b0b4327e7fbf46c0dd93399e9209
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/video/fbdev/amba-clcd.c: In function 'clcdfb_of_get_board':
>> drivers/video/fbdev/amba-clcd.c:857:13: error: implicit declaration of function 'of_property_present'; did you mean 'fwnode_property_present'? [-Werror=implicit-function-declaration]
857 | if (of_property_present(node, "memory-region")) {
| ^~~~~~~~~~~~~~~~~~~
| fwnode_property_presentcc1: some warnings being treated as errors
vim +857 drivers/video/fbdev/amba-clcd.c
843
844 static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
845 {
846 struct clcd_board *board = devm_kzalloc(&dev->dev, sizeof(*board),
847 GFP_KERNEL);
848 struct device_node *node = dev->dev.of_node;
849
850 if (!board)
851 return NULL;
852
853 board->name = of_node_full_name(node);
854 board->caps = CLCD_CAP_ALL;
855 board->check = clcdfb_check;
856 board->decode = clcdfb_decode;
> 857 if (of_property_present(node, "memory-region")) { 858 board->setup = clcdfb_of_vram_setup;
859 board->mmap = clcdfb_of_vram_mmap;
860 board->remove = clcdfb_of_vram_remove;
861 } else {
862 board->setup = clcdfb_of_dma_setup;
863 board->mmap = clcdfb_of_dma_mmap;
864 board->remove = clcdfb_of_dma_remove;
865 }
866
867 return board;
868 }
869 #else
870 static struct clcd_board *clcdfb_of_get_board(struct amba_device *dev)
871 {
872 return NULL;
873 }
874 #endif
875
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
Quoted 16 lines · kernel test robot
Hi Rob,
I love your patch! Yet something to improve:
[auto build test ERROR on drm-misc/drm-misc-next]
[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#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230310144729.1545943-1-robh%40kernel.org patch subject: [PATCH] fbdev: Use of_property_present() for testing DT property presence config: arm64-randconfig-r032-20230310 (https://download.01.org/0day-ci/archive/20230311/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
Quoted 9 lines
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
# https://github.com/intel-lab-lkp/linux/commit/c013f4111f36b0b4327e7fbf46c0dd93399e9209
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 git checkoutc013f4111f36b0b4327e7fbf46c0dd93399e9209
Looks like this patch was applied to drm-next which was/is based on v6.2-rc6. This patch is dependent on a change in v6.3-rc1.
Rob
Quoted 27 lines · Rob Herring
Quoted 16 lines · kernel test robot
Hi Rob,
I love your patch! Yet something to improve:
[auto build test ERROR on drm-misc/drm-misc-next]
[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#_base_tree_information]url: https://github.com/intel-lab-lkp/linux/commits/Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/20230310144729.1545943-1-robh%40kernel.org patch subject: [PATCH] fbdev: Use of_property_present() for testing DT property presence config: arm64-randconfig-r032-20230310 (https://download.01.org/0day-ci/archive/20230311/[email protected]/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)Quoted 9 lines
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
# https://github.com/intel-lab-lkp/linux/commit/c013f4111f36b0b4327e7fbf46c0dd93399e9209
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Rob-Herring/fbdev-Use-of_property_present-for-testing-DT-property-presence/20230310-225754 git checkoutc013f4111f36b0b4327e7fbf46c0dd93399e9209
Quoted 2 lines
Looks like this patch was applied to drm-next which was/is based on v6.2-rc6. This patch is dependent on a change in v6.3-rc1.
I've applied that patch now to fbdev git tree. Will drop it again in case it conflicts somewhere.
Thanks!
Helge