All trivial, thanks to the stuff which didn't quite make it time.

Cheers,
 Rusty.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJRLEkHAAoJENkgDmzRrbjx6K0P/3o9/iW5hkOPYpu+KV2nr0wG
 6RG0uu0DCOb/tckigYwnn5PkS7UEcJu6kDypnEgXfhcNhYiBjoGIAUEQ2jBYyzQm
 IYc4oZhxDdqigJL/FHi2zL50mkWacTdBK83udxim3eRkgW9ysBRoBFwqMruVyhZv
 474KGS4PNT8pHDOCAlrRS1I9oW2pYTuUidN+SnfVJ8gFSkH0tuHEGoJeGrtDa010
 XkiWqiTJq6pDHTM5f4Wwp/WNQ21UNDBlvRahg0nqTZXicQsvujV0Tdb+EnAfXwa+
 bssqvO4X2WqlraVK1TJteufhcdhUgt/I1+45p9eLZvOXizk7EBKxFWynE7C878GV
 dhpz8i4mc+u6aJlGoHzwvKah0zhwDtqWdbDS+LNQjRmjMK9v45ttoisU+iR1GjLt
 JpDVg73K315aWJ9RLsYu7mvZ8JY+qRFkwXqX3lZd+GdohY0DSmGMxMqJG93sLBYi
 42vyHMaBd1JY0rDVqpfzlmjnSxX+k05uB0GYB3fO0CXbPxmfXtRKz7/5wpSz0Up+
 nTCs6Xa7t5jtG9qpC4cKxyEDEwB9M6SSxi+lhrIBkeDqlFwXAv1Fean4jqqhtFwr
 HO6i1mYgy0xCVY7EmequVyWlH6/B5GVB2xTMQuAz3f8pKm+XUr6C/twROYkgoXbV
 AOVyRWtnbISDVjtVFn9c
 =KcDx
 -----END PGP SIGNATURE-----

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.
This commit is contained in:
Linus Torvalds 2013-02-26 14:49:12 -08:00
commit 3c834b6f41
10 changed files with 26 additions and 59 deletions

View File

@ -154,18 +154,7 @@ static struct virtio_driver virtio_rng_driver = {
#endif #endif
}; };
static int __init init(void) module_virtio_driver(virtio_rng_driver);
{
return register_virtio_driver(&virtio_rng_driver);
}
static void __exit fini(void)
{
unregister_virtio_driver(&virtio_rng_driver);
}
module_init(init);
module_exit(fini);
MODULE_DEVICE_TABLE(virtio, id_table); MODULE_DEVICE_TABLE(virtio, id_table);
MODULE_DESCRIPTION("Virtio random number driver"); MODULE_DESCRIPTION("Virtio random number driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");

View File

