Skip to content

Commit 67ee63e

Browse files
hkallweitdavem330
authored andcommitted
r8169: improve handling power management ops
Simplify handling the power management callbacks. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8ac8e8c commit 67ee63e

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

drivers/net/ethernet/realtek/r8169_main.c

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4821,7 +4821,7 @@ static void rtl8169_net_suspend(struct rtl8169_private *tp)
48214821

48224822
#ifdef CONFIG_PM
48234823

4824-
static int rtl8169_suspend(struct device *device)
4824+
static int __maybe_unused rtl8169_suspend(struct device *device)
48254825
{
48264826
struct rtl8169_private *tp = dev_get_drvdata(device);
48274827

@@ -4847,7 +4847,7 @@ static void __rtl8169_resume(struct rtl8169_private *tp)
48474847
rtl_unlock_work(tp);
48484848
}
48494849

4850-
static int rtl8169_resume(struct device *device)
4850+
static int __maybe_unused rtl8169_resume(struct device *device)
48514851
{
48524852
struct rtl8169_private *tp = dev_get_drvdata(device);
48534853

@@ -4909,24 +4909,12 @@ static int rtl8169_runtime_idle(struct device *device)
49094909
}
49104910

49114911
static const struct dev_pm_ops rtl8169_pm_ops = {
4912-
.suspend = rtl8169_suspend,
4913-
.resume = rtl8169_resume,
4914-
.freeze = rtl8169_suspend,
4915-
.thaw = rtl8169_resume,
4916-
.poweroff = rtl8169_suspend,
4917-
.restore = rtl8169_resume,
4918-
.runtime_suspend = rtl8169_runtime_suspend,
4919-
.runtime_resume = rtl8169_runtime_resume,
4920-
.runtime_idle = rtl8169_runtime_idle,
4912+
SET_SYSTEM_SLEEP_PM_OPS(rtl8169_suspend, rtl8169_resume)
4913+
SET_RUNTIME_PM_OPS(rtl8169_runtime_suspend, rtl8169_runtime_resume,
4914+
rtl8169_runtime_idle)
49214915
};
49224916

4923-
#define RTL8169_PM_OPS (&rtl8169_pm_ops)
4924-
4925-
#else /* !CONFIG_PM */
4926-
4927-
#define RTL8169_PM_OPS NULL
4928-
4929-
#endif /* !CONFIG_PM */
4917+
#endif /* CONFIG_PM */
49304918

49314919
static void rtl_wol_shutdown_quirk(struct rtl8169_private *tp)
49324920
{
@@ -5458,7 +5446,9 @@ static struct pci_driver rtl8169_pci_driver = {
54585446
.probe = rtl_init_one,
54595447
.remove = rtl_remove_one,
54605448
.shutdown = rtl_shutdown,
5461-
.driver.pm = RTL8169_PM_OPS,
5449+
#ifdef CONFIG_PM
5450+
.driver.pm = &rtl8169_pm_ops,
5451+
#endif
54625452
};
54635453

54645454
module_pci_driver(rtl8169_pci_driver);

0 commit comments

Comments
 (0)