Skip to contentSkip to conversation

drm/rockchip: defined struct rockchip_dp_dt_ids[] under CONFIG_OF

PATCH In review Souptick Joarder 2 participants 3 messages Jun 2, 2021 – Jun 7, 2021

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

PATCH 1/1 drm/rockchip: defined struct rockchip_dp_dt_ids[] under CONFIG_OF

Kernel test robot throws below warning when CONFIG_OF is not set.

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:457:34:

warning: unused variable 'rockchip_dp_dt_ids' [-Wunused-const-variable]
static const struct of_device_id rockchip_dp_dt_ids[] = {

Fixed it by defining rockchip_dp_dt_ids[] under CONFIG_OF.

---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +2 -0
index ade2327a10e2..9b79ebaeae97 100644
@@ -454,12 +454,14 @@ static const struct rockchip_dp_chip_data rk3288_dp = {
 	.chip_type = RK3288_DP,
 };
 
+#ifdef CONFIG_OF
 static const struct of_device_id rockchip_dp_dt_ids[] = {
 	{.compatible = "rockchip,rk3288-dp", .data = &rk3288_dp },
 	{.compatible = "rockchip,rk3399-edp", .data = &rk3399_edp },
 	{}
 };
 MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
+#endif
 
 struct platform_driver rockchip_dp_driver = {
 	.probe = rockchip_dp_probe,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 8 lines · Souptick Joarder

Kernel test robot throws below warning when CONFIG_OF is not set.

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:457:34:

warning: unused variable 'rockchip_dp_dt_ids' [-Wunused-const-variable]

    static const struct of_device_id rockchip_dp_dt_ids[] = {

Fixed it by defining rockchip_dp_dt_ids[] under CONFIG_OF.

I think the __maybe_unused annotation is generally preferred over #ifdefs these days. However, since these drivers only work with devicetree anyway, it probably makes more sense to just remove the of_match_ptr() uses which lead to these warnings in the first place.

Robin.

Quoted 26 lines
---
  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +2 -0
index ade2327a10e2..9b79ebaeae97 100644
@@ -454,12 +454,14 @@ static const struct rockchip_dp_chip_data rk3288_dp = {
  	.chip_type = RK3288_DP,
  };
 
+#ifdef CONFIG_OF
  static const struct of_device_id rockchip_dp_dt_ids[] = {
  	{.compatible = "rockchip,rk3288-dp", .data = &rk3288_dp },
  	{.compatible = "rockchip,rk3399-edp", .data = &rk3399_edp },
  	{}
  };
  MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
+#endif
 
  struct platform_driver rockchip_dp_driver = {
  	.probe = rockchip_dp_probe,
#2 lore raw
Quoted 9 lines · Robin Murphy
Quoted 7 lines · Souptick Joarder

Kernel test robot throws below warning when CONFIG_OF is not set.

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c:457:34:

warning: unused variable 'rockchip_dp_dt_ids' [-Wunused-const-variable]

    static const struct of_device_id rockchip_dp_dt_ids[] = {
Quoted 6 lines
Quoted 1 line

Fixed it by defining rockchip_dp_dt_ids[] under CONFIG_OF.

I think the __maybe_unused annotation is generally preferred over #ifdefs these days. However, since these drivers only work with devicetree anyway, it probably makes more sense to just remove the of_match_ptr() uses which lead to these warnings in the first place.

Ok. Will remove of_match_ptr().

Quoted 29 lines

Robin.

Quoted 26 lines
---
  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +2 -0
index ade2327a10e2..9b79ebaeae97 100644
@@ -454,12 +454,14 @@ static const struct rockchip_dp_chip_data rk3288_dp = {
      .chip_type = RK3288_DP,
  };
 
+#ifdef CONFIG_OF
  static const struct of_device_id rockchip_dp_dt_ids[] = {
      {.compatible = "rockchip,rk3288-dp", .data = &rk3288_dp },
      {.compatible = "rockchip,rk3399-edp", .data = &rk3399_edp },
      {}
  };
  MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
+#endif
 
  struct platform_driver rockchip_dp_driver = {
      .probe = rockchip_dp_probe,