Skip to contentSkip to conversation

virtio: Replace CONFIG_PM with CONFIG_PM_SLEEP

PATCH In review Aaron Lu 3 participants 11 messages Sep 6, 2013 – Sep 9, 2013

Subsystems (11)
lore
Share & tools
lore

Aaron Lu

author
#0 lore raw

cover virtio: Replace CONFIG_PM with CONFIG_PM_SLEEP

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Aaron Lu (2):
virtio_pci: pm: Use CONFIG_PM_SLEEP instead of CONFIG_PM
virtio: pm: use CONFIG_PM_SLEEP instead of CONFIG_PM

 drivers/block/virtio_blk.c          | 4 ++--
 drivers/char/hw_random/virtio-rng.c | 4 ++--
 drivers/char/virtio_console.c       | 4 ++--
 drivers/net/virtio_net.c            | 4 ++--
 drivers/scsi/virtio_scsi.c          | 4 ++--
 drivers/virtio/virtio_balloon.c     | 4 ++--
 drivers/virtio/virtio_pci.c         | 4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
1.8.4.12.g2ea3df6
author
#1 lore raw

PATCH 1/2 virtio_pci: pm: Use CONFIG_PM_SLEEP instead of CONFIG_PM

The virtio_pci_freeze/restore are defined under CONFIG_PM but is used by SET_SYSTEM_SLEEP_PM_OPS macro, which is defined under CONFIG_PM_SLEEP. So if CONFIG_PM_SLEEP is not cofigured but CONFIG_PM_RUNTIME is, the following warning message appeared:

drivers/virtio/virtio_pci.c:770:12: warning: ‘virtio_pci_freeze’ defined but not used [-Wunused-function]
static int virtio_pci_freeze(struct device *dev)

            ^
drivers/virtio/virtio_pci.c:790:12: warning: ‘virtio_pci_restore’ defined but not used [-Wunused-function]
 static int virtio_pci_restore(struct device *dev)
            ^

Fix it by changing CONFIG_PM to CONFIG_PM_SLEEP.

---
 drivers/virtio/virtio_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/virtio/virtio_pci.c +2 -2
index 1aba255..98917fc 100644
@@ -766,7 +766,7 @@ static void virtio_pci_remove(struct pci_dev *pci_dev)
 	kfree(vp_dev);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtio_pci_freeze(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
@@ -824,7 +824,7 @@ static struct pci_driver virtio_pci_driver = {
 	.id_table	= virtio_pci_id_table,
 	.probe		= virtio_pci_probe,
 	.remove		= virtio_pci_remove,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.driver.pm	= &virtio_pci_pm_ops,
 #endif
 };
Signature · 1 line
1.8.4.12.g2ea3df6
author
#3 lore raw

PATCH 2/2 virtio: pm: use CONFIG_PM_SLEEP instead of CONFIG_PM

In reply to Aaron Lu

The freeze and restore functions defined in virtio drivers are used for suspend and hibernate, so CONFIG_PM_SLEEP is more appropriate than CONFIG_PM. This patch replace all CONFIG_PM with CONFIG_PM_SLEEP for virtio drivers that implement freeze and restore callbacks.

---
 drivers/block/virtio_blk.c          | 4 ++--
 drivers/char/hw_random/virtio-rng.c | 4 ++--
 drivers/char/virtio_console.c       | 4 ++--
 drivers/net/virtio_net.c            | 4 ++--
 drivers/scsi/virtio_scsi.c          | 4 ++--
 drivers/virtio/virtio_balloon.c     | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)
drivers/block/virtio_blk.c +2 -2
index 5cdf88b..89245b5 100644
@@ -899,7 +899,7 @@ static void virtblk_remove(struct virtio_device *vdev)
 		ida_simple_remove(&vd_index_ida, index);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtblk_freeze(struct virtio_device *vdev)
 {
 	struct virtio_blk *vblk = vdev->priv;
@@ -959,7 +959,7 @@ static struct virtio_driver virtio_blk = {
 	.probe			= virtblk_probe,
 	.remove			= virtblk_remove,
 	.config_changed		= virtblk_config_changed,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze			= virtblk_freeze,
 	.restore		= virtblk_restore,
 #endif
drivers/char/hw_random/virtio-rng.c +2 -2
index ef46a9c..c12398d 100644
@@ -133,7 +133,7 @@ static void virtrng_remove(struct virtio_device *vdev)
 	remove_common(vdev);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtrng_freeze(struct virtio_device *vdev)
 {
 	remove_common(vdev);
@@ -157,7 +157,7 @@ static struct virtio_driver virtio_rng_driver = {
 	.id_table =	id_table,
 	.probe =	virtrng_probe,
 	.remove =	virtrng_remove,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze =	virtrng_freeze,
 	.restore =	virtrng_restore,
 #endif
drivers/char/virtio_console.c +2 -2
index fc45567..2e96246 100644
@@ -2135,7 +2135,7 @@ static struct virtio_device_id rproc_serial_id_table[] = {
 static unsigned int rproc_serial_features[] = {
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtcons_freeze(struct virtio_device *vdev)
 {
 	struct ports_device *portdev;
@@ -2213,7 +2213,7 @@ static struct virtio_driver virtio_console = {
 	.probe =	virtcons_probe,
 	.remove =	virtcons_remove,
 	.config_changed = config_intr,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze =	virtcons_freeze,
 	.restore =	virtcons_restore,
 #endif
drivers/net/virtio_net.c +2 -2
index defec2b..2ad3d96 100644
@@ -1683,7 +1683,7 @@ static void virtnet_remove(struct virtio_device *vdev)
 	free_netdev(vi->dev);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtnet_freeze(struct virtio_device *vdev)
 {
 	struct virtnet_info *vi = vdev->priv;
@@ -1766,7 +1766,7 @@ static struct virtio_driver virtio_net_driver = {
 	.probe =	virtnet_probe,
 	.remove =	virtnet_remove,
 	.config_changed = virtnet_config_changed,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze =	virtnet_freeze,
 	.restore =	virtnet_restore,
 #endif
drivers/scsi/virtio_scsi.c +2 -2
index 74b88ef..2a11039 100644
@@ -954,7 +954,7 @@ static void virtscsi_remove(struct virtio_device *vdev)
 	scsi_host_put(shost);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtscsi_freeze(struct virtio_device *vdev)
 {
 	virtscsi_remove_vqs(vdev);
@@ -988,7 +988,7 @@ static struct virtio_driver virtio_scsi_driver = {
 	.id_table = id_table,
 	.probe = virtscsi_probe,
 	.scan = virtscsi_scan,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze = virtscsi_freeze,
 	.restore = virtscsi_restore,
 #endif
drivers/virtio/virtio_balloon.c +2 -2
index 1f572c0..d6f6816 100644
@@ -513,7 +513,7 @@ static void virtballoon_remove(struct virtio_device *vdev)
 	kfree(vb);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtballoon_freeze(struct virtio_device *vdev)
 {
 	struct virtio_balloon *vb = vdev->priv;
@@ -556,7 +556,7 @@ static struct virtio_driver virtio_balloon_driver = {
 	.probe =	virtballoon_probe,
 	.remove =	virtballoon_remove,
 	.config_changed = virtballoon_changed,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze	=	virtballoon_freeze,
 	.restore =	virtballoon_restore,
 #endif
Signature · 1 line
1.8.4.12.g2ea3df6
author
#2 lore raw

PATCH 1/2 virtio_pci: pm: Use CONFIG_PM_SLEEP instead of CONFIG_PM

In reply to Aaron Lu

The virtio_pci_freeze/restore are defined under CONFIG_PM but is used by SET_SYSTEM_SLEEP_PM_OPS macro, which is defined under CONFIG_PM_SLEEP. So if CONFIG_PM_SLEEP is not cofigured but CONFIG_PM_RUNTIME is, the following warning message appeared:

drivers/virtio/virtio_pci.c:770:12: warning: ‘virtio_pci_freeze’ defined but not used [-Wunused-function]
static int virtio_pci_freeze(struct device *dev)

            ^
drivers/virtio/virtio_pci.c:790:12: warning: ‘virtio_pci_restore’ defined but not used [-Wunused-function]
 static int virtio_pci_restore(struct device *dev)
            ^

Fix it by changing CONFIG_PM to CONFIG_PM_SLEEP.

---
 drivers/virtio/virtio_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/virtio/virtio_pci.c +2 -2
index 1aba255..98917fc 100644
@@ -766,7 +766,7 @@ static void virtio_pci_remove(struct pci_dev *pci_dev)
 	kfree(vp_dev);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtio_pci_freeze(struct device *dev)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev);
@@ -824,7 +824,7 @@ static struct pci_driver virtio_pci_driver = {
 	.id_table	= virtio_pci_id_table,
 	.probe		= virtio_pci_probe,
 	.remove		= virtio_pci_remove,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.driver.pm	= &virtio_pci_pm_ops,
 #endif
 };
Signature · 6 lines
1.8.4.12.g2ea3df6

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
author
#4 lore raw

PATCH 2/2 virtio: pm: use CONFIG_PM_SLEEP instead of CONFIG_PM

In reply to Aaron Lu

The freeze and restore functions defined in virtio drivers are used for suspend and hibernate, so CONFIG_PM_SLEEP is more appropriate than CONFIG_PM. This patch replace all CONFIG_PM with CONFIG_PM_SLEEP for virtio drivers that implement freeze and restore callbacks.

---
 drivers/block/virtio_blk.c          | 4 ++--
 drivers/char/hw_random/virtio-rng.c | 4 ++--
 drivers/char/virtio_console.c       | 4 ++--
 drivers/net/virtio_net.c            | 4 ++--
 drivers/scsi/virtio_scsi.c          | 4 ++--
 drivers/virtio/virtio_balloon.c     | 4 ++--
 6 files changed, 12 insertions(+), 12 deletions(-)
drivers/block/virtio_blk.c +2 -2
index 5cdf88b..89245b5 100644
@@ -899,7 +899,7 @@ static void virtblk_remove(struct virtio_device *vdev)
 		ida_simple_remove(&vd_index_ida, index);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtblk_freeze(struct virtio_device *vdev)
 {
 	struct virtio_blk *vblk = vdev->priv;
@@ -959,7 +959,7 @@ static struct virtio_driver virtio_blk = {
 	.probe			= virtblk_probe,
 	.remove			= virtblk_remove,
 	.config_changed		= virtblk_config_changed,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze			= virtblk_freeze,
 	.restore		= virtblk_restore,
 #endif
drivers/char/hw_random/virtio-rng.c +2 -2
index ef46a9c..c12398d 100644
@@ -133,7 +133,7 @@ static void virtrng_remove(struct virtio_device *vdev)
 	remove_common(vdev);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtrng_freeze(struct virtio_device *vdev)
 {
 	remove_common(vdev);
@@ -157,7 +157,7 @@ static struct virtio_driver virtio_rng_driver = {
 	.id_table =	id_table,
 	.probe =	virtrng_probe,
 	.remove =	virtrng_remove,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze =	virtrng_freeze,
 	.restore =	virtrng_restore,
 #endif
drivers/char/virtio_console.c +2 -2
index fc45567..2e96246 100644
@@ -2135,7 +2135,7 @@ static struct virtio_device_id rproc_serial_id_table[] = {
 static unsigned int rproc_serial_features[] = {
 };
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtcons_freeze(struct virtio_device *vdev)
 {
 	struct ports_device *portdev;
@@ -2213,7 +2213,7 @@ static struct virtio_driver virtio_console = {
 	.probe =	virtcons_probe,
 	.remove =	virtcons_remove,
 	.config_changed = config_intr,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze =	virtcons_freeze,
 	.restore =	virtcons_restore,
 #endif
drivers/net/virtio_net.c +2 -2
index defec2b..2ad3d96 100644
@@ -1683,7 +1683,7 @@ static void virtnet_remove(struct virtio_device *vdev)
 	free_netdev(vi->dev);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtnet_freeze(struct virtio_device *vdev)
 {
 	struct virtnet_info *vi = vdev->priv;
@@ -1766,7 +1766,7 @@ static struct virtio_driver virtio_net_driver = {
 	.probe =	virtnet_probe,
 	.remove =	virtnet_remove,
 	.config_changed = virtnet_config_changed,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze =	virtnet_freeze,
 	.restore =	virtnet_restore,
 #endif
drivers/scsi/virtio_scsi.c +2 -2
index 74b88ef..2a11039 100644
@@ -954,7 +954,7 @@ static void virtscsi_remove(struct virtio_device *vdev)
 	scsi_host_put(shost);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtscsi_freeze(struct virtio_device *vdev)
 {
 	virtscsi_remove_vqs(vdev);
@@ -988,7 +988,7 @@ static struct virtio_driver virtio_scsi_driver = {
 	.id_table = id_table,
 	.probe = virtscsi_probe,
 	.scan = virtscsi_scan,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze = virtscsi_freeze,
 	.restore = virtscsi_restore,
 #endif
drivers/virtio/virtio_balloon.c +2 -2
index 1f572c0..d6f6816 100644
@@ -513,7 +513,7 @@ static void virtballoon_remove(struct virtio_device *vdev)
 	kfree(vb);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int virtballoon_freeze(struct virtio_device *vdev)
 {
 	struct virtio_balloon *vb = vdev->priv;
@@ -556,7 +556,7 @@ static struct virtio_driver virtio_balloon_driver = {
 	.probe =	virtballoon_probe,
 	.remove =	virtballoon_remove,
 	.config_changed = virtballoon_changed,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.freeze	=	virtballoon_freeze,
 	.restore =	virtballoon_restore,
 #endif
Signature · 1 line
1.8.4.12.g2ea3df6
Reviewed-by on the v1 series
#5 lore raw
In reply to Aaron Lu
Quoted 6 lines · Aaron Lu

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Thank you.

Amit

Reviewed-by on the v1 series
#6 lore raw
In reply to Aaron Lu
Quoted 6 lines · Aaron Lu

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Thank you.

Amit

author
#7 lore raw
Quoted 9 lines · Amit Shah
Quoted 6 lines · Aaron Lu

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Thank you.

My pleasure, thanks for your review.

I was addressing a comment for my patch:
http://marc.info/?l=linux-pm&m=137839111130358&w=2
and accidentally found this issue here :-)

-Aaron

Quoted 5 lines

Amit

author
#10 lore raw
In reply to Amit Shah
Quoted 9 lines · Amit Shah
Quoted 6 lines · Aaron Lu

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Thank you.

My pleasure, thanks for your review.

I was addressing a comment for my patch:
http://marc.info/?l=linux-pm&m=137839111130358&w=2
and accidentally found this issue here :-)

-Aaron

Quoted 5 lines

Amit

#8 lore raw
In reply to Aaron Lu
Quoted 9 lines · Aaron Lu
Quoted 8 lines · Amit Shah
Quoted 6 lines · Aaron Lu

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Quoted 7 lines
Quoted 1 line

Thank you.

My pleasure, thanks for your review.

I was addressing a comment for my patch:
http://marc.info/?l=linux-pm&m=137839111130358&w=2
and accidentally found this issue here :-)

Thanks, Aaron.

I've applied 1/2 previously, now I've applied 2/2.

Cheers,
Rusty.

#9 lore raw
In reply to Aaron Lu
Quoted 9 lines · Aaron Lu
Quoted 8 lines · Amit Shah
Quoted 6 lines · Aaron Lu

This patchset replace CONFIG_PM with CONFIG_PM_SLEEP for all virtio drivers and virtio pci driver.

With patch 1/2, two compile warnings are eliminated for virtio pci driver, and patch 2/2 is a clean up for all virtio drivers as suggested by Amit Shah.

Quoted 7 lines
Quoted 1 line

Thank you.

My pleasure, thanks for your review.

I was addressing a comment for my patch:
http://marc.info/?l=linux-pm&m=137839111130358&w=2
and accidentally found this issue here :-)

Thanks, Aaron.

I've applied 1/2 previously, now I've applied 2/2.

Cheers,
Rusty.