#define pr_fmt(fmt) …
#include <linux/debugfs.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <media/v4l2-common.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#define VIDEO_NUM_DEVICES …
#define VIDEO_NAME …
#define dprintk(fmt, arg...) …
static ssize_t index_show(struct device *cd,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(index);
static ssize_t dev_debug_show(struct device *cd,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t dev_debug_store(struct device *cd, struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static DEVICE_ATTR_RW(dev_debug);
static ssize_t name_show(struct device *cd,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(name);
static struct attribute *video_device_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static struct video_device *video_devices[VIDEO_NUM_DEVICES];
static DEFINE_MUTEX(videodev_lock);
static DECLARE_BITMAP(devnode_nums[VFL_TYPE_MAX], VIDEO_NUM_DEVICES);
#ifdef CONFIG_VIDEO_FIXED_MINOR_RANGES
static inline unsigned long *devnode_bits(enum vfl_devnode_type vfl_type)
{ … }
#else
static inline unsigned long *devnode_bits(enum vfl_devnode_type vfl_type)
{
return devnode_nums[vfl_type];
}
#endif
static inline void devnode_set(struct video_device *vdev)
{ … }
static inline void devnode_clear(struct video_device *vdev)
{ … }
static inline int devnode_find(struct video_device *vdev, int from, int to)
{ … }
struct video_device *video_device_alloc(void)
{ … }
EXPORT_SYMBOL(…);
void video_device_release(struct video_device *vdev)
{ … }
EXPORT_SYMBOL(…);
void video_device_release_empty(struct video_device *vdev)
{ … }
EXPORT_SYMBOL(…);
static inline void video_get(struct video_device *vdev)
{ … }
static inline void video_put(struct video_device *vdev)
{ … }
static void v4l2_device_release(struct device *cd)
{ … }
static struct class video_class = …;
struct video_device *video_devdata(struct file *file)
{ … }
EXPORT_SYMBOL(…);
static inline bool prio_is_valid(enum v4l2_priority prio)
{ … }
void v4l2_prio_init(struct v4l2_prio_state *global)
{ … }
EXPORT_SYMBOL(…);
int v4l2_prio_change(struct v4l2_prio_state *global, enum v4l2_priority *local,
enum v4l2_priority new)
{ … }
EXPORT_SYMBOL(…);
void v4l2_prio_open(struct v4l2_prio_state *global, enum v4l2_priority *local)
{ … }
EXPORT_SYMBOL(…);
void v4l2_prio_close(struct v4l2_prio_state *global, enum v4l2_priority local)
{ … }
EXPORT_SYMBOL(…);
enum v4l2_priority v4l2_prio_max(struct v4l2_prio_state *global)
{ … }
EXPORT_SYMBOL(…);
int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local)
{ … }
EXPORT_SYMBOL(…);
static ssize_t v4l2_read(struct file *filp, char __user *buf,
size_t sz, loff_t *off)
{ … }
static ssize_t v4l2_write(struct file *filp, const char __user *buf,
size_t sz, loff_t *off)
{ … }
static __poll_t v4l2_poll(struct file *filp, struct poll_table_struct *poll)
{ … }
static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{ … }
#ifdef CONFIG_MMU
#define v4l2_get_unmapped_area …
#else
static unsigned long v4l2_get_unmapped_area(struct file *filp,
unsigned long addr, unsigned long len, unsigned long pgoff,
unsigned long flags)
{
struct video_device *vdev = video_devdata(filp);
int ret;
if (!vdev->fops->get_unmapped_area)
return -ENOSYS;
if (!video_is_registered(vdev))
return -ENODEV;
ret = vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags);
if (vdev->dev_debug & V4L2_DEV_DEBUG_FOP)
dprintk("%s: get_unmapped_area (%d)\n",
video_device_node_name(vdev), ret);
return ret;
}
#endif
static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm)
{ … }
static int v4l2_open(struct inode *inode, struct file *filp)
{ … }
static int v4l2_release(struct inode *inode, struct file *filp)
{ … }
static const struct file_operations v4l2_fops = …;
static int get_index(struct video_device *vdev)
{ … }
#define SET_VALID_IOCTL(ops, cmd, op) …
static void determine_valid_ioctls(struct video_device *vdev)
{ … }
static int video_register_media_controller(struct video_device *vdev)
{ … }
int __video_register_device(struct video_device *vdev,
enum vfl_devnode_type type,
int nr, int warn_if_nr_in_use,
struct module *owner)
{ … }
EXPORT_SYMBOL(…);
void video_unregister_device(struct video_device *vdev)
{ … }
EXPORT_SYMBOL(…);
#if defined(CONFIG_MEDIA_CONTROLLER)
__must_check int video_device_pipeline_start(struct video_device *vdev,
struct media_pipeline *pipe)
{ … }
EXPORT_SYMBOL_GPL(…);
__must_check int __video_device_pipeline_start(struct video_device *vdev,
struct media_pipeline *pipe)
{ … }
EXPORT_SYMBOL_GPL(…);
void video_device_pipeline_stop(struct video_device *vdev)
{ … }
EXPORT_SYMBOL_GPL(…);
void __video_device_pipeline_stop(struct video_device *vdev)
{ … }
EXPORT_SYMBOL_GPL(…);
__must_check int video_device_pipeline_alloc_start(struct video_device *vdev)
{ … }
EXPORT_SYMBOL_GPL(…);
struct media_pipeline *video_device_pipeline(struct video_device *vdev)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
static int __init videodev_init(void)
{ … }
static void __exit videodev_exit(void)
{ … }
subsys_initcall(videodev_init);
module_exit(…)
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_CHARDEV_MAJOR(…);