linux/drivers/input/serio/serio.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  The Serio abstraction module
 *
 *  Copyright (c) 1999-2004 Vojtech Pavlik
 *  Copyright (c) 2004 Dmitry Torokhov
 *  Copyright (c) 2003 Daniele Bellucci
 */

#define pr_fmt(fmt)

#include <linux/stddef.h>
#include <linux/module.h>
#include <linux/serio.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/mutex.h>

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

/*
 * serio_mutex protects entire serio subsystem and is taken every time
 * serio port or driver registered or unregistered.
 */
static DEFINE_MUTEX(serio_mutex);

static LIST_HEAD(serio_list);

static void serio_add_port(struct serio *serio);
static int serio_reconnect_port(struct serio *serio);
static void serio_disconnect_port(struct serio *serio);
static void serio_reconnect_subtree(struct serio *serio);
static void serio_attach_driver(struct serio_driver *drv);

static int serio_connect_driver(struct serio *serio, struct serio_driver *drv)
{}

static int serio_reconnect_driver(struct serio *serio)
{}

static void serio_disconnect_driver(struct serio *serio)
{}

static int serio_match_port(const struct serio_device_id *ids, struct serio *serio)
{}

/*
 * Basic serio -> driver core mappings
 */

static int serio_bind_driver(struct serio *serio, struct serio_driver *drv)
{}

static void serio_find_driver(struct serio *serio)
{}


/*
 * Serio event processing.
 */

enum serio_event_type {};

struct serio_event {};

static DEFINE_SPINLOCK(serio_event_lock);	/* protects serio_event_list */
static LIST_HEAD(serio_event_list);

static struct serio_event *serio_get_event(void)
{}

static void serio_free_event(struct serio_event *event)
{}

static void serio_remove_duplicate_events(void *object,
					  enum serio_event_type type)
{}

static void serio_handle_event(struct work_struct *work)
{}

static DECLARE_WORK(serio_event_work, serio_handle_event);

static int serio_queue_event(void *object, struct module *owner,
			     enum serio_event_type event_type)
{}

/*
 * Remove all events that have been submitted for a given
 * object, be it serio port or driver.
 */
static void serio_remove_pending_events(void *object)
{}

/*
 * Locate child serio port (if any) that has not been fully registered yet.
 *
 * Children are registered by driver's connect() handler so there can't be a
 * grandchild pending registration together with a child.
 */
static struct serio *serio_get_pending_child(struct serio *parent)
{}

/*
 * Serio port operations
 */

static ssize_t serio_show_description(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t proto_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t extra_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{}

static ssize_t serio_show_bind_mode(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{}

static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RO(type);
static DEVICE_ATTR_RO(proto);
static DEVICE_ATTR_RO(id);
static DEVICE_ATTR_RO(extra);

static struct attribute *serio_device_id_attrs[] =;

static const struct attribute_group serio_id_attr_group =;

static DEVICE_ATTR_RO(modalias);
static DEVICE_ATTR_WO(drvctl);
static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
static DEVICE_ATTR_RO(firmware_id);

static struct attribute *serio_device_attrs[] =;

static const struct attribute_group serio_device_attr_group =;

static const struct attribute_group *serio_device_attr_groups[] =;

static void serio_release_port(struct device *dev)
{}

/*
 * Prepare serio port for registration.
 */
static void serio_init_port(struct serio *serio)
{}

/*
 * Complete serio port registration.
 * Driver core will attempt to find appropriate driver for the port.
 */
static void serio_add_port(struct serio *serio)
{}

/*
 * serio_destroy_port() completes unregistration process and removes
 * port from the system
 */
static void serio_destroy_port(struct serio *serio)
{}

/*
 * Reconnect serio port (re-initialize attached device).
 * If reconnect fails (old device is no longer attached or
 * there was no device to begin with) we do full rescan in
 * hope of finding a driver for the port.
 */
static int serio_reconnect_port(struct serio *serio)
{}

/*
 * Reconnect serio port and all its children (re-initialize attached
 * devices).
 */
static void serio_reconnect_subtree(struct serio *root)
{}

/*
 * serio_disconnect_port() unbinds a port from its driver. As a side effect
 * all children ports are unbound and destroyed.
 */
static void serio_disconnect_port(struct serio *serio)
{}

void serio_rescan(struct serio *serio)
{}
EXPORT_SYMBOL();

void serio_reconnect(struct serio *serio)
{}
EXPORT_SYMBOL();

/*
 * Submits register request to kseriod for subsequent execution.
 * Note that port registration is always asynchronous.
 */
void __serio_register_port(struct serio *serio, struct module *owner)
{}
EXPORT_SYMBOL();

/*
 * Synchronously unregisters serio port.
 */
void serio_unregister_port(struct serio *serio)
{}
EXPORT_SYMBOL();

/*
 * Safely unregisters children ports if they are present.
 */
void serio_unregister_child_port(struct serio *serio)
{}
EXPORT_SYMBOL();


/*
 * Serio driver operations
 */

static ssize_t description_show(struct device_driver *drv, char *buf)
{}
static DRIVER_ATTR_RO(description);

static ssize_t bind_mode_show(struct device_driver *drv, char *buf)
{}

static ssize_t bind_mode_store(struct device_driver *drv, const char *buf, size_t count)
{}
static DRIVER_ATTR_RW(bind_mode);

static struct attribute *serio_driver_attrs[] =;
ATTRIBUTE_GROUPS();

static int serio_driver_probe(struct device *dev)
{}

static void serio_driver_remove(struct device *dev)
{}

static void serio_cleanup(struct serio *serio)
{}

static void serio_shutdown(struct device *dev)
{}

static void serio_attach_driver(struct serio_driver *drv)
{}

int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name)
{}
EXPORT_SYMBOL();

void serio_unregister_driver(struct serio_driver *drv)
{}
EXPORT_SYMBOL();

static void serio_set_drv(struct serio *serio, struct serio_driver *drv)
{}

static int serio_bus_match(struct device *dev, const struct device_driver *drv)
{}

#define SERIO_ADD_UEVENT_VAR

static int serio_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}
#undef SERIO_ADD_UEVENT_VAR

#ifdef CONFIG_PM
static int serio_suspend(struct device *dev)
{}

static int serio_resume(struct device *dev)
{}

static const struct dev_pm_ops serio_pm_ops =;
#endif /* CONFIG_PM */

/* called from serio_driver->connect/disconnect methods under serio_mutex */
int serio_open(struct serio *serio, struct serio_driver *drv)
{}
EXPORT_SYMBOL();

/* called from serio_driver->connect/disconnect methods under serio_mutex */
void serio_close(struct serio *serio)
{}
EXPORT_SYMBOL();

irqreturn_t serio_interrupt(struct serio *serio,
		unsigned char data, unsigned int dfl)
{}
EXPORT_SYMBOL();

const struct bus_type serio_bus =;
EXPORT_SYMBOL();

static int __init serio_init(void)
{}

static void __exit serio_exit(void)
{}

subsys_initcall(serio_init);
module_exit(serio_exit);