diff mbox series

[v4,20/20] backlight: make of_find_backlight_by_node() static

Message ID 20200703184546.144664-21-sam@ravnborg.org (mailing list archive)
State New, archived
Headers show
Series backlight: backlight updates | expand

Commit Message

Sam Ravnborg July 3, 2020, 6:45 p.m. UTC
There are no external users of of_find_backlight_by_node().
Make it static so we keep it that way.

v2:
  - drop EXPORT of of_find_backlight_by_node

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
---
 drivers/video/backlight/backlight.c | 23 +++++++++--------------
 include/linux/backlight.h           | 10 ----------
 2 files changed, 9 insertions(+), 24 deletions(-)

Comments

kernel test robot July 7, 2020, 9:46 p.m. UTC | #1
Hi Sam,

I love your patch! Yet something to improve:

[auto build test ERROR on backlight/for-backlight-next]
[also build test ERROR on tegra-drm/drm/tegra/for-next pwm/for-next linus/master v5.8-rc4]
[cannot apply to next-20200707]
[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/Sam-Ravnborg/backlight-backlight-updates/20200704-024949
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git for-backlight-next
config: arm-randconfig-r034-20200707 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

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/tilcdc/tilcdc_panel.c: In function 'panel_probe':
>> drivers/gpu/drm/tilcdc/tilcdc_panel.c:320:26: error: implicit declaration of function 'of_find_backlight_by_node'; did you mean 'of_find_i2c_adapter_by_node'? [-Werror=implicit-function-declaration]
     320 |   panel_mod->backlight = of_find_backlight_by_node(bl_node);
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~
         |                          of_find_i2c_adapter_by_node
>> drivers/gpu/drm/tilcdc/tilcdc_panel.c:320:24: error: assignment to 'struct backlight_device *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
     320 |   panel_mod->backlight = of_find_backlight_by_node(bl_node);
         |                        ^
   cc1: all warnings being treated as errors

vim +320 drivers/gpu/drm/tilcdc/tilcdc_panel.c

0d4bbaf9f3e5b9 Rob Clark        2012-12-18  299  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  300  static int panel_probe(struct platform_device *pdev)
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  301  {
18c44db8cafe9b Ezequiel Garcia  2014-09-02  302  	struct device_node *bl_node, *node = pdev->dev.of_node;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  303  	struct panel_module *panel_mod;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  304  	struct tilcdc_module *mod;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  305  	struct pinctrl *pinctrl;
12778fc14301cf Ezequiel Garcia  2014-09-02  306  	int ret;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  307  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  308  	/* bail out early if no DT data: */
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  309  	if (!node) {
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  310  		dev_err(&pdev->dev, "device-tree data is missing\n");
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  311  		return -ENXIO;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  312  	}
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  313  
971645d1fd734b Ezequiel Garcia  2014-09-02  314  	panel_mod = devm_kzalloc(&pdev->dev, sizeof(*panel_mod), GFP_KERNEL);
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  315  	if (!panel_mod)
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  316  		return -ENOMEM;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  317  
18c44db8cafe9b Ezequiel Garcia  2014-09-02  318  	bl_node = of_parse_phandle(node, "backlight", 0);
18c44db8cafe9b Ezequiel Garcia  2014-09-02  319  	if (bl_node) {
18c44db8cafe9b Ezequiel Garcia  2014-09-02 @320  		panel_mod->backlight = of_find_backlight_by_node(bl_node);
18c44db8cafe9b Ezequiel Garcia  2014-09-02  321  		of_node_put(bl_node);
18c44db8cafe9b Ezequiel Garcia  2014-09-02  322  
18c44db8cafe9b Ezequiel Garcia  2014-09-02  323  		if (!panel_mod->backlight)
18c44db8cafe9b Ezequiel Garcia  2014-09-02  324  			return -EPROBE_DEFER;
18c44db8cafe9b Ezequiel Garcia  2014-09-02  325  
18c44db8cafe9b Ezequiel Garcia  2014-09-02  326  		dev_info(&pdev->dev, "found backlight\n");
18c44db8cafe9b Ezequiel Garcia  2014-09-02  327  	}
18c44db8cafe9b Ezequiel Garcia  2014-09-02  328  
26a5bd26499fba Uwe Kleine-König 2015-02-11  329  	panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
26a5bd26499fba Uwe Kleine-König 2015-02-11  330  							 GPIOD_OUT_LOW);
d898ce03675fc0 Ezequiel Garcia  2014-09-02  331  	if (IS_ERR(panel_mod->enable_gpio)) {
d898ce03675fc0 Ezequiel Garcia  2014-09-02  332  		ret = PTR_ERR(panel_mod->enable_gpio);
d898ce03675fc0 Ezequiel Garcia  2014-09-02  333  		dev_err(&pdev->dev, "failed to request enable GPIO\n");
d898ce03675fc0 Ezequiel Garcia  2014-09-02  334  		goto fail_backlight;
d898ce03675fc0 Ezequiel Garcia  2014-09-02  335  	}
d898ce03675fc0 Ezequiel Garcia  2014-09-02  336  
26a5bd26499fba Uwe Kleine-König 2015-02-11  337  	if (panel_mod->enable_gpio)
d898ce03675fc0 Ezequiel Garcia  2014-09-02  338  		dev_info(&pdev->dev, "found enable GPIO\n");
d898ce03675fc0 Ezequiel Garcia  2014-09-02  339  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  340  	mod = &panel_mod->base;
7cdcce9f8b4c15 Guido Martínez   2014-06-17  341  	pdev->dev.platform_data = mod;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  342  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  343  	tilcdc_module_init(mod, "panel", &panel_module_ops);
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  344  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  345  	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  346  	if (IS_ERR(pinctrl))
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  347  		dev_warn(&pdev->dev, "pins are not configured\n");
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  348  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  349  	panel_mod->timings = of_get_display_timings(node);
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  350  	if (!panel_mod->timings) {
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  351  		dev_err(&pdev->dev, "could not get panel timings\n");
12778fc14301cf Ezequiel Garcia  2014-09-02  352  		ret = -EINVAL;
7cdcce9f8b4c15 Guido Martínez   2014-06-17  353  		goto fail_free;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  354  	}
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  355  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  356  	panel_mod->info = of_get_panel_info(node);
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  357  	if (!panel_mod->info) {
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  358  		dev_err(&pdev->dev, "could not get panel info\n");
12778fc14301cf Ezequiel Garcia  2014-09-02  359  		ret = -EINVAL;
7cdcce9f8b4c15 Guido Martínez   2014-06-17  360  		goto fail_timings;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  361  	}
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  362  
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  363  	return 0;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  364  
7cdcce9f8b4c15 Guido Martínez   2014-06-17  365  fail_timings:
7cdcce9f8b4c15 Guido Martínez   2014-06-17  366  	display_timings_release(panel_mod->timings);
7cdcce9f8b4c15 Guido Martínez   2014-06-17  367  
7cdcce9f8b4c15 Guido Martínez   2014-06-17  368  fail_free:
7cdcce9f8b4c15 Guido Martínez   2014-06-17  369  	tilcdc_module_cleanup(mod);
d898ce03675fc0 Ezequiel Garcia  2014-09-02  370  
d898ce03675fc0 Ezequiel Garcia  2014-09-02  371  fail_backlight:
18c44db8cafe9b Ezequiel Garcia  2014-09-02  372  	if (panel_mod->backlight)
18c44db8cafe9b Ezequiel Garcia  2014-09-02  373  		put_device(&panel_mod->backlight->dev);
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  374  	return ret;
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  375  }
0d4bbaf9f3e5b9 Rob Clark        2012-12-18  376  

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

