#define pr_fmt(fmt) …
#include <linux/stddef.h>
#include <linux/module.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/gameport.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/timekeeping.h>
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static bool use_ktime = …;
module_param(use_ktime, bool, 0400);
MODULE_PARM_DESC(…) …;
static DEFINE_MUTEX(gameport_mutex);
static LIST_HEAD(gameport_list);
static const struct bus_type gameport_bus;
static void gameport_add_port(struct gameport *gameport);
static void gameport_attach_driver(struct gameport_driver *drv);
static void gameport_reconnect_port(struct gameport *gameport);
static void gameport_disconnect_port(struct gameport *gameport);
#if defined(__i386__)
#include <linux/i8253.h>
#define DELTA …
#define GET_TIME …
static unsigned int get_time_pit(void)
{
unsigned long flags;
unsigned int count;
raw_spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x00, 0x43);
count = inb_p(0x40);
count |= inb_p(0x40) << 8;
raw_spin_unlock_irqrestore(&i8253_lock, flags);
return count;
}
#endif
static int gameport_measure_speed(struct gameport *gameport)
{ … }
static int old_gameport_measure_speed(struct gameport *gameport)
{ … }
void gameport_start_polling(struct gameport *gameport)
{ … }
EXPORT_SYMBOL(…);
void gameport_stop_polling(struct gameport *gameport)
{ … }
EXPORT_SYMBOL(…);
static void gameport_run_poll_handler(struct timer_list *t)
{ … }
static int gameport_bind_driver(struct gameport *gameport, struct gameport_driver *drv)
{ … }
static void gameport_find_driver(struct gameport *gameport)
{ … }
enum gameport_event_type { … };
struct gameport_event { … };
static DEFINE_SPINLOCK(gameport_event_lock);
static LIST_HEAD(gameport_event_list);
static struct gameport_event *gameport_get_event(void)
{ … }
static void gameport_free_event(struct gameport_event *event)
{ … }
static void gameport_remove_duplicate_events(struct gameport_event *event)
{ … }
static void gameport_handle_events(struct work_struct *work)
{ … }
static DECLARE_WORK(gameport_event_work, gameport_handle_events);
static int gameport_queue_event(void *object, struct module *owner,
enum gameport_event_type event_type)
{ … }
static void gameport_remove_pending_events(void *object)
{ … }
static struct gameport *gameport_get_pending_child(struct gameport *parent)
{ … }
static ssize_t gameport_description_show(struct device *dev, struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR(description, S_IRUGO, gameport_description_show, NULL);
static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ … }
static DEVICE_ATTR_WO(drvctl);
static struct attribute *gameport_device_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static void gameport_release_port(struct device *dev)
{ … }
void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
{ … }
EXPORT_SYMBOL(…);
static void gameport_default_trigger(struct gameport *gameport)
{ … }
static unsigned char gameport_default_read(struct gameport *gameport)
{ … }
static void gameport_setup_default_handlers(struct gameport *gameport)
{ … }
static void gameport_init_port(struct gameport *gameport)
{ … }
static void gameport_add_port(struct gameport *gameport)
{ … }
static void gameport_destroy_port(struct gameport *gameport)
{ … }
static void gameport_reconnect_port(struct gameport *gameport)
{ … }
static void gameport_disconnect_port(struct gameport *gameport)
{ … }
void __gameport_register_port(struct gameport *gameport, struct module *owner)
{ … }
EXPORT_SYMBOL(…);
void gameport_unregister_port(struct gameport *gameport)
{ … }
EXPORT_SYMBOL(…);
static ssize_t description_show(struct device_driver *drv, char *buf)
{ … }
static DRIVER_ATTR_RO(description);
static struct attribute *gameport_driver_attrs[] = …;
ATTRIBUTE_GROUPS(…);
static int gameport_driver_probe(struct device *dev)
{ … }
static void gameport_driver_remove(struct device *dev)
{ … }
static void gameport_attach_driver(struct gameport_driver *drv)
{ … }
int __gameport_register_driver(struct gameport_driver *drv, struct module *owner,
const char *mod_name)
{ … }
EXPORT_SYMBOL(…);
void gameport_unregister_driver(struct gameport_driver *drv)
{ … }
EXPORT_SYMBOL(…);
static int gameport_bus_match(struct device *dev, const struct device_driver *drv)
{ … }
static const struct bus_type gameport_bus = …;
static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv)
{ … }
int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode)
{ … }
EXPORT_SYMBOL(…);
void gameport_close(struct gameport *gameport)
{ … }
EXPORT_SYMBOL(…);
static int __init gameport_init(void)
{ … }
static void __exit gameport_exit(void)
{ … }
subsys_initcall(gameport_init);
module_exit(gameport_exit);