diff mbox series

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

Message ID 20230111130206.29974-2-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/backlight.h> in source files that need it. Some of
DRM's source code gets the backlight header via drm_crtc_helper.h
and <linux/fb.h>, which can leed to unnecessary recompilation. If
possible, do not include drm_crtc_helper.h any longer.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Christian König <christian.koenig@amd.com> # amd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c          | 2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
 drivers/gpu/drm/gma500/backlight.c                | 2 ++
 drivers/gpu/drm/radeon/radeon_acpi.c              | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

Comments

Sam Ravnborg Jan. 13, 2023, 3:09 p.m. UTC | #1
Hi Thomas,
On Wed, Jan 11, 2023 at 02:01:57PM +0100, Thomas Zimmermann wrote:
> Include <linux/backlight.h> in source files that need it. Some of
> DRM's source code gets the backlight header via drm_crtc_helper.h
> and <linux/fb.h>, which can leed to unnecessary recompilation. If
> possible, do not include drm_crtc_helper.h any longer.
Are you planning a clean-up of drm_crtc_helper.h later?
With a handful of forward it could losse all includes.

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Acked-by: Christian König <christian.koenig@amd.com> # amd
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c          | 2 +-
>  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
>  drivers/gpu/drm/gma500/backlight.c                | 2 ++
>  drivers/gpu/drm/radeon/radeon_acpi.c              | 2 +-
>  4 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> index 57b5e11446c6..f29c1d0ad4c1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
> @@ -24,6 +24,7 @@
>  
>  #include <linux/pci.h>
>  #include <linux/acpi.h>
> +#include <linux/backlight.h>
>  #include <linux/slab.h>
>  #include <linux/power_supply.h>
>  #include <linux/pm_runtime.h>
> @@ -31,7 +32,6 @@
>  #include <acpi/video.h>
>  #include <acpi/actbl.h>
>  
> -#include <drm/drm_crtc_helper.h>
>  #include "amdgpu.h"
>  #include "amdgpu_pm.h"
>  #include "amdgpu_display.h"
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 1b7f20a9d4ae..55a845eb0c6d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -67,6 +67,7 @@
>  #include "ivsrcid/ivsrcid_vislands30.h"
>  
>  #include "i2caux_interface.h"
> +#include <linux/backlight.h>
>  #include <linux/module.h>
>  #include <linux/moduleparam.h>
>  #include <linux/types.h>
> diff --git a/drivers/gpu/drm/gma500/backlight.c b/drivers/gpu/drm/gma500/backlight.c
> index 577a4987b193..8711a7a5b8da 100644
> --- a/drivers/gpu/drm/gma500/backlight.c
> +++ b/drivers/gpu/drm/gma500/backlight.c
> @@ -7,6 +7,8 @@
>   * Authors: Eric Knopp
>   */
>  
> +#include <linux/backlight.h>
> +
>  #include <acpi/video.h>
>  
>  #include "psb_drv.h"
> diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c
> index b603c0b77075..5771d1fcb073 100644
> --- a/drivers/gpu/drm/radeon/radeon_acpi.c
> +++ b/drivers/gpu/drm/radeon/radeon_acpi.c
> @@ -22,6 +22,7 @@
>   */
>  
>  #include <linux/acpi.h>
> +#include <linux/backlight.h>
>  #include <linux/pci.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/power_supply.h>
> @@ -30,7 +31,6 @@
>  #include <acpi/acpi_bus.h>
>  #include <acpi/video.h>
>  
> -#include <drm/drm_crtc_helper.h>
>  #include <drm/drm_probe_helper.h>
>  
>  #include "atom.h"
> -- 
> 2.39.0
Thomas Zimmermann Jan. 13, 2023, 3:38 p.m. UTC | #2
Hi

Am 13.01.23 um 16:09 schrieb Sam Ravnborg:
> Hi Thomas,
> On Wed, Jan 11, 2023 at 02:01:57PM +0100, Thomas Zimmermann wrote:
>> Include <linux/backlight.h> in source files that need it. Some of
>> DRM's source code gets the backlight header via drm_crtc_helper.h
>> and <linux/fb.h>, which can leed to unnecessary recompilation. If
>> possible, do not include drm_crtc_helper.h any longer.
> Are you planning a clean-up of drm_crtc_helper.h later?

> With a handful of forward it could losse all includes.

Indeed, looks like it. And a quick grep shows that many source files 
include this header. I keep it in mind to try to improve that.

> 
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Acked-by: Christian König <christian.koenig@amd.com> # amd
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

I've already merged the series. Maxime gave an a-b via IRC. Still thanks 
for reviewing.

