virtio: console: Generate a kobject CHANGE event on adding 'name' attribute

When the host lets us know what 'name' a port is assigned, we create the
sysfs 'name' attribute. Generate a 'change' event after this so that
udev wakes up and acts on the rules for virtio-ports (currently there's
only one rule that creates a symlink from the 'name' to the actual char
device).

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Amit Shah 2010-03-19 17:36:43 +05:30 committed by Michael S. Tsirkin
parent 220bf991b0
commit ec64213c4d
1 changed files with 9 additions and 2 deletions

View File

@ -947,11 +947,18 @@ static void handle_control_message(struct ports_device *portdev,
*/ */
err = sysfs_create_group(&port->dev->kobj, err = sysfs_create_group(&port->dev->kobj,
&port_attribute_group); &port_attribute_group);
if (err) if (err) {
dev_err(port->dev, dev_err(port->dev,
"Error %d creating sysfs device attributes\n", "Error %d creating sysfs device attributes\n",
err); err);
} else {
/*
* Generate a udev event so that appropriate
* symlinks can be created based on udev
* rules.
*/
kobject_uevent(&port->dev->kobj, KOBJ_CHANGE);
}
break; break;
case VIRTIO_CONSOLE_PORT_REMOVE: case VIRTIO_CONSOLE_PORT_REMOVE:
/* /*