Messages in this thread Patch in this message | | | Date | Mon, 25 Jul 2022 11:38:04 +0800 | Subject | Re: [PATCH -next] scsi: ufs: ufs-mediatek: Fix build error | From | Ren Zhijie <> |
| |
在 2022/7/13 16:48, Arnd Bergmann 写道: > On Wed, Jul 13, 2022 at 3:44 AM Ren Zhijie <renzhijie2@huawei.com> wrote: >> 在 2022/7/12 16:27, Arnd Bergmann 写道: >> >> Thanks for your suggestion. >> >> How does it to fix the implicit-function-declaration error? >> > I missed that part at first. I would say the #ifdef around the > declarations in the > header should be removed here, it serves no purpose, and it is safe to rely > on the compiler to perform dead code elimination so this does not lead to > a link error even if a dead function references another function that is not > reachable. > > Arnd
Hi Arnd,
I try to use the new marcos SYSTEM_SLEEP_PM_OPS and RUNTIME_PM_OPS to replace the old ones, and remove #ifdef around the declarations in the header, my local changes attach below.
But it seems that doesn't work, which has ld errors:
aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected! aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected! drivers/ufs/host/ufs-mediatek.o: In function `ufs_mtk_runtime_resume': ufs-mediatek.c:(.text+0x1d0c): undefined reference to `ufshcd_runtime_resume' drivers/ufs/host/ufs-mediatek.o: In function `ufs_mtk_runtime_suspend': ufs-mediatek.c:(.text+0x1d64): undefined reference to `ufshcd_runtime_suspend' Makefile:1255: recipe for target 'vmlinux' failed make: *** [vmlinux] Error 1
(CONFIG_PM and CONFIG_PM_SLEEP are both not set, and
run cmd: make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-)
Thanks,
Ren Zhijie
--
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index c958279bdd8f..8c0c6f04eed1 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -1402,7 +1402,6 @@ static int ufs_mtk_remove(struct platform_device *pdev) return 0; }
-#ifdef CONFIG_PM_SLEEP static int ufs_mtk_system_suspend(struct device *dev) { struct ufs_hba *hba = dev_get_drvdata(dev); @@ -1425,7 +1424,6 @@ static int ufs_mtk_system_resume(struct device *dev)
return ufshcd_system_resume(dev); } -#endif
static int ufs_mtk_runtime_suspend(struct device *dev) { @@ -1451,9 +1449,9 @@ static int ufs_mtk_runtime_resume(struct device *dev) }
static const struct dev_pm_ops ufs_mtk_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(ufs_mtk_system_suspend, + SYSTEM_SLEEP_PM_OPS(ufs_mtk_system_suspend, ufs_mtk_system_resume) - SET_RUNTIME_PM_OPS(ufs_mtk_runtime_suspend, + RUNTIME_PM_OPS(ufs_mtk_runtime_suspend, ufs_mtk_runtime_resume, NULL) .prepare = ufshcd_suspend_prepare, .complete = ufshcd_resume_complete, diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 7fe1a926cd99..17ec18d55470 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1081,14 +1081,10 @@ static inline void *ufshcd_get_variant(struct ufs_hba *hba) return hba->priv; }
-#ifdef CONFIG_PM extern int ufshcd_runtime_suspend(struct device *dev); extern int ufshcd_runtime_resume(struct device *dev); -#endif -#ifdef CONFIG_PM_SLEEP extern int ufshcd_system_suspend(struct device *dev); extern int ufshcd_system_resume(struct device *dev); -#endif extern int ufshcd_shutdown(struct ufs_hba *hba); extern int ufshcd_dme_configure_adapt(struct ufs_hba *hba, int agreed_gear, > .
| |