Best regards
Thomas

>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c          | 2 +-
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 +
>>   drivers/gpu/drm/gma500/backlight.c                | 2 ++
>>   drivers/gpu/drm/radeon/radeon_acpi.c              | 2 +-
>>   4 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> index 57b5e11446c6..f29c1d0ad4c1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
>> @@ -24,6 +24,7 @@
>>   
>>   #include <linux/pci.h>
>>   #include <linux/acpi.h>
>> +#include <linux/backlight.h>
>>   #include <linux/slab.h>
>>   #include <linux/power_supply.h>
>>   #include <linux/pm_runtime.h>
>> @@ -31,7 +32,6 @@
>>   #include <acpi/video.h>
>>   #include <acpi/actbl.h>
>>   
>> -#include <drm/drm_crtc_helper.h>
>>   #include "amdgpu.h"
>>   #include "amdgpu_pm.h"
>>   #include "amdgpu_display.h"
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 1b7f20a9d4ae..55a845eb0c6d 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -67,6 +67,7 @@
>>   #include "ivsrcid/ivsrcid_vislands30.h"
>>   
>>   #include "i2caux_interface.h"
>> +#include <linux/backlight.h>
>>   #include <linux/module.h>
>>   #include <linux/moduleparam.h>
>>   #include <linux/types.h>
>> diff --git a/drivers/gpu/drm/gma500/backlight.c b/drivers/gpu/drm/gma500/backlight.c
>> index 577a4987b193..8711a7a5b8da 100644
>> --- a/drivers/gpu/drm/gma500/backlight.c
>> +++ b/drivers/gpu/drm/gma500/backlight.c
>> @@ -7,6 +7,8 @@
>>    * Authors: Eric Knopp
>>    */
>>   
>> +#include <linux/backlight.h>
>> +
>>   #include <acpi/video.h>
>>   
>>   #include "psb_drv.h"
>> diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c
>> index b603c0b77075..5771d1fcb073 100644
>> --- a/drivers/gpu/drm/radeon/radeon_acpi.c
>> +++ b/drivers/gpu/drm/radeon/radeon_acpi.c
>> @@ -22,6 +22,7 @@
>>    */
>>   
>>   #include <linux/acpi.h>
>> +#include <linux/backlight.h>
>>   #include <linux/pci.h>
>>   #include <linux/pm_runtime.h>
>>   #include <linux/power_supply.h>
>> @@ -30,7 +31,6 @@
>>   #include <acpi/acpi_bus.h>
>>   #include <acpi/video.h>
>>   
>> -#include <drm/drm_crtc_helper.h>
>>   #include <drm/drm_probe_helper.h>
>>   
>>   #include "atom.h"
>> -- 
>> 2.39.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 57b5e11446c6..f29c1d0ad4c1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -24,6 +24,7 @@ 
 
 #include <linux/pci.h>
 #include <linux/acpi.h>
+#include <linux/backlight.h>
 #include <linux/slab.h>
 #include <linux/power_supply.h>
 #include <linux/pm_runtime.h>
@@ -31,7 +32,6 @@ 
 #include <acpi/video.h>
 #include <acpi/actbl.h>
 
-#include <drm/drm_crtc_helper.h>
 #include "amdgpu.h"
 #include "amdgpu_pm.h"
 #include "amdgpu_display.h"
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1b7f20a9d4ae..55a845eb0c6d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -67,6 +67,7 @@ 
 #include "ivsrcid/ivsrcid_vislands30.h"
 
 #include "i2caux_interface.h"
+#include <linux/backlight.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/types.h>
diff --git a/drivers/gpu/drm/gma500/backlight.c b/drivers/gpu/drm/gma500/backlight.c
index 577a4987b193..8711a7a5b8da 100644
--- a/drivers/gpu/drm/gma500/backlight.c
+++ b/drivers/gpu/drm/gma500/backlight.c
@@ -7,6 +7,8 @@ 
  * Authors: Eric Knopp
  */
 
+#include <linux/backlight.h>
+
 #include <acpi/video.h>
 
 #include "psb_drv.h"
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c
index b603c0b77075..5771d1fcb073 100644
--- a/drivers/gpu/drm/radeon/radeon_acpi.c
+++ b/drivers/gpu/drm/radeon/radeon_acpi.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <linux/acpi.h>
+#include <linux/backlight.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <linux/power_supply.h>
@@ -30,7 +31,6 @@ 
 #include <acpi/acpi_bus.h>
 #include <acpi/video.h>
 
-#include <drm/drm_crtc_helper.h>
 #include <drm/drm_probe_helper.h>
 
 #include "atom.h"