Skip to content

Commit e84a7da

Browse files
GallaisPoutinegregkh
authored andcommitted
usb: dwc3: st: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based kernel configuration guards. Signed-off-by: Raphael Gallais-Pou <[email protected]> Acked-by: Thinh Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a266462 commit e84a7da

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/usb/dwc3/dwc3-st.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ static void st_dwc3_remove(struct platform_device *pdev)
309309
reset_control_assert(dwc3_data->rstc_rst);
310310
}
311311

312-
#ifdef CONFIG_PM_SLEEP
313312
static int st_dwc3_suspend(struct device *dev)
314313
{
315314
struct st_dwc3 *dwc3_data = dev_get_drvdata(dev);
@@ -343,9 +342,8 @@ static int st_dwc3_resume(struct device *dev)
343342

344343
return 0;
345344
}
346-
#endif /* CONFIG_PM_SLEEP */
347345

348-
static SIMPLE_DEV_PM_OPS(st_dwc3_dev_pm_ops, st_dwc3_suspend, st_dwc3_resume);
346+
static DEFINE_SIMPLE_DEV_PM_OPS(st_dwc3_dev_pm_ops, st_dwc3_suspend, st_dwc3_resume);
349347

350348
static const struct of_device_id st_dwc3_match[] = {
351349
{ .compatible = "st,stih407-dwc3" },
@@ -360,7 +358,7 @@ static struct platform_driver st_dwc3_driver = {
360358
.driver = {
361359
.name = "usb-st-dwc3",
362360
.of_match_table = st_dwc3_match,
363-
.pm = &st_dwc3_dev_pm_ops,
361+
.pm = pm_sleep_ptr(&st_dwc3_dev_pm_ops),
364362
},
365363
};
366364

0 commit comments

Comments
 (0)