#include <linux/module.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/idr.h>
#include <linux/sched/signal.h>
#include <linux/string.h>
#include <linux/kobject.h>
#include <linux/cdev.h>
#include <linux/uio_driver.h>
#include <linux/dma-mapping.h>
#define UIO_MAX_DEVICES …
static int uio_major;
static struct cdev *uio_cdev;
static DEFINE_IDR(uio_idr);
static const struct file_operations uio_fops;
static DEFINE_MUTEX(minor_lock);
struct uio_map { … };
#define to_map(map) …
static ssize_t map_name_show(struct uio_mem *mem, char *buf)
{ … }
static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
{ … }
static ssize_t map_size_show(struct uio_mem *mem, char *buf)
{ … }
static ssize_t map_offset_show(struct uio_mem *mem, char *buf)
{ … }
struct map_sysfs_entry { … };
static struct map_sysfs_entry name_attribute = …;
static struct map_sysfs_entry addr_attribute = …;
static struct map_sysfs_entry size_attribute = …;
static struct map_sysfs_entry offset_attribute = …;
static struct attribute *map_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void map_release(struct kobject *kobj)
{ … }
static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{ … }
static const struct sysfs_ops map_sysfs_ops = …;
static struct kobj_type map_attr_type = …;
struct uio_portio { … };
#define to_portio(portio) …
static ssize_t portio_name_show(struct uio_port *port, char *buf)
{ … }
static ssize_t portio_start_show(struct uio_port *port, char *buf)
{ … }
static ssize_t portio_size_show(struct uio_port *port, char *buf)
{ … }
static ssize_t portio_porttype_show(struct uio_port *port, char *buf)
{ … }
struct portio_sysfs_entry { … };
static struct portio_sysfs_entry portio_name_attribute = …;
static struct portio_sysfs_entry portio_start_attribute = …;
static struct portio_sysfs_entry portio_size_attribute = …;
static struct portio_sysfs_entry portio_porttype_attribute = …;
static struct attribute *portio_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void portio_release(struct kobject *kobj)
{ … }
static ssize_t portio_type_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{ … }
static const struct sysfs_ops portio_sysfs_ops = …;
static struct kobj_type portio_attr_type = …;
static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static ssize_t version_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(version);
static ssize_t event_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(event);
static struct attribute *uio_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static struct class uio_class = …;
static bool uio_class_registered;
static int uio_dev_add_attributes(struct uio_device *idev)
{ … }
static void uio_dev_del_attributes(struct uio_device *idev)
{ … }
static int uio_get_minor(struct uio_device *idev)
{ … }
static void uio_free_minor(unsigned long minor)
{ … }
void uio_event_notify(struct uio_info *info)
{ … }
EXPORT_SYMBOL_GPL(…);
static irqreturn_t uio_interrupt_handler(int irq, void *dev_id)
{ … }
static irqreturn_t uio_interrupt_thread(int irq, void *dev_id)
{ … }
struct uio_listener { … };
static int uio_open(struct inode *inode, struct file *filep)
{ … }
static int uio_fasync(int fd, struct file *filep, int on)
{ … }
static int uio_release(struct inode *inode, struct file *filep)
{ … }
static __poll_t uio_poll(struct file *filep, poll_table *wait)
{ … }
static ssize_t uio_read(struct file *filep, char __user *buf,
size_t count, loff_t *ppos)
{ … }
static ssize_t uio_write(struct file *filep, const char __user *buf,
size_t count, loff_t *ppos)
{ … }
static int uio_find_mem_index(struct vm_area_struct *vma)
{ … }
static vm_fault_t uio_vma_fault(struct vm_fault *vmf)
{ … }
static const struct vm_operations_struct uio_logical_vm_ops = …;
static int uio_mmap_logical(struct vm_area_struct *vma)
{ … }
static const struct vm_operations_struct uio_physical_vm_ops = …;
static int uio_mmap_physical(struct vm_area_struct *vma)
{ … }
static int uio_mmap_dma_coherent(struct vm_area_struct *vma)
{ … }
static int uio_mmap(struct file *filep, struct vm_area_struct *vma)
{ … }
static const struct file_operations uio_fops = …;
static int uio_major_init(void)
{ … }
static void uio_major_cleanup(void)
{ … }
static int init_uio_class(void)
{ … }
static void release_uio_class(void)
{ … }
static void uio_device_release(struct device *dev)
{ … }
int __uio_register_device(struct module *owner,
struct device *parent,
struct uio_info *info)
{ … }
EXPORT_SYMBOL_GPL(…);
static void devm_uio_unregister_device(struct device *dev, void *res)
{ … }
int __devm_uio_register_device(struct module *owner,
struct device *parent,
struct uio_info *info)
{ … }
EXPORT_SYMBOL_GPL(…);
void uio_unregister_device(struct uio_info *info)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __init uio_init(void)
{ … }
static void __exit uio_exit(void)
{ … }
module_init(…) …
module_exit(…)
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;