[PATCH] net: alx: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Christoph Heiss posted 1 patch 2 years, 9 months ago
There is a newer version of this series
drivers/net/ethernet/atheros/alx/main.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
[PATCH] net: alx: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Posted by Christoph Heiss 2 years, 9 months ago
Using these macros allows to remove an #ifdef-guard on CONFIG_PM_SLEEP.
No functional changes.

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
---
 drivers/net/ethernet/atheros/alx/main.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index d30d11872719..306393f8eeca 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -1905,7 +1905,6 @@ static void alx_remove(struct pci_dev *pdev)
 	free_netdev(alx->dev);
 }

-#ifdef CONFIG_PM_SLEEP
 static int alx_suspend(struct device *dev)
 {
 	struct alx_priv *alx = dev_get_drvdata(dev);
@@ -1951,12 +1950,7 @@ static int alx_resume(struct device *dev)
 	return err;
 }

-static SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);
-#define ALX_PM_OPS      (&alx_pm_ops)
-#else
-#define ALX_PM_OPS      NULL
-#endif
-
+static DEFINE_SIMPLE_DEV_PM_OPS(alx_pm_ops, alx_suspend, alx_resume);

 static pci_ers_result_t alx_pci_error_detected(struct pci_dev *pdev,
 					       pci_channel_state_t state)
@@ -2055,7 +2049,7 @@ static struct pci_driver alx_driver = {
 	.probe       = alx_probe,
 	.remove      = alx_remove,
 	.err_handler = &alx_err_handlers,
-	.driver.pm   = ALX_PM_OPS,
+	.driver.pm   = pm_sleep_ptr(&alx_pm_ops),
 };

 module_pci_driver(alx_driver);
--
2.39.0
Re: [PATCH] net: alx: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Posted by Paolo Abeni 2 years, 9 months ago
Hello,

On Sat, 2022-12-17 at 11:40 +0100, Christoph Heiss wrote:
> Using these macros allows to remove an #ifdef-guard on CONFIG_PM_SLEEP.
> No functional changes.
> 
> Signed-off-by: Christoph Heiss <christoph@c8h4.io>

# Form letter - net-next is closed

We have already submitted the networking pull request to Linus
for v6.2 and therefore net-next is closed for new drivers, features,
code refactoring and optimizations. We are currently accepting
bug fixes only.

Please repost when net-next reopens after Jan 2nd.

RFC patches sent for review only are obviously welcome at any time.