Patch

diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 06f4da3c58e1..ff84e6607486 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -649,19 +649,9 @@  static int of_parent_match(struct device *dev, const void *data)
 	return dev->parent && dev->parent->of_node == data;
 }
 
-/**
- * of_find_backlight_by_node() - find backlight device by device-tree node
- * @node: device-tree node of the backlight device
- *
- * Returns a pointer to the backlight device corresponding to the given DT
- * node or NULL if no such backlight device exists or if the device hasn't
- * been probed yet.
- *
- * This function obtains a reference on the backlight device and it is the
- * caller's responsibility to drop the reference by calling put_device() on
- * the backlight device's .dev field.
- */
-struct backlight_device *of_find_backlight_by_node(struct device_node *node)
+/* Find backlight device by device-tree node */
+static struct backlight_device *
+of_find_backlight_by_node(struct device_node *node)
 {
 	struct device *dev;
 
@@ -669,7 +659,12 @@  struct backlight_device *of_find_backlight_by_node(struct device_node *node)
 
 	return dev ? to_backlight_device(dev) : NULL;
 }
-EXPORT_SYMBOL(of_find_backlight_by_node);
+#else
+static struct backlight_device *
+of_find_backlight_by_node(struct device_node *node)
+{
+	return NULL;
+}
 #endif
 
 static struct backlight_device *of_find_backlight(struct device *dev)
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 8b43fd90d84a..fa443899b4ee 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -466,16 +466,6 @@  static inline void * bl_get_data(struct backlight_device *bl_dev)
 	return dev_get_drvdata(&bl_dev->dev);
 }
 
-#ifdef CONFIG_OF
-struct backlight_device *of_find_backlight_by_node(struct device_node *node);
-#else
-static inline struct backlight_device *
-of_find_backlight_by_node(struct device_node *node)
-{
-	return NULL;
-}
-#endif
-
 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 struct backlight_device *devm_of_find_backlight(struct device *dev);
 #else