linux/drivers/usb/class/cdc-acm.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * cdc-acm.c
 *
 * Copyright (c) 1999 Armin Fuerst	<[email protected]>
 * Copyright (c) 1999 Pavel Machek	<[email protected]>
 * Copyright (c) 1999 Johannes Erdfelt	<[email protected]>
 * Copyright (c) 2000 Vojtech Pavlik	<[email protected]>
 * Copyright (c) 2004 Oliver Neukum	<[email protected]>
 * Copyright (c) 2005 David Kubicek	<[email protected]>
 * Copyright (c) 2011 Johan Hovold	<[email protected]>
 *
 * USB Abstract Control Model driver for USB modems and ISDN adapters
 *
 * Sponsored by SuSE
 */

#undef DEBUG
#undef VERBOSE_DEBUG

#include <linux/kernel.h>
#include <linux/sched/signal.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/log2.h>
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/tty_ldisc.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <linux/idr.h>
#include <linux/list.h>

#include "cdc-acm.h"


#define DRIVER_AUTHOR
#define DRIVER_DESC

static struct usb_driver acm_driver;
static struct tty_driver *acm_tty_driver;

static DEFINE_IDR(acm_minors);
static DEFINE_MUTEX(acm_minors_lock);

static void acm_tty_set_termios(struct tty_struct *tty,
				const struct ktermios *termios_old);

/*
 * acm_minors accessors
 */

/*
 * Look up an ACM structure by minor. If found and not disconnected, increment
 * its refcount and return it with its mutex held.
 */
static struct acm *acm_get_by_minor(unsigned int minor)
{}

/*
 * Try to find an available minor number and if found, associate it with 'acm'.
 */
static int acm_alloc_minor(struct acm *acm)
{}

/* Release the minor number associated with 'acm'.  */
static void acm_release_minor(struct acm *acm)
{}

/*
 * Functions for ACM control messages.
 */

static int acm_ctrl_msg(struct acm *acm, int request, int value,
							void *buf, int len)
{}

/* devices aren't required to support these requests.
 * the cdc acm descriptor tells whether they do...
 */
static inline int acm_set_control(struct acm *acm, int control)
{}

#define acm_set_line(acm, line)
#define acm_send_break(acm, ms)

static void acm_poison_urbs(struct acm *acm)
{}

static void acm_unpoison_urbs(struct acm *acm)
{}


/*
 * Write buffer management.
 * All of these assume proper locks taken by the caller.
 */

static int acm_wb_alloc(struct acm *acm)
{}

static int acm_wb_is_avail(struct acm *acm)
{}

/*
 * Finish write. Caller must hold acm->write_lock
 */
static void acm_write_done(struct acm *acm, struct acm_wb *wb)
{}

/*
 * Poke write.
 *
 * the caller is responsible for locking
 */

static int acm_start_wb(struct acm *acm, struct acm_wb *wb)
{}

/*
 * attributes exported through sysfs
 */
static ssize_t bmCapabilities_show
(struct device *dev, struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(bmCapabilities);

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

static DEVICE_ATTR_RO(wCountryCodes);

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

static DEVICE_ATTR_RO(iCountryCodeRelDate);
/*
 * Interrupt handlers for various ACM device responses
 */

static void acm_process_notification(struct acm *acm, unsigned char *buf)
{}

/* control interface reports status changes with "interrupt" transfers */
static void acm_ctrl_irq(struct urb *urb)
{}

static int acm_submit_read_urb(struct acm *acm, int index, gfp_t mem_flags)
{}

static int acm_submit_read_urbs(struct acm *acm, gfp_t mem_flags)
{}

static void acm_process_read_urb(struct acm *acm, struct urb *urb)
{}

static void acm_read_bulk_callback(struct urb *urb)
{}

/* data interface wrote those outgoing bytes */
static void acm_write_bulk(struct urb *urb)
{}

static void acm_softint(struct work_struct *work)
{}

/*
 * TTY handlers
 */

static int acm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
{}

static int acm_tty_open(struct tty_struct *tty, struct file *filp)
{}

static void acm_port_dtr_rts(struct tty_port *port, bool active)
{}

static int acm_port_activate(struct tty_port *port, struct tty_struct *tty)
{}

static void acm_port_destruct(struct tty_port *port)
{}

static void acm_port_shutdown(struct tty_port *port)
{}

static void acm_tty_cleanup(struct tty_struct *tty)
{}

static void acm_tty_hangup(struct tty_struct *tty)
{}

static void acm_tty_close(struct tty_struct *tty, struct file *filp)
{}

static ssize_t acm_tty_write(struct tty_struct *tty, const u8 *buf,
			     size_t count)
{}

static unsigned int acm_tty_write_room(struct tty_struct *tty)
{}

static void acm_tty_flush_buffer(struct tty_struct *tty)
{}

static unsigned int acm_tty_chars_in_buffer(struct tty_struct *tty)
{}

static void acm_tty_throttle(struct tty_struct *tty)
{}

static void acm_tty_unthrottle(struct tty_struct *tty)
{}

static int acm_tty_break_ctl(struct tty_struct *tty, int state)
{}

static int acm_tty_tiocmget(struct tty_struct *tty)
{}

static int acm_tty_tiocmset(struct tty_struct *tty,
			    unsigned int set, unsigned int clear)
{}

static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
{}

static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
{}

static int wait_serial_change(struct acm *acm, unsigned long arg)
{}

static int acm_tty_get_icount(struct tty_struct *tty,
					struct serial_icounter_struct *icount)
{}

static int acm_tty_ioctl(struct tty_struct *tty,
					unsigned int cmd, unsigned long arg)
{}

static void acm_tty_set_termios(struct tty_struct *tty,
				const struct ktermios *termios_old)
{}

static const struct tty_port_operations acm_port_ops =;

/*
 * USB probe and disconnect routines.
 */

/* Little helpers: write/read buffers free */
static void acm_write_buffers_free(struct acm *acm)
{}

static void acm_read_buffers_free(struct acm *acm)
{}

/* Little helper: write buffers allocate */
static int acm_write_buffers_alloc(struct acm *acm)
{}

static int acm_probe(struct usb_interface *intf,
		     const struct usb_device_id *id)
{}

static void acm_disconnect(struct usb_interface *intf)
{}

#ifdef CONFIG_PM
static int acm_suspend(struct usb_interface *intf, pm_message_t message)
{}

static int acm_resume(struct usb_interface *intf)
{}

static int acm_reset_resume(struct usb_interface *intf)
{}

#endif /* CONFIG_PM */

static int acm_pre_reset(struct usb_interface *intf)
{}

#define NOKIA_PCSUITE_ACM_INFO(x)

#define SAMSUNG_PCSUITE_ACM_INFO(x)

/*
 * USB driver structure.
 */

static const struct usb_device_id acm_ids[] =;

MODULE_DEVICE_TABLE(usb, acm_ids);

static struct usb_driver acm_driver =;

/*
 * TTY driver structures.
 */

static const struct tty_operations acm_ops =;

/*
 * Init / exit.
 */

static int __init acm_init(void)
{}

static void __exit acm_exit(void)
{}

module_init();
module_exit(acm_exit);

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