diff mbox series

[v2,02/10] drm: Include <linux/of.h> where needed

Message ID 20230111130206.29974-3-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Do not include <linux/fb.h> unnecessarily | expand

Commit Message

Thomas Zimmermann Jan. 11, 2023, 1:01 p.m. UTC
Include <linux/of.h> in source files that need it. Some of DRM's
source code gets OF header via drm_crtc_helper.h and <linux/fb.h>,
which can leed to unnecessary recompilation.

In drm_modes.c, add a comment on the reason for still including
<linux/fb.h>. The header file is required to get KHZ2PICOS(). The
macro is part of the UAPI headers, so it cannot be moved to a less
prominent location.

v2:
	* include <linux/of.h> in komeda_drv.c (kernel test robot)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 1 +
 drivers/gpu/drm/drm_modes.c                     | 5 +++--
 drivers/gpu/drm/panel/panel-ronbo-rb070d30.c    | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

Comments

Liviu Dudau Jan. 11, 2023, 1:15 p.m. UTC | #1
On Wed, Jan 11, 2023 at 02:01:58PM +0100, Thomas Zimmermann wrote:
> Include <linux/of.h> in source files that need it. Some of DRM's
> source code gets OF header via drm_crtc_helper.h and <linux/fb.h>,
> which can leed to unnecessary recompilation.
> 
> In drm_modes.c, add a comment on the reason for still including
> <linux/fb.h>. The header file is required to get KHZ2PICOS(). The
> macro is part of the UAPI headers, so it cannot be moved to a less
> prominent location.
> 
> v2:
> 	* include <linux/of.h> in komeda_drv.c (kernel test robot)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 1 +
>  drivers/gpu/drm/drm_modes.c                     | 5 +++--
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c    | 1 +
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> index 3f4e719eebd8..28f76e07dd95 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> @@ -6,6 +6,7 @@
>   */
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/component.h>
>  #include <linux/pm_runtime.h>

For komeda: Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu

> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index be030f4a5311..40d482a01178 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -31,10 +31,11 @@
>   */
>  
>  #include <linux/ctype.h>
> +#include <linux/export.h>
> +#include <linux/fb.h> /* for KHZ2PICOS() */
>  #include <linux/list.h>
>  #include <linux/list_sort.h>
> -#include <linux/export.h>
> -#include <linux/fb.h>
> +#include <linux/of.h>
>  
>  #include <video/of_display_timing.h>
>  #include <video/of_videomode.h>
> diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> index a8a98c91b13c..866d1bf5530e 100644
> --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> @@ -15,6 +15,7 @@
>  #include <linux/kernel.h>
>  #include <linux/media-bus-format.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  
>  #include <linux/gpio/consumer.h>
>  #include <linux/regulator/consumer.h>
> -- 
> 2.39.0
>
Ville Syrjälä Jan. 11, 2023, 4:08 p.m. UTC | #2
On Wed, Jan 11, 2023 at 02:01:58PM +0100, Thomas Zimmermann wrote:
> Include <linux/of.h> in source files that need it. Some of DRM's
> source code gets OF header via drm_crtc_helper.h and <linux/fb.h>,
> which can leed to unnecessary recompilation.
> 
> In drm_modes.c, add a comment on the reason for still including
> <linux/fb.h>. The header file is required to get KHZ2PICOS(). The
> macro is part of the UAPI headers, so it cannot be moved to a less
> prominent location.

I never liked that KHZ2PICOS() thing in there. Maybe we should
just nuke it and see if anyone notices?

