#define pr_fmt(fmt) …
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <media/media-devnode.h>
#include <media/media-device.h>
#define MEDIA_NUM_DEVICES …
#define MEDIA_NAME …
static dev_t media_dev_t;
static DEFINE_MUTEX(media_devnode_lock);
static DECLARE_BITMAP(media_devnode_nums, MEDIA_NUM_DEVICES);
static void media_devnode_release(struct device *cd)
{ … }
static const struct bus_type media_bus_type = …;
static ssize_t media_read(struct file *filp, char __user *buf,
size_t sz, loff_t *off)
{ … }
static ssize_t media_write(struct file *filp, const char __user *buf,
size_t sz, loff_t *off)
{ … }
static __poll_t media_poll(struct file *filp,
struct poll_table_struct *poll)
{ … }
static long
__media_ioctl(struct file *filp, unsigned int cmd, unsigned long arg,
long (*ioctl_func)(struct file *filp, unsigned int cmd,
unsigned long arg))
{ … }
static long media_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ … }
#ifdef CONFIG_COMPAT
static long media_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{ … }
#endif
static int media_open(struct inode *inode, struct file *filp)
{ … }
static int media_release(struct inode *inode, struct file *filp)
{ … }
static const struct file_operations media_devnode_fops = …;
int __must_check media_devnode_register(struct media_device *mdev,
struct media_devnode *devnode,
struct module *owner)
{ … }
void media_devnode_unregister_prepare(struct media_devnode *devnode)
{ … }
void media_devnode_unregister(struct media_devnode *devnode)
{ … }
static int __init media_devnode_init(void)
{ … }
static void __exit media_devnode_exit(void)
{ … }
subsys_initcall(media_devnode_init);
module_exit(…)
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;