sjur.brandeland at stericsson.com
2013-Jan-17 12:23 UTC
[RFC] virtio_console: Add DRIVER and INTERFACE to uevent.
From: Sjur Br?ndeland <sjur.brandeland at 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 at 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
Rusty Russell
2013-Jan-21 23:25 UTC
[RFC] virtio_console: Add DRIVER and INTERFACE to uevent.
sjur.brandeland at stericsson.com writes:> From: Sjur Br?ndeland <sjur.brandeland at 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 at 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, > SjurHmm, I send all uevent questions to Greg KH (CC'd). Thanks, Rusty.> 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
Maybe Matching Threads
- [RFC] virtio_console: Add DRIVER and INTERFACE to uevent.
- [PATCHv2] virtio_console: Add support for remoteproc serial
- [PATCHv2] virtio_console: Add support for remoteproc serial
- [PATCHv7 0/4] virtio_console: Add rproc_serial driver
- [PATCHv7 0/4] virtio_console: Add rproc_serial driver