> 
> v2:
> 	* include <linux/of.h> in komeda_drv.c (kernel test robot)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 1 +
>  drivers/gpu/drm/drm_modes.c                     | 5 +++--
>  drivers/gpu/drm/panel/panel-ronbo-rb070d30.c    | 1 +
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> index 3f4e719eebd8..28f76e07dd95 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> @@ -6,6 +6,7 @@
>   */
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> +#include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/component.h>
>  #include <linux/pm_runtime.h>
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index be030f4a5311..40d482a01178 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -31,10 +31,11 @@
>   */
>  
>  #include <linux/ctype.h>
> +#include <linux/export.h>
> +#include <linux/fb.h> /* for KHZ2PICOS() */
>  #include <linux/list.h>
>  #include <linux/list_sort.h>
> -#include <linux/export.h>
> -#include <linux/fb.h>
> +#include <linux/of.h>
>  
>  #include <video/of_display_timing.h>
>  #include <video/of_videomode.h>
> diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> index a8a98c91b13c..866d1bf5530e 100644
> --- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> +++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
> @@ -15,6 +15,7 @@
>  #include <linux/kernel.h>
>  #include <linux/media-bus-format.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
>  
>  #include <linux/gpio/consumer.h>
>  #include <linux/regulator/consumer.h>
> -- 
> 2.39.0
Sam Ravnborg Jan. 13, 2023, 3:11 p.m. UTC | #3
Hi Ville,
On Wed, Jan 11, 2023 at 06:08:42PM +0200, Ville Syrjälä wrote:
> On Wed, Jan 11, 2023 at 02:01:58PM +0100, Thomas Zimmermann wrote:
> > Include <linux/of.h> in source files that need it. Some of DRM's
> > source code gets OF header via drm_crtc_helper.h and <linux/fb.h>,
> > which can leed to unnecessary recompilation.
> > 
> > In drm_modes.c, add a comment on the reason for still including
> > <linux/fb.h>. The header file is required to get KHZ2PICOS(). The
> > macro is part of the UAPI headers, so it cannot be moved to a less
> > prominent location.
> 
> I never liked that KHZ2PICOS() thing in there. Maybe we should
> just nuke it and see if anyone notices?
https://github.com/search?q=KHZ2PICOS&type=code

tells me that it will be noticed.
So it is part of the UAPI

	Sam
Ville Syrjälä Jan. 13, 2023, 3:47 p.m. UTC | #4
On Fri, Jan 13, 2023 at 04:11:48PM +0100, Sam Ravnborg wrote:
> Hi Ville,
> On Wed, Jan 11, 2023 at 06:08:42PM +0200, Ville Syrjälä wrote:
> > On Wed, Jan 11, 2023 at 02:01:58PM +0100, Thomas Zimmermann wrote:
> > > Include <linux/of.h> in source files that need it. Some of DRM's
> > > source code gets OF header via drm_crtc_helper.h and <linux/fb.h>,
> > > which can leed to unnecessary recompilation.
> > > 
> > > In drm_modes.c, add a comment on the reason for still including
> > > <linux/fb.h>. The header file is required to get KHZ2PICOS(). The
> > > macro is part of the UAPI headers, so it cannot be moved to a less
> > > prominent location.
> > 
> > I never liked that KHZ2PICOS() thing in there. Maybe we should
> > just nuke it and see if anyone notices?
> https://github.com/search?q=KHZ2PICOS&type=code

No idea what relevance any of those have.

> 
> tells me that it will be noticed.
> So it is part of the UAPI

The only thing it does it potentially mistake some modes for being
equal when they are not. So basically just second guessing what the
driver/hardware is actually capable of doing.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index 3f4e719eebd8..28f76e07dd95 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -6,6 +6,7 @@ 
  */
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/component.h>
 #include <linux/pm_runtime.h>
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index be030f4a5311..40d482a01178 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -31,10 +31,11 @@ 
  */
 
 #include <linux/ctype.h>
+#include <linux/export.h>
+#include <linux/fb.h> /* for KHZ2PICOS() */
 #include <linux/list.h>
 #include <linux/list_sort.h>
-#include <linux/export.h>
-#include <linux/fb.h>
+#include <linux/of.h>
 
 #include <video/of_display_timing.h>
 #include <video/of_videomode.h>
diff --git a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
index a8a98c91b13c..866d1bf5530e 100644
--- a/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
+++ b/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
@@ -15,6 +15,7 @@ 
 #include <linux/kernel.h>
 #include <linux/media-bus-format.h>
 #include <linux/module.h>
+#include <linux/of.h>
 
 #include <linux/gpio/consumer.h>
 #include <linux/regulator/consumer.h>