linux/include/linux/gameport.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  Copyright (c) 1999-2002 Vojtech Pavlik
 */
#ifndef _GAMEPORT_H
#define _GAMEPORT_H

#include <linux/types.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/device.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <uapi/linux/gameport.h>

struct gameport {};
#define to_gameport_port(d)

struct gameport_driver {};
#define to_gameport_driver(d)

int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode);
void gameport_close(struct gameport *gameport);

#if IS_REACHABLE(CONFIG_GAMEPORT)

void __gameport_register_port(struct gameport *gameport, struct module *owner);
/* use a define to avoid include chaining to get THIS_MODULE */
#define gameport_register_port(gameport)

void gameport_unregister_port(struct gameport *gameport);

__printf(2, 3)
void gameport_set_phys(struct gameport *gameport, const char *fmt, ...);

#else

static inline void gameport_register_port(struct gameport *gameport)
{
	return;
}

static inline void gameport_unregister_port(struct gameport *gameport)
{
	return;
}

static inline __printf(2, 3)
void gameport_set_phys(struct gameport *gameport, const char *fmt, ...)
{
	return;
}

#endif

static inline struct gameport *gameport_allocate_port(void)
{}

static inline void gameport_free_port(struct gameport *gameport)
{}

static inline void gameport_set_name(struct gameport *gameport, const char *name)
{}

/*
 * Use the following functions to manipulate gameport's per-port
 * driver-specific data.
 */
static inline void *gameport_get_drvdata(struct gameport *gameport)
{}

static inline void gameport_set_drvdata(struct gameport *gameport, void *data)
{}

/*
 * Use the following functions to pin gameport's driver in process context
 */
static inline int gameport_pin_driver(struct gameport *gameport)
{}

static inline void gameport_unpin_driver(struct gameport *gameport)
{}

int __must_check __gameport_register_driver(struct gameport_driver *drv,
				struct module *owner, const char *mod_name);

/* use a define to avoid include chaining to get THIS_MODULE & friends */
#define gameport_register_driver(drv)

void gameport_unregister_driver(struct gameport_driver *drv);

/**
 * module_gameport_driver() - Helper macro for registering a gameport driver
 * @__gameport_driver: gameport_driver struct
 *
 * Helper macro for gameport drivers which do not do anything special in
 * module init/exit. This eliminates a lot of boilerplate. Each module may
 * only use this macro once, and calling it replaces module_init() and
 * module_exit().
 */
#define module_gameport_driver(__gameport_driver)


static inline void gameport_trigger(struct gameport *gameport)
{}

static inline unsigned char gameport_read(struct gameport *gameport)
{}

static inline int gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{}

static inline int gameport_calibrate(struct gameport *gameport, int *axes, int *max)
{}

static inline int gameport_time(struct gameport *gameport, int time)
{}

static inline void gameport_set_poll_handler(struct gameport *gameport, void (*handler)(struct gameport *))
{}

static inline void gameport_set_poll_interval(struct gameport *gameport, unsigned int msecs)
{}

void gameport_start_polling(struct gameport *gameport);
void gameport_stop_polling(struct gameport *gameport);

#endif