12 #include <linux/types.h>
13 #include <linux/list.h>
15 #include <linux/device.h>
17 #include <linux/slab.h>
52 #define to_gameport_port(d) container_of(d, struct gameport, dev)
65 #define to_gameport_driver(d) container_of(d, struct gameport_driver, driver)
70 #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
74 #define gameport_register_port(gameport) \
75 __gameport_register_port(gameport, THIS_MODULE)
84 static inline void gameport_register_port(
struct gameport *gameport)
102 static inline struct gameport *gameport_allocate_port(
void)
104 struct gameport *gameport = kzalloc(
sizeof(
struct gameport),
GFP_KERNEL);
109 static inline void gameport_free_port(
struct gameport *gameport)
114 static inline void gameport_set_name(
struct gameport *gameport,
const char *
name)
123 static inline void *gameport_get_drvdata(
struct gameport *gameport)
128 static inline void gameport_set_drvdata(
struct gameport *gameport,
void *
data)
136 static inline int gameport_pin_driver(
struct gameport *gameport)
141 static inline void gameport_unpin_driver(
struct gameport *gameport)
150 #define gameport_register_driver(drv) \
151 __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
164 #define module_gameport_driver(__gameport_driver) \
165 module_driver(__gameport_driver, gameport_register_driver, \
166 gameport_unregister_driver)
169 static inline void gameport_trigger(
struct gameport *gameport)
177 static inline unsigned char gameport_read(
struct gameport *gameport)
180 return gameport->
read(gameport);
182 return inb(gameport->
io);
185 static inline int gameport_cooked_read(
struct gameport *gameport,
int *axes,
int *
buttons)
188 return gameport->
cooked_read(gameport, axes, buttons);
193 static inline int gameport_calibrate(
struct gameport *gameport,
int *axes,
int *
max)
196 return gameport->
calibrate(gameport, axes, max);
201 static inline int gameport_time(
struct gameport *gameport,
int time)
203 return (time * gameport->
speed) / 1000;
206 static inline void gameport_set_poll_handler(
struct gameport *gameport,
void (*handler)(
struct gameport *))
211 static inline void gameport_set_poll_interval(
struct gameport *gameport,
unsigned int msecs)