@ -61,9 +61,6 @@ struct ports_driver_data {
/* List of all the devices we're handling */ /* List of all the devices we're handling */
struct list_head portdevs; struct list_head portdevs;
/* Number of devices this driver is handling */
unsigned int index;
/* /*
* This is used to keep track of the number of hvc consoles * This is used to keep track of the number of hvc consoles
* spawned by this driver. This number is given as the first * spawned by this driver. This number is given as the first
@ -169,9 +166,6 @@ struct ports_device {
/* Array of per-port IO virtqueues */ /* Array of per-port IO virtqueues */
struct virtqueue **in_vqs, **out_vqs; struct virtqueue **in_vqs, **out_vqs;
/* Used for numbering devices for sysfs and debugfs */
unsigned int drv_index;
/* Major number for this device. Ports will be created as minors. */ /* Major number for this device. Ports will be created as minors. */
int chr_major; int chr_major;
}; };
@ -1415,7 +1409,7 @@ static int add_port(struct ports_device *portdev, u32 id)
} }
port->dev = device_create(pdrvdata.class, &port->portdev->vdev->dev, port->dev = device_create(pdrvdata.class, &port->portdev->vdev->dev,
devt, port, "vport%up%u", devt, port, "vport%up%u",
port->portdev->drv_index, id); port->portdev->vdev->index, id);
if (IS_ERR(port->dev)) { if (IS_ERR(port->dev)) {
err = PTR_ERR(port->dev); err = PTR_ERR(port->dev);
dev_err(&port->portdev->vdev->dev, dev_err(&port->portdev->vdev->dev,
@ -1442,7 +1436,7 @@ static int add_port(struct ports_device *portdev, u32 id)
* rproc_serial does not want the console port, only * rproc_serial does not want the console port, only
* the generic port implementation. * the generic port implementation.
*/ */
port->host_connected = true; port->host_connected = port->guest_connected = true;
else if (!use_multiport(port->portdev)) { else if (!use_multiport(port->portdev)) {
/* /*
* If we're not using multiport support, * If we're not using multiport support,
@ -1470,7 +1464,7 @@ static int add_port(struct ports_device *portdev, u32 id)
* inspect a port's state at any time * inspect a port's state at any time
*/ */
sprintf(debugfs_name, "vport%up%u", sprintf(debugfs_name, "vport%up%u",
port->portdev->drv_index, id); port->portdev->vdev->index, id);
port->debugfs_file = debugfs_create_file(debugfs_name, 0444, port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
pdrvdata.debugfs_dir, pdrvdata.debugfs_dir,
port, port,
@ -1958,16 +1952,12 @@ static int virtcons_probe(struct virtio_device *vdev)
portdev->vdev = vdev; portdev->vdev = vdev;
vdev->priv = portdev; vdev->priv = portdev;
spin_lock_irq(&pdrvdata_lock);
portdev->drv_index = pdrvdata.index++;
spin_unlock_irq(&pdrvdata_lock);
portdev->chr_major = register_chrdev(0, "virtio-portsdev", portdev->chr_major = register_chrdev(0, "virtio-portsdev",
&portdev_fops); &portdev_fops);
if (portdev->chr_major < 0) { if (portdev->chr_major < 0) {
dev_err(&vdev->dev, dev_err(&vdev->dev,
"Error %d registering chrdev for device %u\n", "Error %d registering chrdev for device %u\n",
portdev->chr_major, portdev->drv_index); portdev->chr_major, vdev->index);
err = portdev->chr_major; err = portdev->chr_major;
goto free; goto free;
} }

View File

@ -396,7 +396,7 @@ static const char *lg_bus_name(struct virtio_device *vdev)
} }
/* The ops structure which hooks everything together. */ /* The ops structure which hooks everything together. */
static struct virtio_config_ops lguest_config_ops = { static const struct virtio_config_ops lguest_config_ops = {
.get_features = lg_get_features, .get_features = lg_get_features,
.finalize_features = lg_finalize_features, .finalize_features = lg_finalize_features,
.get = lg_get, .get = lg_get,

View File

@ -1736,17 +1736,7 @@ static struct virtio_driver virtio_net_driver = {
#endif #endif
}; };
static int __init init(void) module_virtio_driver(virtio_net_driver);
{
return register_virtio_driver(&virtio_net_driver);
}
static void __exit fini(void)
{
unregister_virtio_driver(&virtio_net_driver);
}
module_init(init);
module_exit(fini);
MODULE_DEVICE_TABLE(virtio, id_table); MODULE_DEVICE_TABLE(virtio, id_table);
MODULE_DESCRIPTION("Virtio network driver"); MODULE_DESCRIPTION("Virtio network driver");

View File

@ -222,7 +222,7 @@ static void rproc_virtio_finalize_features(struct virtio_device *vdev)
rvdev->gfeatures = vdev->features[0]; rvdev->gfeatures = vdev->features[0];
} }
static struct virtio_config_ops rproc_virtio_config_ops = { static const struct virtio_config_ops rproc_virtio_config_ops = {
.get_features = rproc_virtio_get_features, .get_features = rproc_virtio_get_features,
.finalize_features = rproc_virtio_finalize_features, .finalize_features = rproc_virtio_finalize_features,
.find_vqs = rproc_virtio_find_vqs, .find_vqs = rproc_virtio_find_vqs,

View File

@ -275,7 +275,7 @@ static const char *kvm_bus_name(struct virtio_device *vdev)
/* /*
* The config ops structure as defined by virtio config * The config ops structure as defined by virtio config
*/ */
static struct virtio_config_ops kvm_vq_configspace_ops = { static const struct virtio_config_ops kvm_vq_configspace_ops = {
.get_features = kvm_get_features, .get_features = kvm_get_features,
.finalize_features = kvm_finalize_features, .finalize_features = kvm_finalize_features,
.get = kvm_get, .get = kvm_get,

View File

@ -560,18 +560,7 @@ static struct virtio_driver virtio_balloon_driver = {
#endif #endif
}; };
static int __init init(void) module_virtio_driver(virtio_balloon_driver);
{
return register_virtio_driver(&virtio_balloon_driver);
}
static void __exit fini(void)
{
unregister_virtio_driver(&virtio_balloon_driver);
}
module_init(init);
module_exit(fini);
MODULE_DEVICE_TABLE(virtio, id_table); MODULE_DEVICE_TABLE(virtio, id_table);
MODULE_DESCRIPTION("Virtio balloon driver"); MODULE_DESCRIPTION("Virtio balloon driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");

View File

@ -75,7 +75,7 @@
* *
* 0x050 W QueueNotify Queue notifier * 0x050 W QueueNotify Queue notifier
* 0x060 R InterruptStatus Interrupt status register * 0x060 R InterruptStatus Interrupt status register
* 0x060 W InterruptACK Interrupt acknowledge register * 0x064 W InterruptACK Interrupt acknowledge register
* 0x070 RW Status Device status register * 0x070 RW Status Device status register
* *
* 0x100+ RW Device-specific configuration space * 0x100+ RW Device-specific configuration space
@ -423,7 +423,7 @@ static const char *vm_bus_name(struct virtio_device *vdev)
return vm_dev->pdev->name; return vm_dev->pdev->name;
} }
static struct virtio_config_ops virtio_mmio_config_ops = { static const struct virtio_config_ops virtio_mmio_config_ops = {
.get = vm_get, .get = vm_get,
.set = vm_set, .set = vm_set,
.get_status = vm_get_status, .get_status = vm_get_status,

View File

@ -91,9 +91,9 @@ struct virtio_pci_vq_info
}; };
/* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */ /* Qumranet donated their vendor ID for devices 0x1000 thru 0x10FF. */
static struct pci_device_id virtio_pci_id_table[] = { static DEFINE_PCI_DEVICE_TABLE(virtio_pci_id_table) = {
{ 0x1af4, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { PCI_DEVICE(0x1af4, PCI_ANY_ID) },
{ 0 }, { 0 }
}; };
MODULE_DEVICE_TABLE(pci, virtio_pci_id_table); MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
@ -652,7 +652,7 @@ static int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
return 0; return 0;
} }
static struct virtio_config_ops virtio_pci_config_ops = { static const struct virtio_config_ops virtio_pci_config_ops = {
.get = vp_get, .get = vp_get,
.set = vp_set, .set = vp_set,
.get_status = vp_get_status, .get_status = vp_get_status,

View File

@ -78,7 +78,7 @@ struct virtio_device {
int index; int index;
struct device dev; struct device dev;
struct virtio_device_id id; struct virtio_device_id id;
struct virtio_config_ops *config; const struct virtio_config_ops *config;
struct list_head vqs; struct list_head vqs;
/* Note that this is a Linux set_bit-style bitmap. */ /* Note that this is a Linux set_bit-style bitmap. */
unsigned long features[1]; unsigned long features[1];
@ -126,4 +126,13 @@ static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
int register_virtio_driver(struct virtio_driver *drv); int register_virtio_driver(struct virtio_driver *drv);
void unregister_virtio_driver(struct virtio_driver *drv); void unregister_virtio_driver(struct virtio_driver *drv);
/* module_virtio_driver() - Helper macro for drivers that don't do
* anything special in module init/exit. This eliminates a lot of
* boilerplate. Each module may only use this macro once, and
* calling it replaces module_init() and module_exit()
*/
#define module_virtio_driver(__virtio_driver) \
module_driver(__virtio_driver, register_virtio_driver, \
unregister_virtio_driver)
#endif /* _LINUX_VIRTIO_H */ #endif /* _LINUX_VIRTIO_H */