#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/sched/signal.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/mutex.h>
#include <linux/miscdevice.h>
#include <linux/pci.h>
#include <linux/wait.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/nospec.h>
#include <asm/io.h>
#include <linux/uaccess.h>
#include "applicom.h"
#undef DEBUG
#define MAX_BOARD …
#define MAX_ISA_BOARD …
#define LEN_RAM_IO …
#ifndef PCI_VENDOR_ID_APPLICOM
#define PCI_VENDOR_ID_APPLICOM …
#define PCI_DEVICE_ID_APPLICOM_PCIGENERIC …
#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN …
#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB …
#endif
static DEFINE_MUTEX(ac_mutex);
static char *applicom_pci_devnames[] = …;
static const struct pci_device_id applicom_pci_tbl[] = …;
MODULE_DEVICE_TABLE(pci, applicom_pci_tbl);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_MISCDEV(…);
static struct applicom_board { … } apbs[MAX_BOARD];
static unsigned int irq;
static unsigned long mem;
module_param_hw(irq, uint, irq, 0);
MODULE_PARM_DESC(…) …;
module_param_hw(mem, ulong, iomem, 0);
MODULE_PARM_DESC(…) …;
static unsigned int numboards;
static volatile unsigned char Dummy;
static DECLARE_WAIT_QUEUE_HEAD(FlagSleepRec);
static unsigned int WriteErrorCount;
static unsigned int ReadErrorCount;
static unsigned int DeviceErrorCount;
static ssize_t ac_read (struct file *, char __user *, size_t, loff_t *);
static ssize_t ac_write (struct file *, const char __user *, size_t, loff_t *);
static long ac_ioctl(struct file *, unsigned int, unsigned long);
static irqreturn_t ac_interrupt(int, void *);
static const struct file_operations ac_fops = …;
static struct miscdevice ac_miscdev = …;
static int dummy;
static int ac_register_board(unsigned long physloc, void __iomem *loc,
unsigned char boardno)
{ … }
static void __exit applicom_exit(void)
{ … }
static int __init applicom_init(void)
{ … }
module_init(…) …;
module_exit(applicom_exit);
static ssize_t ac_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos)
{ … }
static int do_ac_read(int IndexCard, char __user *buf,
struct st_ram_io *st_loc, struct mailbox *mailbox)
{ … }
static ssize_t ac_read (struct file *filp, char __user *buf, size_t count, loff_t *ptr)
{ … }
static irqreturn_t ac_interrupt(int vec, void *dev_instance)
{ … }
static long ac_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }