* [PATCH v1] gve: Use generic power management
@ 2026-05-04 18:21 Vaibhav Gupta
2026-05-05 16:08 ` Alexander Lobakin
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Vaibhav Gupta @ 2026-05-04 18:21 UTC (permalink / raw)
To: Joshua Washington, Harshitha Ramamurthy, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Willem de Bruijn, Ankit Garg, Tim Hostetler, Alok Tiwari,
John Fraker, Matt Olson, Praveen Kaligineedi
Cc: Vaibhav Gupta, netdev, linux-kernel
Switch to the generic power management and remove the usage of legacy
(pci_driver) hooks.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
---
drivers/net/ethernet/google/gve/gve_main.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 424d973c97f2..b7bac6bf89e2 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -2967,9 +2967,9 @@ static void gve_shutdown(struct pci_dev *pdev)
rtnl_unlock();
}
-#ifdef CONFIG_PM
-static int gve_suspend(struct pci_dev *pdev, pm_message_t state)
+static int gve_suspend(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct gve_priv *priv = netdev_priv(netdev);
bool was_up = netif_running(priv->dev);
@@ -2990,8 +2990,9 @@ static int gve_suspend(struct pci_dev *pdev, pm_message_t state)
return 0;
}
-static int gve_resume(struct pci_dev *pdev)
+static int gve_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct gve_priv *priv = netdev_priv(netdev);
int err;
@@ -3004,7 +3005,8 @@ static int gve_resume(struct pci_dev *pdev)
rtnl_unlock();
return err;
}
-#endif /* CONFIG_PM */
+
+static DEFINE_SIMPLE_DEV_PM_OPS(gve_pm_ops, gve_suspend, gve_resume);
static const struct pci_device_id gve_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_GOOGLE, PCI_DEV_ID_GVNIC) },
@@ -3017,10 +3019,7 @@ static struct pci_driver gve_driver = {
.probe = gve_probe,
.remove = gve_remove,
.shutdown = gve_shutdown,
-#ifdef CONFIG_PM
- .suspend = gve_suspend,
- .resume = gve_resume,
-#endif
+ .driver.pm = &gve_pm_ops,
};
module_pci_driver(gve_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] gve: Use generic power management
2026-05-04 18:21 [PATCH v1] gve: Use generic power management Vaibhav Gupta
@ 2026-05-05 16:08 ` Alexander Lobakin
2026-05-05 17:28 ` Harshitha Ramamurthy
2026-05-06 16:47 ` [PATCH net-next v2] " Vaibhav Gupta
2 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2026-05-05 16:08 UTC (permalink / raw)
To: Vaibhav Gupta
Cc: Joshua Washington, Harshitha Ramamurthy, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Willem de Bruijn, Ankit Garg, Tim Hostetler, Alok Tiwari,
John Fraker, Matt Olson, Praveen Kaligineedi, netdev,
linux-kernel
From: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Date: Mon, 4 May 2026 18:21:32 +0000
> Switch to the generic power management and remove the usage of legacy
> (pci_driver) hooks.
>
> Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> ---
> drivers/net/ethernet/google/gve/gve_main.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
Thanks,
Olek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] gve: Use generic power management
2026-05-04 18:21 [PATCH v1] gve: Use generic power management Vaibhav Gupta
2026-05-05 16:08 ` Alexander Lobakin
@ 2026-05-05 17:28 ` Harshitha Ramamurthy
2026-05-06 16:21 ` Vaibhav Gupta
2026-05-06 16:47 ` [PATCH net-next v2] " Vaibhav Gupta
2 siblings, 1 reply; 5+ messages in thread
From: Harshitha Ramamurthy @ 2026-05-05 17:28 UTC (permalink / raw)
To: Vaibhav Gupta
Cc: Joshua Washington, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Ankit Garg,
Tim Hostetler, Alok Tiwari, John Fraker, Matt Olson,
Praveen Kaligineedi, netdev, linux-kernel
On Mon, May 4, 2026 at 11:21 AM Vaibhav Gupta <vaibhavgupta40@gmail.com> wrote:
>
> Switch to the generic power management and remove the usage of legacy
> (pci_driver) hooks.
>
> Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
> ---
> drivers/net/ethernet/google/gve/gve_main.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 424d973c97f2..b7bac6bf89e2 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -2967,9 +2967,9 @@ static void gve_shutdown(struct pci_dev *pdev)
> rtnl_unlock();
> }
>
> -#ifdef CONFIG_PM
> -static int gve_suspend(struct pci_dev *pdev, pm_message_t state)
> +static int gve_suspend(struct device *dev)
> {
> + struct pci_dev *pdev = to_pci_dev(dev);
> struct net_device *netdev = pci_get_drvdata(pdev);
> struct gve_priv *priv = netdev_priv(netdev);
> bool was_up = netif_running(priv->dev);
> @@ -2990,8 +2990,9 @@ static int gve_suspend(struct pci_dev *pdev, pm_message_t state)
> return 0;
> }
>
> -static int gve_resume(struct pci_dev *pdev)
> +static int gve_resume(struct device *dev)
> {
> + struct pci_dev *pdev = to_pci_dev(dev);
> struct net_device *netdev = pci_get_drvdata(pdev);
> struct gve_priv *priv = netdev_priv(netdev);
> int err;
> @@ -3004,7 +3005,8 @@ static int gve_resume(struct pci_dev *pdev)
> rtnl_unlock();
> return err;
> }
> -#endif /* CONFIG_PM */
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(gve_pm_ops, gve_suspend, gve_resume);
>
> static const struct pci_device_id gve_id_table[] = {
> { PCI_DEVICE(PCI_VENDOR_ID_GOOGLE, PCI_DEV_ID_GVNIC) },
> @@ -3017,10 +3019,7 @@ static struct pci_driver gve_driver = {
> .probe = gve_probe,
> .remove = gve_remove,
> .shutdown = gve_shutdown,
> -#ifdef CONFIG_PM
> - .suspend = gve_suspend,
> - .resume = gve_resume,
> -#endif
> + .driver.pm = &gve_pm_ops,
Thanks for the patch! A minor suggestion: could you wrap this in pm_sleep_ptr()?
Also, please include the net-next prefix in the subject line when posting v2.
With those changes, feel free to add:
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
Thanks,
Harshitha
> };
>
> module_pci_driver(gve_driver);
> --
> 2.53.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] gve: Use generic power management
2026-05-05 17:28 ` Harshitha Ramamurthy
@ 2026-05-06 16:21 ` Vaibhav Gupta
0 siblings, 0 replies; 5+ messages in thread
From: Vaibhav Gupta @ 2026-05-06 16:21 UTC (permalink / raw)
To: Harshitha Ramamurthy
Cc: Joshua Washington, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Ankit Garg,
Tim Hostetler, Alok Tiwari, John Fraker, Matt Olson,
Praveen Kaligineedi, netdev, linux-kernel
> > - .suspend = gve_suspend,
> > - .resume = gve_resume,
> > -#endif
> > + .driver.pm = &gve_pm_ops,
>
> Thanks for the patch! A minor suggestion: could you wrap this in pm_sleep_ptr()?
>
> Also, please include the net-next prefix in the subject line when posting v2.
>
> With those changes, feel free to add:
> Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
>
> Thanks,
> Harshitha
>
Thanks for your input Harshitha! I have made the suggested amends, and I will
send the v2 in reply to my v1 patch, as I have to include the review tag of
Alexander as well.
Thanks
Vaibhav
> > };
> >
> > module_pci_driver(gve_driver);
>
> > --
> > 2.53.0
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2] gve: Use generic power management
2026-05-04 18:21 [PATCH v1] gve: Use generic power management Vaibhav Gupta
2026-05-05 16:08 ` Alexander Lobakin
2026-05-05 17:28 ` Harshitha Ramamurthy
@ 2026-05-06 16:47 ` Vaibhav Gupta
2 siblings, 0 replies; 5+ messages in thread
From: Vaibhav Gupta @ 2026-05-06 16:47 UTC (permalink / raw)
To: Joshua Washington, Harshitha Ramamurthy, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Willem de Bruijn, Ankit Garg, Tim Hostetler, Alok Tiwari,
John Fraker, Matt Olson, Praveen Kaligineedi
Cc: Vaibhav Gupta, netdev, linux-kernel, Alexander Lobakin
Switch to the generic power management and remove the usage of legacy
(pci_driver) hooks.
Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com>
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
---
v2: wrap "&gve_pm_ops" inside pm_sleep_ptr(), and add 'net-next' tag, as
suggested by Harshitha.
---
drivers/net/ethernet/google/gve/gve_main.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 424d973c97f2..00750643e614 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -2967,9 +2967,9 @@ static void gve_shutdown(struct pci_dev *pdev)
rtnl_unlock();
}
-#ifdef CONFIG_PM
-static int gve_suspend(struct pci_dev *pdev, pm_message_t state)
+static int gve_suspend(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct gve_priv *priv = netdev_priv(netdev);
bool was_up = netif_running(priv->dev);
@@ -2990,8 +2990,9 @@ static int gve_suspend(struct pci_dev *pdev, pm_message_t state)
return 0;
}
-static int gve_resume(struct pci_dev *pdev)
+static int gve_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *netdev = pci_get_drvdata(pdev);
struct gve_priv *priv = netdev_priv(netdev);
int err;
@@ -3004,7 +3005,8 @@ static int gve_resume(struct pci_dev *pdev)
rtnl_unlock();
return err;
}
-#endif /* CONFIG_PM */
+
+static DEFINE_SIMPLE_DEV_PM_OPS(gve_pm_ops, gve_suspend, gve_resume);
static const struct pci_device_id gve_id_table[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_GOOGLE, PCI_DEV_ID_GVNIC) },
@@ -3017,10 +3019,7 @@ static struct pci_driver gve_driver = {
.probe = gve_probe,
.remove = gve_remove,
.shutdown = gve_shutdown,
-#ifdef CONFIG_PM
- .suspend = gve_suspend,
- .resume = gve_resume,
-#endif
+ .driver.pm = pm_sleep_ptr(&gve_pm_ops),
};
module_pci_driver(gve_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-06 16:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 18:21 [PATCH v1] gve: Use generic power management Vaibhav Gupta
2026-05-05 16:08 ` Alexander Lobakin
2026-05-05 17:28 ` Harshitha Ramamurthy
2026-05-06 16:21 ` Vaibhav Gupta
2026-05-06 16:47 ` [PATCH net-next v2] " Vaibhav Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox