Commit 7c18e3c6 authored by Martin Kaiser's avatar Martin Kaiser Committed by Herbert Xu

hwrng: virtio - remove #ifdef guards for PM functions

Use pm_sleep_ptr for the freeze and restore functions instead of putting
them under #ifdef CONFIG_PM_SLEEP. The resulting code is slightly simpler.

pm_sleep_ptr lets the compiler see the functions but also allows removing
them as unused code if !CONFIG_PM_SLEEP.
Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d5734302
...@@ -208,7 +208,6 @@ static void virtrng_scan(struct virtio_device *vdev) ...@@ -208,7 +208,6 @@ static void virtrng_scan(struct virtio_device *vdev)
vi->hwrng_register_done = true; vi->hwrng_register_done = true;
} }
#ifdef CONFIG_PM_SLEEP
static int virtrng_freeze(struct virtio_device *vdev) static int virtrng_freeze(struct virtio_device *vdev)
{ {
remove_common(vdev); remove_common(vdev);
...@@ -238,7 +237,6 @@ static int virtrng_restore(struct virtio_device *vdev) ...@@ -238,7 +237,6 @@ static int virtrng_restore(struct virtio_device *vdev)
return err; return err;
} }
#endif
static const struct virtio_device_id id_table[] = { static const struct virtio_device_id id_table[] = {
{ VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID }, { VIRTIO_ID_RNG, VIRTIO_DEV_ANY_ID },
...@@ -252,10 +250,8 @@ static struct virtio_driver virtio_rng_driver = { ...@@ -252,10 +250,8 @@ static struct virtio_driver virtio_rng_driver = {
.probe = virtrng_probe, .probe = virtrng_probe,
.remove = virtrng_remove, .remove = virtrng_remove,
.scan = virtrng_scan, .scan = virtrng_scan,
#ifdef CONFIG_PM_SLEEP .freeze = pm_sleep_ptr(virtrng_freeze),
.freeze = virtrng_freeze, .restore = pm_sleep_ptr(virtrng_restore),
.restore = virtrng_restore,
#endif
}; };
module_virtio_driver(virtio_rng_driver); module_virtio_driver(virtio_rng_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment