diff mbox series

drm/rockchip: defined struct rockchip_dp_dt_ids[] under CONFIG_OF

Message ID 20210602080212.4992-1-jrdr.linux@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/rockchip: defined struct rockchip_dp_dt_ids[] under CONFIG_OF | expand

Commit Message

Souptick Joarder June 2, 2021, 8:02 a.m. UTC
Kernel test robot throws below warning when CONFIG_OF
is not set.

>> 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.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Robin Murphy June 2, 2021, 10:07 a.m. UTC | #1
On 2021-06-02 09:02, Souptick Joarder wrote:
> Kernel test robot throws below warning when CONFIG_OF
> is not set.
> 
>>> 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.

> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> ---
>   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> index ade2327a10e2..9b79ebaeae97 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -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,
>
Souptick Joarder June 7, 2021, 6:40 p.m. UTC | #2
On Wed, Jun 2, 2021 at 3:37 PM Robin Murphy <robin.murphy@arm.com> wrote:
>
> On 2021-06-02 09:02, Souptick Joarder wrote:
> > Kernel test robot throws below warning when CONFIG_OF
> > is not set.
> >
> >>> 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.

Ok. Will remove of_match_ptr().
>
> Robin.
>
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > ---
> >   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 2 ++
> >   1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> > index ade2327a10e2..9b79ebaeae97 100644
> > --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> > +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> > @@ -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,
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index ade2327a10e2..9b79ebaeae97 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -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,