linux/drivers/virtio/virtio.c

// SPDX-License-Identifier: GPL-2.0-only
#include <linux/virtio.h>
#include <linux/spinlock.h>
#include <linux/virtio_config.h>
#include <linux/virtio_anchor.h>
#include <linux/module.h>
#include <linux/idr.h>
#include <linux/of.h>
#include <uapi/linux/virtio_ids.h>

/* Unique numbering for virtio devices. */
static DEFINE_IDA(virtio_index_ida);

static ssize_t device_show(struct device *_d,
			   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(device);

static ssize_t vendor_show(struct device *_d,
			   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(vendor);

static ssize_t status_show(struct device *_d,
			   struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(status);

static ssize_t modalias_show(struct device *_d,
			     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(modalias);

static ssize_t features_show(struct device *_d,
			     struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(features);

static struct attribute *virtio_dev_attrs[] =;
ATTRIBUTE_GROUPS();

static inline int virtio_id_match(const struct virtio_device *dev,
				  const struct virtio_device_id *id)
{}

/* This looks through all the IDs a driver claims to support.  If any of them
 * match, we return 1 and the kernel will call virtio_dev_probe(). */
static int virtio_dev_match(struct device *_dv, const struct device_driver *_dr)
{}

static int virtio_uevent(const struct device *_dv, struct kobj_uevent_env *env)
{}

void virtio_check_driver_offered_feature(const struct virtio_device *vdev,
					 unsigned int fbit)
{}
EXPORT_SYMBOL_GPL();

static void __virtio_config_changed(struct virtio_device *dev)
{}

void virtio_config_changed(struct virtio_device *dev)
{}
EXPORT_SYMBOL_GPL();

static void virtio_config_disable(struct virtio_device *dev)
{}

static void virtio_config_enable(struct virtio_device *dev)
{}

void virtio_add_status(struct virtio_device *dev, unsigned int status)
{}
EXPORT_SYMBOL_GPL();

/* Do some validation, then set FEATURES_OK */
static int virtio_features_ok(struct virtio_device *dev)
{}

/**
 * virtio_reset_device - quiesce device for removal
 * @dev: the device to reset
 *
 * Prevents device from sending interrupts and accessing memory.
 *
 * Generally used for cleanup during driver / device removal.
 *
 * Once this has been invoked, caller must ensure that
 * virtqueue_notify / virtqueue_kick are not in progress.
 *
 * Note: this guarantees that vq callbacks are not in progress, however caller
 * is responsible for preventing access from other contexts, such as a system
 * call/workqueue/bh.  Invoking virtio_break_device then flushing any such
 * contexts is one way to handle that.
 * */
void virtio_reset_device(struct virtio_device *dev)
{}
EXPORT_SYMBOL_GPL();

static int virtio_dev_probe(struct device *_d)
{}

static void virtio_dev_remove(struct device *_d)
{}

static const struct bus_type virtio_bus =;

int __register_virtio_driver(struct virtio_driver *driver, struct module *owner)
{}
EXPORT_SYMBOL_GPL();

void unregister_virtio_driver(struct virtio_driver *driver)
{}
EXPORT_SYMBOL_GPL();

static int virtio_device_of_init(struct virtio_device *dev)
{}

/**
 * register_virtio_device - register virtio device
 * @dev        : virtio device to be registered
 *
 * On error, the caller must call put_device on &@dev->dev (and not kfree),
 * as another code path may have obtained a reference to @dev.
 *
 * Returns: 0 on suceess, -error on failure
 */
int register_virtio_device(struct virtio_device *dev)
{}
EXPORT_SYMBOL_GPL();

bool is_virtio_device(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

void unregister_virtio_device(struct virtio_device *dev)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_PM_SLEEP
int virtio_device_freeze(struct virtio_device *dev)
{}
EXPORT_SYMBOL_GPL();

int virtio_device_restore(struct virtio_device *dev)
{}
EXPORT_SYMBOL_GPL();
#endif

static int virtio_init(void)
{}

static void __exit virtio_exit(void)
{}
core_initcall(virtio_init);
module_exit(virtio_exit);

MODULE_DESCRIPTION();
MODULE_LICENSE();