#include <linux/init.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/notifier.h>
#include <linux/platform_data/cros_ec_chardev.h>
#include <linux/platform_data/cros_ec_commands.h>
#include <linux/platform_data/cros_ec_proto.h>
#include <linux/platform_device.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#define DRV_NAME …
#define CROS_MAX_EVENT_LEN …
struct chardev_data { … };
struct chardev_priv { … };
struct ec_event { … };
static int ec_get_version(struct cros_ec_dev *ec, char *str, int maxlen)
{ … }
static int cros_ec_chardev_mkbp_event(struct notifier_block *nb,
unsigned long queued_during_suspend,
void *_notify)
{ … }
static struct ec_event *cros_ec_chardev_fetch_event(struct chardev_priv *priv,
bool fetch, bool block)
{ … }
static int cros_ec_chardev_open(struct inode *inode, struct file *filp)
{ … }
static __poll_t cros_ec_chardev_poll(struct file *filp, poll_table *wait)
{ … }
static ssize_t cros_ec_chardev_read(struct file *filp, char __user *buffer,
size_t length, loff_t *offset)
{ … }
static int cros_ec_chardev_release(struct inode *inode, struct file *filp)
{ … }
static long cros_ec_chardev_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg)
{ … }
static long cros_ec_chardev_ioctl_readmem(struct cros_ec_dev *ec,
void __user *arg)
{ … }
static long cros_ec_chardev_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg)
{ … }
static const struct file_operations chardev_fops = …;
static int cros_ec_chardev_probe(struct platform_device *pdev)
{ … }
static void cros_ec_chardev_remove(struct platform_device *pdev)
{ … }
static const struct platform_device_id cros_ec_chardev_id[] = …;
MODULE_DEVICE_TABLE(platform, cros_ec_chardev_id);
static struct platform_driver cros_ec_chardev_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;