From 1f9587aca37bd640d813af3427d01fa59bf0b1e4 Mon Sep 17 00:00:00 2001 From: Bharat Nihalani Date: Mon, 26 Jun 2023 05:20:05 +0000 Subject: [PATCH] drivers: Fix build errors with DEBUGFS_FS disabled When CONFIG_DEBUG_FS is disabled, build errors are seen in the following 2 drivers: 1. bpmpfw - The build error was seen because bpmp-debugfs.c was getting compiled even when CONFIG_DEBUG_FS was disabled. 2. ufs - The build error was seen due to a couple of reasons: - Function debugfs_provision_init is defined in a file that is protected with CONFIG_DEBUG_FS, but is called from another file unconditionally. - In ufs-tegra-common.c, there are calls to debugfs_* functions, but inclusion of the standard header debugfs.h is protected under CONFIG_DEBUG_FS. Fix these issues with this change. Bug 4164776 Change-Id: Iae6384fd2352e55aed2a0ea85e778be6c26a4d54 Signed-off-by: Bharat Nihalani Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2926891 GVS: Gerrit_Virtual_Submit --- drivers/firmware/tegra/Makefile | 2 +- drivers/scsi/ufs/ufs-provision.h | 9 +++++++++ drivers/scsi/ufs/ufs-tegra-common.c | 2 -- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/tegra/Makefile b/drivers/firmware/tegra/Makefile index d67b38e1..5bbfae69 100644 --- a/drivers/firmware/tegra/Makefile +++ b/drivers/firmware/tegra/Makefile @@ -14,7 +14,7 @@ obj-m += ivc_ext.o tegra_bpmp-y += ../../clk/tegra/clk-bpmp.o tegra_bpmp-y += ../../reset/tegra/reset-bpmp.o tegra_bpmp-y += ../../soc/tegra/powergate-bpmp.o -tegra_bpmp-y += bpmp-debugfs.o +tegra_bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o tegra_bpmp-y += bpmp-tegra186-hv.o obj-m += tegra_bpmp.o endif diff --git a/drivers/scsi/ufs/ufs-provision.h b/drivers/scsi/ufs/ufs-provision.h index ef743203..5ac6d9da 100644 --- a/drivers/scsi/ufs/ufs-provision.h +++ b/drivers/scsi/ufs/ufs-provision.h @@ -17,6 +17,15 @@ #include void debugfs_provision_init(struct ufs_hba *hba, struct dentry *device_root); void debugfs_provision_exit(struct ufs_hba *hba); +#else +static inline void debugfs_provision_init(struct ufs_hba *hba, struct dentry *device_root) +{ + return; +} +static inline void debugfs_provision_exit(struct ufs_hba *hba) +{ + return; +} #endif #endif diff --git a/drivers/scsi/ufs/ufs-tegra-common.c b/drivers/scsi/ufs/ufs-tegra-common.c index fe68da2c..99ca1901 100644 --- a/drivers/scsi/ufs/ufs-tegra-common.c +++ b/drivers/scsi/ufs/ufs-tegra-common.c @@ -19,9 +19,7 @@ #include #include -#ifdef CONFIG_DEBUG_FS #include -#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) #include