* [PATCH] mmc: core: Switch to use pm_ptr() for bus.c
@ 2026-04-21 2:37 Shawn Lin
2026-04-30 0:59 ` kernel test robot
0 siblings, 1 reply; 2+ messages in thread
From: Shawn Lin @ 2026-04-21 2:37 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, linux-kernel, Shawn Lin
Replace this #ifdef usage with the standard pm_ptr() helpers. This
allows the compiler to automatically optimize away the unused code
paths when CONFIG_PM_SLEEP or CONFIG_PM is not selected, resulting
in cleaner and more maintainable code.
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/mmc/core/bus.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index be5cf33..b613b20 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -160,7 +160,6 @@ static void mmc_bus_shutdown(struct device *dev)
}
}
-#ifdef CONFIG_PM_SLEEP
static int mmc_bus_suspend(struct device *dev)
{
struct mmc_card *card = mmc_dev_to_card(dev);
@@ -192,9 +191,7 @@ static int mmc_bus_resume(struct device *dev)
ret = pm_generic_resume(dev);
return ret;
}
-#endif
-#ifdef CONFIG_PM
static int mmc_runtime_suspend(struct device *dev)
{
struct mmc_card *card = mmc_dev_to_card(dev);
@@ -210,11 +207,10 @@ static int mmc_runtime_resume(struct device *dev)
return host->bus_ops->runtime_resume(host);
}
-#endif /* !CONFIG_PM */
static const struct dev_pm_ops mmc_bus_pm_ops = {
- SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, NULL)
- SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume)
+ RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, NULL)
+ SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume)
};
static const struct bus_type mmc_bus_type = {
@@ -224,7 +220,7 @@ static const struct bus_type mmc_bus_type = {
.probe = mmc_bus_probe,
.remove = mmc_bus_remove,
.shutdown = mmc_bus_shutdown,
- .pm = &mmc_bus_pm_ops,
+ .pm = pm_ptr(&mmc_bus_pm_ops),
};
int mmc_register_bus(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mmc: core: Switch to use pm_ptr() for bus.c
2026-04-21 2:37 [PATCH] mmc: core: Switch to use pm_ptr() for bus.c Shawn Lin
@ 2026-04-30 0:59 ` kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-04-30 0:59 UTC (permalink / raw)
To: Shawn Lin, Ulf Hansson
Cc: llvm, oe-kbuild-all, linux-mmc, linux-kernel, Shawn Lin
Hi Shawn,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on ulf-hansson-mmc-mirror/next v7.1-rc1 next-20260429]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Shawn-Lin/mmc-core-Switch-to-use-pm_ptr-for-bus-c/20260424-085747
base: linus/master
patch link: https://lore.kernel.org/r/1776739053-120472-1-git-send-email-shawn.lin%40rock-chips.com
patch subject: [PATCH] mmc: core: Switch to use pm_ptr() for bus.c
config: arm64-randconfig-004-20260430 (https://download.01.org/0day-ci/archive/20260430/202604300815.ATCbIpPU-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 5bac06718f502014fade905512f1d26d578a18f3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260430/202604300815.ATCbIpPU-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202604300815.ATCbIpPU-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/mmc/core/bus.c:169:26: error: called object type 'void *' is not a function or function pointer
169 | ret = pm_generic_suspend(dev);
| ~~~~~~~~~~~~~~~~~~^
drivers/mmc/core/bus.c:175:20: error: called object type 'void *' is not a function or function pointer
175 | pm_generic_resume(dev);
| ~~~~~~~~~~~~~~~~~^
drivers/mmc/core/bus.c:191:25: error: called object type 'void *' is not a function or function pointer
191 | ret = pm_generic_resume(dev);
| ~~~~~~~~~~~~~~~~~^
3 errors generated.
vim +169 drivers/mmc/core/bus.c
7628774851751e Ulf Hansson 2013-06-10 162
32d317c60e56c2 Chuanxiao Dong 2012-04-11 163 static int mmc_bus_suspend(struct device *dev)
4101c16a910b15 Pierre Ossman 2007-05-19 164 {
265cdc900ce93c Andy Shevchenko 2010-09-17 165 struct mmc_card *card = mmc_dev_to_card(dev);
986892ca78eedd Ulf Hansson 2013-06-10 166 struct mmc_host *host = card->host;
986892ca78eedd Ulf Hansson 2013-06-10 167 int ret;
4101c16a910b15 Pierre Ossman 2007-05-19 168
0967edc6ef5c3c Ulf Hansson 2014-10-06 @169 ret = pm_generic_suspend(dev);
986892ca78eedd Ulf Hansson 2013-06-10 170 if (ret)
986892ca78eedd Ulf Hansson 2013-06-10 171 return ret;
986892ca78eedd Ulf Hansson 2013-06-10 172
986892ca78eedd Ulf Hansson 2013-06-10 173 ret = host->bus_ops->suspend(host);
ebe7dd45cf49e3 Adrian Hunter 2017-11-21 174 if (ret)
ebe7dd45cf49e3 Adrian Hunter 2017-11-21 175 pm_generic_resume(dev);
ebe7dd45cf49e3 Adrian Hunter 2017-11-21 176
4101c16a910b15 Pierre Ossman 2007-05-19 177 return ret;
4101c16a910b15 Pierre Ossman 2007-05-19 178 }
4101c16a910b15 Pierre Ossman 2007-05-19 179
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-30 1:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 2:37 [PATCH] mmc: core: Switch to use pm_ptr() for bus.c Shawn Lin
2026-04-30 0:59 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox