Message ID | 20240416121838.95427-3-masahiroy@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | kbuild: replace $(srctree)/$(src) with $(src) in Makefiles | expand |
On Tue 16 Apr 2024 21:18:36 GMT, Masahiro Yamada wrote: > The include directive with the double-quote form, #include "...", > first searches for the specified header in the directory containing > the source file. > > If all local headers are included using the double-quote form instead > of the angle bracket form, there is no need to add the local directory > to the header search path. > > drivers/gpu/drm/imagination and drivers/net/ethernet/aquantia/atlantic > use only the double-quote form for including the local headers, and > there are no generated sources or headers in their directories. Hence, > the local header search path is unneeded. > > The same applies to arch/loongarch/kvm/ because TRACE_INCLUDE_PATH is > relative to include/trace/. > > I guess there exist more Makefiles with unnecessary header inclusion > paths (and more cases where it is possible to delete the header search > path by replacing #include <...> with #include "..."), but I do not have > an easy way to detect it. > > These are unneeded inclusion paths that I happened to find. > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > --- > > arch/loongarch/kvm/Makefile | 2 -- > drivers/gpu/drm/imagination/Makefile | 2 -- > drivers/net/ethernet/aquantia/atlantic/Makefile | 2 -- > 3 files changed, 6 deletions(-) > > diff --git a/arch/loongarch/kvm/Makefile b/arch/loongarch/kvm/Makefile > index 244467d7792a..7a0108a721c1 100644 > --- a/arch/loongarch/kvm/Makefile > +++ b/arch/loongarch/kvm/Makefile > @@ -3,8 +3,6 @@ > # Makefile for LoongArch KVM support > # > > -ccflags-y += -I $(srctree)/$(src) > - > include $(srctree)/virt/kvm/Makefile.kvm > > obj-$(CONFIG_KVM) += kvm.o > diff --git a/drivers/gpu/drm/imagination/Makefile b/drivers/gpu/drm/imagination/Makefile > index ec6db8e9b403..3d9d4d40fb80 100644 > --- a/drivers/gpu/drm/imagination/Makefile > +++ b/drivers/gpu/drm/imagination/Makefile > @@ -1,8 +1,6 @@ > # SPDX-License-Identifier: GPL-2.0-only OR MIT > # Copyright (c) 2023 Imagination Technologies Ltd. > > -subdir-ccflags-y := -I$(srctree)/$(src) > - > powervr-y := \ > pvr_ccb.o \ > pvr_cccb.o \ > diff --git a/drivers/net/ethernet/aquantia/atlantic/Makefile b/drivers/net/ethernet/aquantia/atlantic/Makefile > index 8ebcc68e807f..268a055086c4 100644 > --- a/drivers/net/ethernet/aquantia/atlantic/Makefile > +++ b/drivers/net/ethernet/aquantia/atlantic/Makefile > @@ -8,8 +8,6 @@ > > obj-$(CONFIG_AQTION) += atlantic.o > > -ccflags-y += -I$(srctree)/$(src) > - > atlantic-objs := aq_main.o \ > aq_nic.o \ > aq_pci_func.o \ I'm afraid drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c, .../hw_atl2/hw_atl2.c and .../hw_atl2/hw_atl2_utills{,_fw}.[ch] need to be adjusted first. Except for the atlantic related patch diff: Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
On Sat, Apr 20, 2024 at 12:07 AM Nicolas Schier <nicolas@fjasle.eu> wrote: > > On Tue 16 Apr 2024 21:18:36 GMT, Masahiro Yamada wrote: > > The include directive with the double-quote form, #include "...", > > first searches for the specified header in the directory containing > > the source file. > > > > If all local headers are included using the double-quote form instead > > of the angle bracket form, there is no need to add the local directory > > to the header search path. > > > > drivers/gpu/drm/imagination and drivers/net/ethernet/aquantia/atlantic > > use only the double-quote form for including the local headers, and > > there are no generated sources or headers in their directories. Hence, > > the local header search path is unneeded. > > > > The same applies to arch/loongarch/kvm/ because TRACE_INCLUDE_PATH is > > relative to include/trace/. > > > > I guess there exist more Makefiles with unnecessary header inclusion > > paths (and more cases where it is possible to delete the header search > > path by replacing #include <...> with #include "..."), but I do not have > > an easy way to detect it. > > > > These are unneeded inclusion paths that I happened to find. > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> > > --- > > > > arch/loongarch/kvm/Makefile | 2 -- > > drivers/gpu/drm/imagination/Makefile | 2 -- > > drivers/net/ethernet/aquantia/atlantic/Makefile | 2 -- > > 3 files changed, 6 deletions(-) > > > > diff --git a/arch/loongarch/kvm/Makefile b/arch/loongarch/kvm/Makefile > > index 244467d7792a..7a0108a721c1 100644 > > --- a/arch/loongarch/kvm/Makefile > > +++ b/arch/loongarch/kvm/Makefile > > @@ -3,8 +3,6 @@ > > # Makefile for LoongArch KVM support > > # > > > > -ccflags-y += -I $(srctree)/$(src) > > - > > include $(srctree)/virt/kvm/Makefile.kvm > > > > obj-$(CONFIG_KVM) += kvm.o > > diff --git a/drivers/gpu/drm/imagination/Makefile b/drivers/gpu/drm/imagination/Makefile > > index ec6db8e9b403..3d9d4d40fb80 100644 > > --- a/drivers/gpu/drm/imagination/Makefile > > +++ b/drivers/gpu/drm/imagination/Makefile > > @@ -1,8 +1,6 @@ > > # SPDX-License-Identifier: GPL-2.0-only OR MIT > > # Copyright (c) 2023 Imagination Technologies Ltd. > > > > -subdir-ccflags-y := -I$(srctree)/$(src) > > - > > powervr-y := \ > > pvr_ccb.o \ > > pvr_cccb.o \ > > diff --git a/drivers/net/ethernet/aquantia/atlantic/Makefile b/drivers/net/ethernet/aquantia/atlantic/Makefile > > index 8ebcc68e807f..268a055086c4 100644 > > --- a/drivers/net/ethernet/aquantia/atlantic/Makefile > > +++ b/drivers/net/ethernet/aquantia/atlantic/Makefile > > @@ -8,8 +8,6 @@ > > > > obj-$(CONFIG_AQTION) += atlantic.o > > > > -ccflags-y += -I$(srctree)/$(src) > > - > > atlantic-objs := aq_main.o \ > > aq_nic.o \ > > aq_pci_func.o \ > > I'm afraid drivers/net/ethernet/aquantia/atlantic/macsec/macsec_api.c, > .../hw_atl2/hw_atl2.c and .../hw_atl2/hw_atl2_utills{,_fw}.[ch] need to > be adjusted first. > > Except for the atlantic related patch diff: > Reviewed-by: Nicolas Schier <nicolas@fjasle.eu> Right. I got build errors for atlantic. I will drop this because it may cause regressions.
diff --git a/arch/loongarch/kvm/Makefile b/arch/loongarch/kvm/Makefile index 244467d7792a..7a0108a721c1 100644 --- a/arch/loongarch/kvm/Makefile +++ b/arch/loongarch/kvm/Makefile @@ -3,8 +3,6 @@ # Makefile for LoongArch KVM support # -ccflags-y += -I $(srctree)/$(src) - include $(srctree)/virt/kvm/Makefile.kvm obj-$(CONFIG_KVM) += kvm.o diff --git a/drivers/gpu/drm/imagination/Makefile b/drivers/gpu/drm/imagination/Makefile index ec6db8e9b403..3d9d4d40fb80 100644 --- a/drivers/gpu/drm/imagination/Makefile +++ b/drivers/gpu/drm/imagination/Makefile @@ -1,8 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only OR MIT # Copyright (c) 2023 Imagination Technologies Ltd. -subdir-ccflags-y := -I$(srctree)/$(src) - powervr-y := \ pvr_ccb.o \ pvr_cccb.o \ diff --git a/drivers/net/ethernet/aquantia/atlantic/Makefile b/drivers/net/ethernet/aquantia/atlantic/Makefile index 8ebcc68e807f..268a055086c4 100644 --- a/drivers/net/ethernet/aquantia/atlantic/Makefile +++ b/drivers/net/ethernet/aquantia/atlantic/Makefile @@ -8,8 +8,6 @@ obj-$(CONFIG_AQTION) += atlantic.o -ccflags-y += -I$(srctree)/$(src) - atlantic-objs := aq_main.o \ aq_nic.o \ aq_pci_func.o \
The include directive with the double-quote form, #include "...", first searches for the specified header in the directory containing the source file. If all local headers are included using the double-quote form instead of the angle bracket form, there is no need to add the local directory to the header search path. drivers/gpu/drm/imagination and drivers/net/ethernet/aquantia/atlantic use only the double-quote form for including the local headers, and there are no generated sources or headers in their directories. Hence, the local header search path is unneeded. The same applies to arch/loongarch/kvm/ because TRACE_INCLUDE_PATH is relative to include/trace/. I guess there exist more Makefiles with unnecessary header inclusion paths (and more cases where it is possible to delete the header search path by replacing #include <...> with #include "..."), but I do not have an easy way to detect it. These are unneeded inclusion paths that I happened to find. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> --- arch/loongarch/kvm/Makefile | 2 -- drivers/gpu/drm/imagination/Makefile | 2 -- drivers/net/ethernet/aquantia/atlantic/Makefile | 2 -- 3 files changed, 6 deletions(-)