#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/hid.h>
#include <linux/uaccess.h>
#define DRIVER_VERSION …
#define DRIVER_AUTHOR …
#define DRIVER_DESC …
#define DRIVER_NAME …
MODULE_AUTHOR(…);
MODULE_DESCRIPTION(…);
MODULE_LICENSE(…) …;
#define WATCHDOG_HEARTBEAT …
static int heartbeat = …;
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(…) …;
static bool nowayout = … WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(…) …;
#define USB_PCWD_VENDOR_ID …
#define USB_PCWD_PRODUCT_ID …
static const struct usb_device_id usb_pcwd_table[] = …;
MODULE_DEVICE_TABLE(usb, usb_pcwd_table);
#define USB_COMMAND_TIMEOUT …
#define CMD_READ_TEMP …
#define CMD_TRIGGER …
#define CMD_GET_STATUS …
#define CMD_GET_FIRMWARE_VERSION …
#define CMD_GET_DIP_SWITCH_SETTINGS …
#define CMD_READ_WATCHDOG_TIMEOUT …
#define CMD_WRITE_WATCHDOG_TIMEOUT …
#define CMD_ENABLE_WATCHDOG …
#define CMD_DISABLE_WATCHDOG …
static const int heartbeat_tbl[] = …;
static int cards_found;
static unsigned long is_active;
static char expect_release;
struct usb_pcwd_private { … };
static struct usb_pcwd_private *usb_pcwd_device;
static DEFINE_MUTEX(disconnect_mutex);
static int usb_pcwd_probe(struct usb_interface *interface,
const struct usb_device_id *id);
static void usb_pcwd_disconnect(struct usb_interface *interface);
static struct usb_driver usb_pcwd_driver = …;
static void usb_pcwd_intr_done(struct urb *urb)
{ … }
static int usb_pcwd_send_command(struct usb_pcwd_private *usb_pcwd,
unsigned char cmd, unsigned char *msb, unsigned char *lsb)
{ … }
static int usb_pcwd_start(struct usb_pcwd_private *usb_pcwd)
{ … }
static int usb_pcwd_stop(struct usb_pcwd_private *usb_pcwd)
{ … }
static int usb_pcwd_keepalive(struct usb_pcwd_private *usb_pcwd)
{ … }
static int usb_pcwd_set_heartbeat(struct usb_pcwd_private *usb_pcwd, int t)
{ … }
static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd,
int *temperature)
{ … }
static int usb_pcwd_get_timeleft(struct usb_pcwd_private *usb_pcwd,
int *time_left)
{ … }
static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos)
{ … }
static long usb_pcwd_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{ … }
static int usb_pcwd_open(struct inode *inode, struct file *file)
{ … }
static int usb_pcwd_release(struct inode *inode, struct file *file)
{ … }
static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data,
size_t len, loff_t *ppos)
{ … }
static int usb_pcwd_temperature_open(struct inode *inode, struct file *file)
{ … }
static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)
{ … }
static int usb_pcwd_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{ … }
static const struct file_operations usb_pcwd_fops = …;
static struct miscdevice usb_pcwd_miscdev = …;
static const struct file_operations usb_pcwd_temperature_fops = …;
static struct miscdevice usb_pcwd_temperature_miscdev = …;
static struct notifier_block usb_pcwd_notifier = …;
static inline void usb_pcwd_delete(struct usb_pcwd_private *usb_pcwd)
{ … }
static int usb_pcwd_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{ … }
static void usb_pcwd_disconnect(struct usb_interface *interface)
{ … }
module_usb_driver(…) …;