[PATCH 3/9] hw_random: virtio: simplify code

Ahmad Fatoum ahmad at a3f.at
Sun Feb 28 14:08:30 EST 2021


The Linux code did a bit more than we do, but after deleting the
unneeded parts virtrng_probe and virtrng_remove do nothing but
call probe_common/remove_common. Drop the intermediate functions.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 drivers/hw_random/virtio-rng.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/hw_random/virtio-rng.c b/drivers/hw_random/virtio-rng.c
index fbf1a5715a33..7bdacc976e72 100644
--- a/drivers/hw_random/virtio-rng.c
+++ b/drivers/hw_random/virtio-rng.c
@@ -61,7 +61,7 @@ static int virtio_rng_read(struct hwrng *hwrng, void *data, size_t len, bool wai
 	return len;
 }
 
-static int probe_common(struct virtio_device *vdev)
+static int virtrng_probe(struct virtio_device *vdev)
 {
 	struct virtrng_info *vi;
 
@@ -76,22 +76,12 @@ static int probe_common(struct virtio_device *vdev)
 	return virtio_find_vqs(vdev, 1, &vi->rng_vq);
 }
 
-static void remove_common(struct virtio_device *vdev)
+static void virtrng_remove(struct virtio_device *vdev)
 {
 	vdev->config->reset(vdev);
 	vdev->config->del_vqs(vdev);
 }
 
-static int virtrng_probe(struct virtio_device *vdev)
-{
-	return probe_common(vdev);
-}
-
-static void virtrng_remove(struct virtio_device *vdev)
-{
-	remove_common(vdev);
-}
-
 static void virtrng_scan(struct virtio_device *vdev)
 {
 	struct virtrng_info *vi = vdev->priv;
-- 
2.30.0




More information about the barebox mailing list