Skip to content

Commit 2ac83ea

Browse files
Dmitry ShmidtKali-
Dmitry Shmidt
authored andcommitted
mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is used
1 parent e45cb4b commit 2ac83ea

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

drivers/mmc/core/bus.c

+7-17
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,19 @@ static int mmc_bus_remove(struct device *dev)
125125
return 0;
126126
}
127127

128-
static int mmc_bus_suspend(struct device *dev, pm_message_t state)
128+
static int mmc_bus_pm_suspend(struct device *dev)
129129
{
130130
struct mmc_driver *drv = to_mmc_driver(dev->driver);
131131
struct mmc_card *card = mmc_dev_to_card(dev);
132132
int ret = 0;
133+
pm_message_t state = { PM_EVENT_SUSPEND };
133134

134135
if (dev->driver && drv->suspend)
135136
ret = drv->suspend(card, state);
136137
return ret;
137138
}
138139

139-
static int mmc_bus_resume(struct device *dev)
140+
static int mmc_bus_pm_resume(struct device *dev)
140141
{
141142
struct mmc_driver *drv = to_mmc_driver(dev->driver);
142143
struct mmc_card *card = mmc_dev_to_card(dev);
@@ -148,7 +149,6 @@ static int mmc_bus_resume(struct device *dev)
148149
}
149150

150151
#ifdef CONFIG_PM_RUNTIME
151-
152152
static int mmc_runtime_suspend(struct device *dev)
153153
{
154154
struct mmc_card *card = mmc_dev_to_card(dev);
@@ -167,31 +167,21 @@ static int mmc_runtime_idle(struct device *dev)
167167
{
168168
return pm_runtime_suspend(dev);
169169
}
170+
#endif /* CONFIG_PM_RUNTIME */
170171

171172
static const struct dev_pm_ops mmc_bus_pm_ops = {
172-
.runtime_suspend = mmc_runtime_suspend,
173-
.runtime_resume = mmc_runtime_resume,
174-
.runtime_idle = mmc_runtime_idle,
173+
SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_pm_suspend, mmc_bus_pm_resume)
174+
SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, mmc_runtime_idle)
175175
};
176176

177-
#define MMC_PM_OPS_PTR (&mmc_bus_pm_ops)
178-
179-
#else /* !CONFIG_PM_RUNTIME */
180-
181-
#define MMC_PM_OPS_PTR NULL
182-
183-
#endif /* !CONFIG_PM_RUNTIME */
184-
185177
static struct bus_type mmc_bus_type = {
186178
.name = "mmc",
187179
.dev_attrs = mmc_dev_attrs,
188180
.match = mmc_bus_match,
189181
.uevent = mmc_bus_uevent,
190182
.probe = mmc_bus_probe,
191183
.remove = mmc_bus_remove,
192-
.suspend = mmc_bus_suspend,
193-
.resume = mmc_bus_resume,
194-
.pm = MMC_PM_OPS_PTR,
184+
.pm = &mmc_bus_pm_ops,
195185
};
196186

197187
int mmc_register_bus(void)

0 commit comments

Comments
 (0)