All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] virtio_console: Add DRIVER and INTERFACE to uevent.
@ 2013-01-17 12:23 sjur.brandeland
  2013-01-21 23:25 ` Rusty Russell
  0 siblings, 1 reply; 6+ messages in thread
From: sjur.brandeland @ 2013-01-17 12:23 UTC (permalink / raw)
  To: Amit Shah; +Cc: virtualization, Sjur Brændeland, Michael S. Tsirkin

From: Sjur Brændeland <sjur.brandeland@stericsson.com>

Add information so rproc-serial can be easily recogniced
from user space. Add the following information to uevent:
DRIVER=virtio_console|virtio_rproc_serial
INTERFACE=grand-parent/parent/name

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
Hi,

I need some way to identify the major/minor number for
the rproc-serial device, given the udev event. 
Review comments are welcomed.

Thanks,
Sjur

 drivers/char/virtio_console.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 031be0b..96c5ed9 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -2190,6 +2190,27 @@ static struct virtio_driver virtio_rproc_serial = {
 	.remove =	virtcons_remove,
 };
 
+int class_virtio_ports_uevent(struct device *_dev, struct kobj_uevent_env *env)
+{
+	struct port *port = dev_get_drvdata(_dev);
+	struct device *dev;
+	int err;
+
+	if (!port || !port->portdev || !port->portdev->vdev)
+		return 0;
+
+	dev = &port->portdev->vdev->dev;
+	err = add_uevent_var(env, "DRIVER=%s", dev->driver->name);
+	if (err)
+		return err;
+
+	return add_uevent_var(env, "INTERFACE=%s/%s/%s",
+			      dev->parent->parent ?
+					dev_name(dev->parent->parent) : "",
+			      dev->parent ? dev_name(dev->parent) : "",
+			      dev_name(dev));
+}
+
 static int __init init(void)
 {
 	int err;
@@ -2201,6 +2222,7 @@ static int __init init(void)
 		return err;
 	}
 
+	pdrvdata.class->dev_uevent = class_virtio_ports_uevent;
 	pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
 	if (!pdrvdata.debugfs_dir) {
 		pr_warning("Error %ld creating debugfs dir for virtio-ports\n",
-- 
1.7.5.4

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-25  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-17 12:23 [RFC] virtio_console: Add DRIVER and INTERFACE to uevent sjur.brandeland
2013-01-21 23:25 ` Rusty Russell
2013-01-22 16:16   ` Greg KH
2013-01-24 13:30     ` Sjur Brændeland
2013-01-24 16:51       ` Greg KH
2013-01-25  9:27         ` Amit Shah

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.