diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 17:49:12 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-26 17:49:12 -0500 |
commit | 3c834b6f41fa21a48389b13c3bf63aa8df1d7080 (patch) | |
tree | 126447276497510f44277e8442715e103e2cb85a /drivers/char | |
parent | 515d01f7726b9ba4838787d247115e1b259e1cc7 (diff) | |
parent | 8078db789a92b10ff6e2d713231b5367e014c53b (diff) |
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio updates from Rusty Russell:
"All trivial, thanks to the stuff which didn't quite make it time"
* tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
virtio_console: Initialize guest_connected=true for rproc_serial
virtio: use module_virtio_driver.
virtio: Add module driver macro for virtio drivers.
virtio_console: Use virtio device index to generate port name
virtio: make pci_device_id const
virtio: make config_ops const
virtio-mmio: fix wrong comment about register offset
virtio_console: Let unconnected rproc device receive data.
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/virtio-rng.c | 13 | ||||
-rw-r--r-- | drivers/char/virtio_console.c | 18 |
2 files changed, 5 insertions, 26 deletions
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index b65c10395959..10fd71ccf587 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -154,18 +154,7 @@ static struct virtio_driver virtio_rng_driver = { | |||
154 | #endif | 154 | #endif |
155 | }; | 155 | }; |
156 | 156 | ||
157 | static int __init init(void) | 157 | module_virtio_driver(virtio_rng_driver); |
158 | { | ||
159 | return register_virtio_driver(&virtio_rng_driver); | ||
160 | } | ||
161 | |||
162 | static void __exit fini(void) | ||
163 | { | ||
164 | unregister_virtio_driver(&virtio_rng_driver); | ||
165 | } | ||
166 | module_init(init); | ||
167 | module_exit(fini); | ||
168 | |||
169 | MODULE_DEVICE_TABLE(virtio, id_table); | 158 | MODULE_DEVICE_TABLE(virtio, id_table); |
170 | MODULE_DESCRIPTION("Virtio random number driver"); | 159 | MODULE_DESCRIPTION("Virtio random number driver"); |
171 | MODULE_LICENSE("GPL"); | 160 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index ee4dbeafb377..e905d5f53051 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -61,9 +61,6 @@ struct ports_driver_data { | |||
61 | /* List of all the devices we're handling */ | 61 | /* List of all the devices we're handling */ |
62 | struct list_head portdevs; | 62 | struct list_head portdevs; |
63 | 63 | ||
64 | /* Number of devices this driver is handling */ | ||
65 | unsigned int index; | ||
66 | |||
67 | /* | 64 | /* |
68 | * This is used to keep track of the number of hvc consoles | 65 | * This is used to keep track of the number of hvc consoles |
69 | * spawned by this driver. This number is given as the first | 66 | * spawned by this driver. This number is given as the first |
@@ -169,9 +166,6 @@ struct ports_device { | |||
169 | /* Array of per-port IO virtqueues */ | 166 | /* Array of per-port IO virtqueues */ |
170 | struct virtqueue **in_vqs, **out_vqs; | 167 | struct virtqueue **in_vqs, **out_vqs; |
171 | 168 | ||
172 | /* Used for numbering devices for sysfs and debugfs */ | ||
173 | unsigned int drv_index; | ||
174 | |||
175 | /* Major number for this device. Ports will be created as minors. */ | 169 | /* Major number for this device. Ports will be created as minors. */ |
176 | int chr_major; | 170 | int chr_major; |
177 | }; | 171 | }; |
@@ -1415,7 +1409,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1415 | } | 1409 | } |
1416 | port->dev = device_create(pdrvdata.class, &port->portdev->vdev->dev, | 1410 | port->dev = device_create(pdrvdata.class, &port->portdev->vdev->dev, |
1417 | devt, port, "vport%up%u", | 1411 | devt, port, "vport%up%u", |
1418 | port->portdev->drv_index, id); | 1412 | port->portdev->vdev->index, id); |
1419 | if (IS_ERR(port->dev)) { | 1413 | if (IS_ERR(port->dev)) { |
1420 | err = PTR_ERR(port->dev); | 1414 | err = PTR_ERR(port->dev); |
1421 | dev_err(&port->portdev->vdev->dev, | 1415 | dev_err(&port->portdev->vdev->dev, |
@@ -1442,7 +1436,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1442 | * rproc_serial does not want the console port, only | 1436 | * rproc_serial does not want the console port, only |
1443 | * the generic port implementation. | 1437 | * the generic port implementation. |
1444 | */ | 1438 | */ |
1445 | port->host_connected = true; | 1439 | port->host_connected = port->guest_connected = true; |
1446 | else if (!use_multiport(port->portdev)) { | 1440 | else if (!use_multiport(port->portdev)) { |
1447 | /* | 1441 | /* |
1448 | * If we're not using multiport support, | 1442 | * If we're not using multiport support, |
@@ -1470,7 +1464,7 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1470 | * inspect a port's state at any time | 1464 | * inspect a port's state at any time |
1471 | */ | 1465 | */ |
1472 | sprintf(debugfs_name, "vport%up%u", | 1466 | sprintf(debugfs_name, "vport%up%u", |
1473 | port->portdev->drv_index, id); | 1467 | port->portdev->vdev->index, id); |
1474 | port->debugfs_file = debugfs_create_file(debugfs_name, 0444, | 1468 | port->debugfs_file = debugfs_create_file(debugfs_name, 0444, |
1475 | pdrvdata.debugfs_dir, | 1469 | pdrvdata.debugfs_dir, |
1476 | port, | 1470 | port, |
@@ -1958,16 +1952,12 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
1958 | portdev->vdev = vdev; | 1952 | portdev->vdev = vdev; |
1959 | vdev->priv = portdev; | 1953 | vdev->priv = portdev; |
1960 | 1954 | ||
1961 | spin_lock_irq(&pdrvdata_lock); | ||
1962 | portdev->drv_index = pdrvdata.index++; | ||
1963 | spin_unlock_irq(&pdrvdata_lock); | ||
1964 | |||
1965 | portdev->chr_major = register_chrdev(0, "virtio-portsdev", | 1955 | portdev->chr_major = register_chrdev(0, "virtio-portsdev", |
1966 | &portdev_fops); | 1956 | &portdev_fops); |
1967 | if (portdev->chr_major < 0) { | 1957 | if (portdev->chr_major < 0) { |
1968 | dev_err(&vdev->dev, | 1958 | dev_err(&vdev->dev, |
1969 | "Error %d registering chrdev for device %u\n", | 1959 | "Error %d registering chrdev for device %u\n", |
1970 | portdev->chr_major, portdev->drv_index); | 1960 | portdev->chr_major, vdev->index); |
1971 | err = portdev->chr_major; | 1961 | err = portdev->chr_major; |
1972 | goto free; | 1962 | goto free; |
1973 | } | 1963 | } |