aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/virtio_config.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/virtio_config.h')
-rw-r--r--include/linux/virtio_config.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index e9e72bda1b72..5206d6541da5 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -102,6 +102,10 @@
102 * vdev: the virtio_device 102 * vdev: the virtio_device
103 * This gives the final feature bits for the device: it can change 103 * This gives the final feature bits for the device: it can change
104 * the dev->feature bits if it wants. 104 * the dev->feature bits if it wants.
105 * @bus_name: return the bus name associated with the device
106 * vdev: the virtio_device
107 * This returns a pointer to the bus name a la pci_name from which
108 * the caller can then copy.
105 */ 109 */
106typedef void vq_callback_t(struct virtqueue *); 110typedef void vq_callback_t(struct virtqueue *);
107struct virtio_config_ops { 111struct virtio_config_ops {
@@ -119,6 +123,7 @@ struct virtio_config_ops {
119 void (*del_vqs)(struct virtio_device *); 123 void (*del_vqs)(struct virtio_device *);
120 u32 (*get_features)(struct virtio_device *vdev); 124 u32 (*get_features)(struct virtio_device *vdev);
121 void (*finalize_features)(struct virtio_device *vdev); 125 void (*finalize_features)(struct virtio_device *vdev);
126 const char *(*bus_name)(struct virtio_device *vdev);
122}; 127};
123 128
124/* If driver didn't advertise the feature, it will never appear. */ 129/* If driver didn't advertise the feature, it will never appear. */
@@ -184,5 +189,14 @@ struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
184 return ERR_PTR(err); 189 return ERR_PTR(err);
185 return vq; 190 return vq;
186} 191}
192
193static inline
194const char *virtio_bus_name(struct virtio_device *vdev)
195{
196 if (!vdev->config->bus_name)
197 return "virtio";
198 return vdev->config->bus_name(vdev);
199}
200
187#endif /* __KERNEL__ */ 201#endif /* __KERNEL__ */
188#endif /* _LINUX_VIRTIO_CONFIG_H */ 202#endif /* _LINUX_VIRTIO_CONFIG_H */