#include <linux/kref.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/major.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/wait.h>
#include <linux/mutex.h>
#define DRIVER_DESC …
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;
#define SERIO_RAW_QUEUE_LEN …
struct serio_raw { … };
struct serio_raw_client { … };
static DEFINE_MUTEX(serio_raw_mutex);
static LIST_HEAD(serio_raw_list);
static int serio_raw_fasync(int fd, struct file *file, int on)
{ … }
static struct serio_raw *serio_raw_locate(int minor)
{ … }
static int serio_raw_open(struct inode *inode, struct file *file)
{ … }
static void serio_raw_free(struct kref *kref)
{ … }
static int serio_raw_release(struct inode *inode, struct file *file)
{ … }
static bool serio_raw_fetch_byte(struct serio_raw *serio_raw, char *c)
{ … }
static ssize_t serio_raw_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{ … }
static ssize_t serio_raw_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{ … }
static __poll_t serio_raw_poll(struct file *file, poll_table *wait)
{ … }
static const struct file_operations serio_raw_fops = …;
static irqreturn_t serio_raw_interrupt(struct serio *serio, unsigned char data,
unsigned int dfl)
{ … }
static int serio_raw_connect(struct serio *serio, struct serio_driver *drv)
{ … }
static int serio_raw_reconnect(struct serio *serio)
{ … }
static void serio_raw_hangup(struct serio_raw *serio_raw)
{ … }
static void serio_raw_disconnect(struct serio *serio)
{ … }
static const struct serio_device_id serio_raw_serio_ids[] = …;
MODULE_DEVICE_TABLE(serio, serio_raw_serio_ids);
static struct serio_driver serio_raw_drv = …;
module_serio_driver(…) …;