From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fixup! net: add virtio network driver
Date: Thu, 16 Sep 2021 11:33:56 +0200 [thread overview]
Message-ID: <20210916093356.20353-1-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20210913083047.364759-1-ahmad@a3f.at>
We already stop the virtio device. Let's clean up the rest too and
unregister the network interface and free the private data.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/net/virtio.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/virtio.c b/drivers/net/virtio.c
index 275588e15c50..ea4d5529037e 100644
--- a/drivers/net/virtio.c
+++ b/drivers/net/virtio.c
@@ -171,6 +171,8 @@ static int virtio_net_probe(struct virtio_device *vdev)
priv = xzalloc(sizeof(*priv));
+ vdev->priv = priv;
+
/*
* For v1.0 compliant device, it always assumes the member
* 'num_buffers' exists in the struct virtio_net_hdr while
@@ -205,8 +207,13 @@ static int virtio_net_probe(struct virtio_device *vdev)
static void virtio_net_remove(struct virtio_device *vdev)
{
+ struct virtio_net_priv *priv = vdev->priv;
+
vdev->config->reset(vdev);
+ eth_unregister(&priv->edev);
vdev->config->del_vqs(vdev);
+
+ free(priv);
}
/*
--
2.30.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-09-16 9:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 8:30 [PATCH] " Ahmad Fatoum
2021-09-16 9:33 ` Ahmad Fatoum [this message]
2021-10-02 9:41 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210916093356.20353-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox