#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/sched/signal.h>
#include <linux/wait.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/mutex.h>
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/idr.h>
#include <linux/fs.h>
#include <linux/kdev_t.h>
#include <linux/kfifo.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/greybus.h>
#include "gbphy.h"
#define GB_NUM_MINORS …
#define GB_NAME …
#define GB_UART_WRITE_FIFO_SIZE …
#define GB_UART_WRITE_ROOM_MARGIN …
#define GB_UART_FIRMWARE_CREDITS …
#define GB_UART_CREDIT_WAIT_TIMEOUT_MSEC …
struct gb_tty { … };
static struct tty_driver *gb_tty_driver;
static DEFINE_IDR(tty_minors);
static DEFINE_MUTEX(table_lock);
static int gb_uart_receive_data_handler(struct gb_operation *op)
{ … }
static int gb_uart_serial_state_handler(struct gb_operation *op)
{ … }
static int gb_uart_receive_credits_handler(struct gb_operation *op)
{ … }
static int gb_uart_request_handler(struct gb_operation *op)
{ … }
static void gb_uart_tx_write_work(struct work_struct *work)
{ … }
static int send_line_coding(struct gb_tty *tty)
{ … }
static int send_control(struct gb_tty *gb_tty, u8 control)
{ … }
static int send_break(struct gb_tty *gb_tty, u8 state)
{ … }
static int gb_uart_wait_for_all_credits(struct gb_tty *gb_tty)
{ … }
static int gb_uart_flush(struct gb_tty *gb_tty, u8 flags)
{ … }
static struct gb_tty *get_gb_by_minor(unsigned int minor)
{ … }
static int alloc_minor(struct gb_tty *gb_tty)
{ … }
static void release_minor(struct gb_tty *gb_tty)
{ … }
static int gb_tty_install(struct tty_driver *driver, struct tty_struct *tty)
{ … }
static int gb_tty_open(struct tty_struct *tty, struct file *file)
{ … }
static void gb_tty_close(struct tty_struct *tty, struct file *file)
{ … }
static void gb_tty_cleanup(struct tty_struct *tty)
{ … }
static void gb_tty_hangup(struct tty_struct *tty)
{ … }
static ssize_t gb_tty_write(struct tty_struct *tty, const u8 *buf, size_t count)
{ … }
static unsigned int gb_tty_write_room(struct tty_struct *tty)
{ … }
static unsigned int gb_tty_chars_in_buffer(struct tty_struct *tty)
{ … }
static int gb_tty_break_ctl(struct tty_struct *tty, int state)
{ … }
static void gb_tty_set_termios(struct tty_struct *tty,
const struct ktermios *termios_old)
{ … }
static int gb_tty_tiocmget(struct tty_struct *tty)
{ … }
static int gb_tty_tiocmset(struct tty_struct *tty, unsigned int set,
unsigned int clear)
{ … }
static void gb_tty_throttle(struct tty_struct *tty)
{ … }
static void gb_tty_unthrottle(struct tty_struct *tty)
{ … }
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 gb_tty *gb_tty, unsigned long arg)
{ … }
static int gb_tty_get_icount(struct tty_struct *tty,
struct serial_icounter_struct *icount)
{ … }
static int gb_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned long arg)
{ … }
static void gb_tty_dtr_rts(struct tty_port *port, bool active)
{ … }
static int gb_tty_port_activate(struct tty_port *port,
struct tty_struct *tty)
{ … }
static void gb_tty_port_shutdown(struct tty_port *port)
{ … }
static void gb_tty_port_destruct(struct tty_port *port)
{ … }
static const struct tty_operations gb_ops = …;
static const struct tty_port_operations gb_port_ops = …;
static int gb_uart_probe(struct gbphy_device *gbphy_dev,
const struct gbphy_device_id *id)
{ … }
static void gb_uart_remove(struct gbphy_device *gbphy_dev)
{ … }
static int gb_tty_init(void)
{ … }
static void gb_tty_exit(void)
{ … }
static const struct gbphy_device_id gb_uart_id_table[] = …;
MODULE_DEVICE_TABLE(gbphy, gb_uart_id_table);
static struct gbphy_driver uart_driver = …;
static int gb_uart_driver_init(void)
{ … }
module_init(…) …;
static void gb_uart_driver_exit(void)
{ … }
module_exit(gb_uart_driver_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;