summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-22 10:03:51 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-22 10:03:51 -0700
commit7b1f513aacee53ed2d20cdf82191c7f486136469 (patch)
treeeecd228c44fec22c19d7368c48094df722727bbf
parent258152acc09c5c2df97002cd58cb37cb241aacde (diff)
parent2de16a493cc6153f7fa0b9da12a3862d063e3425 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio: console: Check if port is valid in resize_console virtio: console: Generate a kobject CHANGE event on adding 'name' attribute
-rw-r--r--drivers/char/virtio_console.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index f404ccfc9c20..44288ce0cb45 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -681,6 +681,10 @@ static void resize_console(struct port *port)
struct virtio_device *vdev;
struct winsize ws;
+ /* The port could have been hot-unplugged */
+ if (!port)
+ return;
+
vdev = port->portdev->vdev;
if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE)) {
vdev->config->get(vdev,
@@ -947,11 +951,18 @@ static void handle_control_message(struct ports_device *portdev,
*/
err = sysfs_create_group(&port->dev->kobj,
&port_attribute_group);
- if (err)
+ if (err) {
dev_err(port->dev,
"Error %d creating sysfs device attributes\n",
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;
case VIRTIO_CONSOLE_PORT_REMOVE:
/*