Release 4.7 net/irda/ircomm/ircomm_tty.c
/*********************************************************************
*
* Filename: ircomm_tty.c
* Version: 1.0
* Description: IrCOMM serial TTY driver
* Status: Experimental.
* Author: Dag Brattli <dagb@cs.uit.no>
* Created at: Sun Jun 6 21:00:56 1999
* Modified at: Wed Feb 23 00:09:02 2000
* Modified by: Dag Brattli <dagb@cs.uit.no>
* Sources: serial.c and previous IrCOMM work by Takahide Higuchi
*
* Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2003 Jean Tourrilhes <jt@hpl.hp.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
********************************************************************/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/seq_file.h>
#include <linux/termios.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/interrupt.h>
#include <linux/device.h> /* for MODULE_ALIAS_CHARDEV_MAJOR */
#include <asm/uaccess.h>
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
#include <net/irda/ircomm_core.h>
#include <net/irda/ircomm_param.h>
#include <net/irda/ircomm_tty_attach.h>
#include <net/irda/ircomm_tty.h>
static int ircomm_tty_install(struct tty_driver *driver,
struct tty_struct *tty);
static int ircomm_tty_open(struct tty_struct *tty, struct file *filp);
static void ircomm_tty_close(struct tty_struct * tty, struct file *filp);
static int ircomm_tty_write(struct tty_struct * tty,
const unsigned char *buf, int count);
static int ircomm_tty_write_room(struct tty_struct *tty);
static void ircomm_tty_throttle(struct tty_struct *tty);
static void ircomm_tty_unthrottle(struct tty_struct *tty);
static int ircomm_tty_chars_in_buffer(struct tty_struct *tty);
static void ircomm_tty_flush_buffer(struct tty_struct *tty);
static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch);
static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout);
static void ircomm_tty_hangup(struct tty_struct *tty);
static void ircomm_tty_do_softint(struct work_struct *work);
static void ircomm_tty_shutdown(struct ircomm_tty_cb *self);
static void ircomm_tty_stop(struct tty_struct *tty);
static int ircomm_tty_data_indication(void *instance, void *sap,
struct sk_buff *skb);
static int ircomm_tty_control_indication(void *instance, void *sap,
struct sk_buff *skb);
static void ircomm_tty_flow_indication(void *instance, void *sap,
LOCAL_FLOW cmd);
#ifdef CONFIG_PROC_FS
static const struct file_operations ircomm_tty_proc_fops;
#endif /* CONFIG_PROC_FS */
static struct tty_driver *driver;
static hashbin_t *ircomm_tty = NULL;
static const struct tty_operations ops = {
.install = ircomm_tty_install,
.open = ircomm_tty_open,
.close = ircomm_tty_close,
.write = ircomm_tty_write,
.write_room = ircomm_tty_write_room,
.chars_in_buffer = ircomm_tty_chars_in_buffer,
.flush_buffer = ircomm_tty_flush_buffer,
.ioctl = ircomm_tty_ioctl, /* ircomm_tty_ioctl.c */
.tiocmget = ircomm_tty_tiocmget, /* ircomm_tty_ioctl.c */
.tiocmset = ircomm_tty_tiocmset, /* ircomm_tty_ioctl.c */
.throttle = ircomm_tty_throttle,
.unthrottle = ircomm_tty_unthrottle,
.send_xchar = ircomm_tty_send_xchar,
.set_termios = ircomm_tty_set_termios,
.stop = ircomm_tty_stop,
.start = ircomm_tty_start,
.hangup = ircomm_tty_hangup,
.wait_until_sent = ircomm_tty_wait_until_sent,
#ifdef CONFIG_PROC_FS
.proc_fops = &ircomm_tty_proc_fops,
#endif /* CONFIG_PROC_FS */
};
static void ircomm_port_raise_dtr_rts(struct tty_port *port, int raise)
{
struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb,
port);
/*
* Here, we use to lock those two guys, but as ircomm_param_request()
* does it itself, I don't see the point (and I see the deadlock).
* Jean II
*/
if (raise)
self->settings.dte |= IRCOMM_RTS | IRCOMM_DTR;
else
self->settings.dte &= ~(IRCOMM_RTS | IRCOMM_DTR);
ircomm_param_request(self, IRCOMM_DTE, TRUE);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
jiri slaby | jiri slaby | 67 | 100.00% | 1 | 100.00% |
| Total | 67 | 100.00% | 1 | 100.00% |
static int ircomm_port_carrier_raised(struct tty_port *port)
{
struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb,
port);
return self->settings.dce & IRCOMM_CD;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
jiri slaby | jiri slaby | 35 | 100.00% | 1 | 100.00% |
| Total | 35 | 100.00% | 1 | 100.00% |
static const struct tty_port_operations ircomm_port_ops = {
.dtr_rts = ircomm_port_raise_dtr_rts,
.carrier_raised = ircomm_port_carrier_raised,
};
/*
* Function ircomm_tty_init()
*
* Init IrCOMM TTY layer/driver
*
*/
static int __init ircomm_tty_init(void)
{
driver = alloc_tty_driver(IRCOMM_TTY_PORTS);
if (!driver)
return -ENOMEM;
ircomm_tty = hashbin_new(HB_LOCK);
if (ircomm_tty == NULL) {
net_err_ratelimited("%s(), can't allocate hashbin!\n",
__func__);
put_tty_driver(driver);
return -ENOMEM;
}
driver->driver_name = "ircomm";
driver->name = "ircomm";
driver->major = IRCOMM_TTY_MAJOR;
driver->minor_start = IRCOMM_TTY_MINOR;
driver->type = TTY_DRIVER_TYPE_SERIAL;
driver->subtype = SERIAL_TYPE_NORMAL;
driver->init_termios = tty_std_termios;
driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
driver->flags = TTY_DRIVER_REAL_RAW;
tty_set_operations(driver, &ops);
if (tty_register_driver(driver)) {
net_err_ratelimited("%s(): Couldn't register serial driver\n",
__func__);
put_tty_driver(driver);
return -1;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 105 | 67.31% | 2 | 25.00% |
al viro | al viro | 41 | 26.28% | 1 | 12.50% |
jeff garzik | jeff garzik | 4 | 2.56% | 1 | 12.50% |
joe perches | joe perches | 2 | 1.28% | 1 | 12.50% |
harvey harrison | harvey harrison | 2 | 1.28% | 1 | 12.50% |
adrian bunk | adrian bunk | 1 | 0.64% | 1 | 12.50% |
jean tourrilhes | jean tourrilhes | 1 | 0.64% | 1 | 12.50% |
| Total | 156 | 100.00% | 8 | 100.00% |
static void __exit __ircomm_tty_cleanup(struct ircomm_tty_cb *self)
{
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
ircomm_tty_shutdown(self);
self->magic = 0;
tty_port_destroy(&self->port);
kfree(self);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 39 | 78.00% | 1 | 25.00% |
jiri slaby | jiri slaby | 8 | 16.00% | 1 | 25.00% |
jean tourrilhes | jean tourrilhes | 3 | 6.00% | 2 | 50.00% |
| Total | 50 | 100.00% | 4 | 100.00% |
/*
* Function ircomm_tty_cleanup ()
*
* Remove IrCOMM TTY layer/driver
*
*/
static void __exit ircomm_tty_cleanup(void)
{
int ret;
ret = tty_unregister_driver(driver);
if (ret) {
net_err_ratelimited("%s(), failed to unregister driver\n",
__func__);
return;
}
hashbin_delete(ircomm_tty, (FREE_FUNC) __ircomm_tty_cleanup);
put_tty_driver(driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 37 | 77.08% | 2 | 25.00% |
al viro | al viro | 5 | 10.42% | 1 | 12.50% |
jeff garzik | jeff garzik | 2 | 4.17% | 1 | 12.50% |
adrian bunk | adrian bunk | 1 | 2.08% | 1 | 12.50% |
jean tourrilhes | jean tourrilhes | 1 | 2.08% | 1 | 12.50% |
joe perches | joe perches | 1 | 2.08% | 1 | 12.50% |
harvey harrison | harvey harrison | 1 | 2.08% | 1 | 12.50% |
| Total | 48 | 100.00% | 8 | 100.00% |
/*
* Function ircomm_startup (self)
*
*
*
*/
static int ircomm_tty_startup(struct ircomm_tty_cb *self)
{
notify_t notify;
int ret = -ENODEV;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
/* Check if already open */
if (tty_port_initialized(&self->port)) {
pr_debug("%s(), already open so break out!\n", __func__);
return 0;
}
tty_port_set_initialized(&self->port, 1);
/* Register with IrCOMM */
irda_notify_init(¬ify);
/* These callbacks we must handle ourselves */
notify.data_indication = ircomm_tty_data_indication;
notify.udata_indication = ircomm_tty_control_indication;
notify.flow_indication = ircomm_tty_flow_indication;
/* Use the ircomm_tty interface for these ones */
notify.disconnect_indication = ircomm_tty_disconnect_indication;
notify.connect_confirm = ircomm_tty_connect_confirm;
notify.connect_indication = ircomm_tty_connect_indication;
strlcpy(notify.name, "ircomm_tty", sizeof(notify.name));
notify.instance = self;
if (!self->ircomm) {
self->ircomm = ircomm_open(¬ify, self->service_type,
self->line);
}
if (!self->ircomm)
goto err;
self->slsap_sel = self->ircomm->slsap_sel;
/* Connect IrCOMM link with remote device */
ret = ircomm_tty_attach_cable(self);
if (ret < 0) {
net_err_ratelimited("%s(), error attaching cable!\n", __func__);
goto err;
}
return 0;
err:
tty_port_set_initialized(&self->port, 0);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 175 | 76.42% | 3 | 23.08% |
jean tourrilhes | jean tourrilhes | 25 | 10.92% | 3 | 23.08% |
peter hurley | peter hurley | 14 | 6.11% | 1 | 7.69% |
ben collins | ben collins | 7 | 3.06% | 1 | 7.69% |
harvey harrison | harvey harrison | 2 | 0.87% | 1 | 7.69% |
joe perches | joe perches | 2 | 0.87% | 2 | 15.38% |
jiri slaby | jiri slaby | 2 | 0.87% | 1 | 7.69% |
jeff garzik | jeff garzik | 2 | 0.87% | 1 | 7.69% |
| Total | 229 | 100.00% | 13 | 100.00% |
/*
* Function ircomm_block_til_ready (self, filp)
*
*
*
*/
static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
struct tty_struct *tty, struct file *filp)
{
struct tty_port *port = &self->port;
DECLARE_WAITQUEUE(wait, current);
int retval;
int do_clocal = 0;
unsigned long flags;
/*
* If non-blocking mode is set, or the port is not enabled,
* then make the check up front and then exit.
*/
if (tty_io_error(tty)) {
tty_port_set_active(port, 1);
return 0;
}
if (filp->f_flags & O_NONBLOCK) {
/* nonblock mode is set */
if (C_BAUD(tty))
tty_port_raise_dtr_rts(port);
tty_port_set_active(port, 1);
pr_debug("%s(), O_NONBLOCK requested!\n", __func__);
return 0;
}
if (C_CLOCAL(tty)) {
pr_debug("%s(), doing CLOCAL!\n", __func__);
do_clocal = 1;
}
/* Wait for carrier detect and the line to become
* free (i.e., not in use by the callout). While we are in
* this loop, port->count is dropped by one, so that
* mgsl_close() knows when to free things. We restore it upon
* exit, either normal or abnormal.
*/
retval = 0;
add_wait_queue(&port->open_wait, &wait);
pr_debug("%s(%d):block_til_ready before block on %s open_count=%d\n",
__FILE__, __LINE__, tty->driver->name, port->count);
spin_lock_irqsave(&port->lock, flags);
port->count--;
port->blocked_open++;
spin_unlock_irqrestore(&port->lock, flags);
while (1) {
if (C_BAUD(tty) && tty_port_initialized(port))
tty_port_raise_dtr_rts(port);
set_current_state(TASK_INTERRUPTIBLE);
if (tty_hung_up_p(filp) || !tty_port_initialized(port)) {
retval = (port->flags & ASYNC_HUP_NOTIFY) ?
-EAGAIN : -ERESTARTSYS;
break;
}
/*
* Check if link is ready now. Even if CLOCAL is
* specified, we cannot return before the IrCOMM link is
* ready
*/
if ((do_clocal || tty_port_carrier_raised(port)) &&
self->state == IRCOMM_TTY_READY)
{
break;
}
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
pr_debug("%s(%d):block_til_ready blocking on %s open_count=%d\n",
__FILE__, __LINE__, tty->driver->name, port->count);
schedule();
}
__set_current_state(TASK_RUNNING);
remove_wait_queue(&port->open_wait, &wait);
spin_lock_irqsave(&port->lock, flags);
if (!tty_hung_up_p(filp))
port->count++;
port->blocked_open--;
spin_unlock_irqrestore(&port->lock, flags);
pr_debug("%s(%d):block_til_ready after blocking on %s open_count=%d\n",
__FILE__, __LINE__, tty->driver->name, port->count);
if (!retval)
tty_port_set_active(port, 1);
return retval;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 231 | 57.61% | 3 | 11.54% |
peter hurley | peter hurley | 68 | 16.96% | 8 | 30.77% |
jiri slaby | jiri slaby | 58 | 14.46% | 7 | 26.92% |
jean tourrilhes | jean tourrilhes | 26 | 6.48% | 3 | 11.54% |
johan hovold | johan hovold | 7 | 1.75% | 1 | 3.85% |
joe perches | joe perches | 5 | 1.25% | 1 | 3.85% |
al viro | al viro | 3 | 0.75% | 1 | 3.85% |
harvey harrison | harvey harrison | 2 | 0.50% | 1 | 3.85% |
hideaki yoshifuji | hideaki yoshifuji | 1 | 0.25% | 1 | 3.85% |
| Total | 401 | 100.00% | 26 | 100.00% |
static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
{
struct ircomm_tty_cb *self;
unsigned int line = tty->index;
/* Check if instance already exists */
self = hashbin_lock_find(ircomm_tty, line, NULL);
if (!self) {
/* No, so make new instance */
self = kzalloc(sizeof(struct ircomm_tty_cb), GFP_KERNEL);
if (self == NULL)
return -ENOMEM;
tty_port_init(&self->port);
self->port.ops = &ircomm_port_ops;
self->magic = IRCOMM_TTY_MAGIC;
self->flow = FLOW_STOP;
self->line = line;
INIT_WORK(&self->tqueue, ircomm_tty_do_softint);
self->max_header_size = IRCOMM_TTY_HDR_UNINITIALISED;
self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED;
/* Init some important stuff */
init_timer(&self->watchdog_timer);
spin_lock_init(&self->spinlock);
/*
* Force TTY into raw mode by default which is usually what
* we want for IrCOMM and IrLPT. This way applications will
* not have to twiddle with printcap etc.
*
* Note this is completely usafe and doesn't work properly
*/
tty->termios.c_iflag = 0;
tty->termios.c_oflag = 0;
/* Insert into hash */
hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL);
}
tty->driver_data = self;
return tty_port_install(&self->port, driver, tty);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 131 | 66.16% | 4 | 25.00% |
jiri slaby | jiri slaby | 40 | 20.20% | 4 | 25.00% |
jean tourrilhes | jean tourrilhes | 11 | 5.56% | 2 | 12.50% |
sasha levin | sasha levin | 6 | 3.03% | 1 | 6.25% |
ingo molnar | ingo molnar | 5 | 2.53% | 1 | 6.25% |
alan cox | alan cox | 3 | 1.52% | 2 | 12.50% |
linus torvalds | linus torvalds | 1 | 0.51% | 1 | 6.25% |
panagiotis issaris* | panagiotis issaris* | 1 | 0.51% | 1 | 6.25% |
| Total | 198 | 100.00% | 16 | 100.00% |
/*
* Function ircomm_tty_open (tty, filp)
*
* This routine is called when a particular tty device is opened. This
* routine is mandatory; if this routine is not filled in, the attempted
* open will fail with ENODEV.
*/
static int ircomm_tty_open(struct tty_struct *tty, struct file *filp)
{
struct ircomm_tty_cb *self = tty->driver_data;
unsigned long flags;
int ret;
/* ++ is not atomic, so this should be protected - Jean II */
spin_lock_irqsave(&self->port.lock, flags);
self->port.count++;
spin_unlock_irqrestore(&self->port.lock, flags);
tty_port_tty_set(&self->port, tty);
pr_debug("%s(), %s%d, count = %d\n", __func__ , tty->driver->name,
self->line, self->port.count);
/* Not really used by us, but lets do it anyway */
self->port.low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0;
/* Check if this is a "normal" ircomm device, or an irlpt device */
if (self->line < 0x10) {
self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE;
self->settings.service_type = IRCOMM_9_WIRE; /* 9 wire as default */
/* Jan Kiszka -> add DSR/RI -> Conform to IrCOMM spec */
self->settings.dce = IRCOMM_CTS | IRCOMM_CD | IRCOMM_DSR | IRCOMM_RI; /* Default line settings */
pr_debug("%s(), IrCOMM device\n", __func__);
} else {
pr_debug("%s(), IrLPT device\n", __func__);
self->service_type = IRCOMM_3_WIRE_RAW;
self->settings.service_type = IRCOMM_3_WIRE_RAW; /* Default */
}
ret = ircomm_tty_startup(self);
if (ret)
return ret;
ret = ircomm_tty_block_til_ready(self, tty, filp);
if (ret) {
pr_debug("%s(), returning after block_til_ready with %d\n",
__func__, ret);
return ret;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 125 | 52.08% | 2 | 13.33% |
jiri slaby | jiri slaby | 62 | 25.83% | 6 | 40.00% |
jean tourrilhes | jean tourrilhes | 32 | 13.33% | 3 | 20.00% |
linus torvalds | linus torvalds | 12 | 5.00% | 1 | 6.67% |
joe perches | joe perches | 4 | 1.67% | 1 | 6.67% |
harvey harrison | harvey harrison | 4 | 1.67% | 1 | 6.67% |
al viro | al viro | 1 | 0.42% | 1 | 6.67% |
| Total | 240 | 100.00% | 15 | 100.00% |
/*
* Function ircomm_tty_close (tty, filp)
*
* This routine is called when a particular tty device is closed.
*
*/
static void ircomm_tty_close(struct tty_struct *tty, struct file *filp)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
struct tty_port *port = &self->port;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
if (tty_port_close_start(port, tty, filp) == 0)
return;
ircomm_tty_shutdown(self);
tty_driver_flush_buffer(tty);
tty_port_close_end(port, tty);
tty_port_tty_set(port, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 51 | 55.43% | 3 | 25.00% |
jiri slaby | jiri slaby | 25 | 27.17% | 5 | 41.67% |
jean tourrilhes | jean tourrilhes | 15 | 16.30% | 3 | 25.00% |
alan cox | alan cox | 1 | 1.09% | 1 | 8.33% |
| Total | 92 | 100.00% | 12 | 100.00% |
/*
* Function ircomm_tty_flush_buffer (tty)
*
*
*
*/
static void ircomm_tty_flush_buffer(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
/*
* Let do_softint() do this to avoid race condition with
* do_softint() ;-)
*/
schedule_work(&self->tqueue);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 44 | 91.67% | 2 | 40.00% |
jean tourrilhes | jean tourrilhes | 2 | 4.17% | 1 | 20.00% |
ingo molnar | ingo molnar | 1 | 2.08% | 1 | 20.00% |
hideaki yoshifuji | hideaki yoshifuji | 1 | 2.08% | 1 | 20.00% |
| Total | 48 | 100.00% | 5 | 100.00% |
/*
* Function ircomm_tty_do_softint (work)
*
* We use this routine to give the write wakeup to the user at at a
* safe time (as fast as possible after write have completed). This
* can be compared to the Tx interrupt.
*/
static void ircomm_tty_do_softint(struct work_struct *work)
{
struct ircomm_tty_cb *self =
container_of(work, struct ircomm_tty_cb, tqueue);
struct tty_struct *tty;
unsigned long flags;
struct sk_buff *skb, *ctrl_skb;
if (!self || self->magic != IRCOMM_TTY_MAGIC)
return;
tty = tty_port_tty_get(&self->port);
if (!tty)
return;
/* Unlink control buffer */
spin_lock_irqsave(&self->spinlock, flags);
ctrl_skb = self->ctrl_skb;
self->ctrl_skb = NULL;
spin_unlock_irqrestore(&self->spinlock, flags);
/* Flush control buffer if any */
if(ctrl_skb) {
if(self->flow == FLOW_START)
ircomm_control_request(self->ircomm, ctrl_skb);
/* Drop reference count - see ircomm_ttp_data_request(). */
dev_kfree_skb(ctrl_skb);
}
if (tty->hw_stopped)
goto put;
/* Unlink transmit buffer */
spin_lock_irqsave(&self->spinlock, flags);
skb = self->tx_skb;
self->tx_skb = NULL;
spin_unlock_irqrestore(&self->spinlock, flags);
/* Flush transmit buffer if any */
if (skb) {
ircomm_tty_do_event(self, IRCOMM_TTY_DATA_REQUEST, skb, NULL);
/* Drop reference count - see ircomm_ttp_data_request(). */
dev_kfree_skb(skb);
}
/* Check if user (still) wants to be waken up */
tty_wakeup(tty);
put:
tty_kref_put(tty);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 144 | 67.61% | 3 | 37.50% |
jean tourrilhes | jean tourrilhes | 43 | 20.19% | 2 | 25.00% |
jiri slaby | jiri slaby | 15 | 7.04% | 1 | 12.50% |
david howells | david howells | 10 | 4.69% | 1 | 12.50% |
alan cox | alan cox | 1 | 0.47% | 1 | 12.50% |
| Total | 213 | 100.00% | 8 | 100.00% |
/*
* Function ircomm_tty_write (tty, buf, count)
*
* This routine is called by the kernel to write a series of characters
* to the tty device. The characters may come from user space or kernel
* space. This routine will return the number of characters actually
* accepted for writing. This routine is mandatory.
*/
static int ircomm_tty_write(struct tty_struct *tty,
const unsigned char *buf, int count)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
unsigned long flags;
struct sk_buff *skb;
int tailroom = 0;
int len = 0;
int size;
pr_debug("%s(), count=%d, hw_stopped=%d\n", __func__ , count,
tty->hw_stopped);
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
/* We may receive packets from the TTY even before we have finished
* our setup. Not cool.
* The problem is that we don't know the final header and data size
* to create the proper skb, so any skb we would create would have
* bogus header and data size, so need care.
* We use a bogus header size to safely detect this condition.
* Another problem is that hw_stopped was set to 0 way before it
* should be, so we would drop this skb. It should now be fixed.
* One option is to not accept data until we are properly setup.
* But, I suspect that when it happens, the ppp line discipline
* just "drops" the data, which might screw up connect scripts.
* The second option is to create a "safe skb", with large header
* and small size (see ircomm_tty_open() for values).
* We just need to make sure that when the real values get filled,
* we don't mess up the original "safe skb" (see tx_data_size).
* Jean II */
if (self->max_header_size == IRCOMM_TTY_HDR_UNINITIALISED) {
pr_debug("%s() : not initialised\n", __func__);
#ifdef IRCOMM_NO_TX_BEFORE_INIT
/* We didn't consume anything, TTY will retry */
return 0;
#endif
}
if (count < 1)
return 0;
/* Protect our manipulation of self->tx_skb and related */
spin_lock_irqsave(&self->spinlock, flags);
/* Fetch current transmit buffer */
skb = self->tx_skb;
/*
* Send out all the data we get, possibly as multiple fragmented
* frames, but this will only happen if the data is larger than the
* max data size. The normal case however is just the opposite, and
* this function may be called multiple times, and will then actually
* defragment the data and send it out as one packet as soon as
* possible, but at a safer point in time
*/
while (count) {
size = count;
/* Adjust data size to the max data size */
if (size > self->max_data_size)
size = self->max_data_size;
/*
* Do we already have a buffer ready for transmit, or do
* we need to allocate a new frame
*/
if (skb) {
/*
* Any room for more data at the end of the current
* transmit buffer? Cannot use skb_tailroom, since
* dev_alloc_skb gives us a larger skb than we
* requested
* Note : use tx_data_size, because max_data_size
* may have changed and we don't want to overwrite
* the skb. - Jean II
*/
if ((tailroom = (self->tx_data_size - skb->len)) > 0) {
/* Adjust data to tailroom */
if (size > tailroom)
size = tailroom;
} else {
/*
* Current transmit frame is full, so break
* out, so we can send it as soon as possible
*/
break;
}
} else {
/* Prepare a full sized frame */
skb = alloc_skb(self->max_data_size+
self->max_header_size,
GFP_ATOMIC);
if (!skb) {
spin_unlock_irqrestore(&self->spinlock, flags);
return -ENOBUFS;
}
skb_reserve(skb, self->max_header_size);
self->tx_skb = skb;
/* Remember skb size because max_data_size may
* change later on - Jean II */
self->tx_data_size = self->max_data_size;
}
/* Copy data */
memcpy(skb_put(skb,size), buf + len, size);
count -= size;
len += size;
}
spin_unlock_irqrestore(&self->spinlock, flags);
/*
* Schedule a new thread which will transmit the frame as soon
* as possible, but at a safe point in time. We do this so the
* "user" can give us data multiple times, as PPP does (because of
* its 256 byte tx buffer). We will then defragment and send out
* all this data as one single packet.
*/
schedule_work(&self->tqueue);
return len;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 240 | 74.53% | 2 | 14.29% |
jean tourrilhes | jean tourrilhes | 69 | 21.43% | 7 | 50.00% |
hideaki yoshifuji | hideaki yoshifuji | 5 | 1.55% | 1 | 7.14% |
samuel ortiz | samuel ortiz | 3 | 0.93% | 1 | 7.14% |
joe perches | joe perches | 2 | 0.62% | 1 | 7.14% |
harvey harrison | harvey harrison | 2 | 0.62% | 1 | 7.14% |
ingo molnar | ingo molnar | 1 | 0.31% | 1 | 7.14% |
| Total | 322 | 100.00% | 14 | 100.00% |
/*
* Function ircomm_tty_write_room (tty)
*
* This routine returns the numbers of characters the tty driver will
* accept for queuing to be written. This number is subject to change as
* output buffers get emptied, or if the output flow control is acted.
*/
static int ircomm_tty_write_room(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
unsigned long flags;
int ret;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
#ifdef IRCOMM_NO_TX_BEFORE_INIT
/* max_header_size tells us if the channel is initialised or not. */
if (self->max_header_size == IRCOMM_TTY_HDR_UNINITIALISED)
/* Don't bother us yet */
return 0;
#endif
/* Check if we are allowed to transmit any data.
* hw_stopped is the regular flow control.
* Jean II */
if (tty->hw_stopped)
ret = 0;
else {
spin_lock_irqsave(&self->spinlock, flags);
if (self->tx_skb)
ret = self->tx_data_size - self->tx_skb->len;
else
ret = self->max_data_size;
spin_unlock_irqrestore(&self->spinlock, flags);
}
pr_debug("%s(), ret=%d\n", __func__ , ret);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 98 | 70.50% | 2 | 22.22% |
jean tourrilhes | jean tourrilhes | 39 | 28.06% | 5 | 55.56% |
harvey harrison | harvey harrison | 1 | 0.72% | 1 | 11.11% |
joe perches | joe perches | 1 | 0.72% | 1 | 11.11% |
| Total | 139 | 100.00% | 9 | 100.00% |
/*
* Function ircomm_tty_wait_until_sent (tty, timeout)
*
* This routine waits until the device has written out all of the
* characters in its transmitter FIFO.
*/
static void ircomm_tty_wait_until_sent(struct tty_struct *tty, int timeout)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
unsigned long orig_jiffies, poll_time;
unsigned long flags;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
orig_jiffies = jiffies;
/* Set poll time to 200 ms */
poll_time = msecs_to_jiffies(200);
if (timeout)
poll_time = min_t(unsigned long, timeout, poll_time);
spin_lock_irqsave(&self->spinlock, flags);
while (self->tx_skb && self->tx_skb->len) {
spin_unlock_irqrestore(&self->spinlock, flags);
schedule_timeout_interruptible(poll_time);
spin_lock_irqsave(&self->spinlock, flags);
if (signal_pending(current))
break;
if (timeout && time_after(jiffies, orig_jiffies + timeout))
break;
}
spin_unlock_irqrestore(&self->spinlock, flags);
__set_current_state(TASK_RUNNING);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 100 | 60.61% | 2 | 25.00% |
jean tourrilhes | jean tourrilhes | 46 | 27.88% | 2 | 25.00% |
johan hovold | johan hovold | 14 | 8.48% | 1 | 12.50% |
fabian frederick | fabian frederick | 3 | 1.82% | 1 | 12.50% |
andrew morton | andrew morton | 1 | 0.61% | 1 | 12.50% |
nishanth aravamudan | nishanth aravamudan | 1 | 0.61% | 1 | 12.50% |
| Total | 165 | 100.00% | 8 | 100.00% |
/*
* Function ircomm_tty_throttle (tty)
*
* This routine notifies the tty driver that input buffers for the line
* discipline are close to full, and it should somehow signal that no
* more characters should be sent to the tty.
*/
static void ircomm_tty_throttle(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
/* Software flow control? */
if (I_IXOFF(tty))
ircomm_tty_send_xchar(tty, STOP_CHAR(tty));
/* Hardware flow control? */
if (C_CRTSCTS(tty)) {
self->settings.dte &= ~IRCOMM_RTS;
self->settings.dte |= IRCOMM_DELTA_RTS;
ircomm_param_request(self, IRCOMM_DTE, TRUE);
}
ircomm_flow_request(self->ircomm, FLOW_STOP);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 97 | 95.10% | 2 | 50.00% |
peter hurley | peter hurley | 3 | 2.94% | 1 | 25.00% |
jean tourrilhes | jean tourrilhes | 2 | 1.96% | 1 | 25.00% |
| Total | 102 | 100.00% | 4 | 100.00% |
/*
* Function ircomm_tty_unthrottle (tty)
*
* This routine notifies the tty drivers that it should signals that
* characters can now be sent to the tty without fear of overrunning the
* input buffers of the line disciplines.
*/
static void ircomm_tty_unthrottle(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
/* Using software flow control? */
if (I_IXOFF(tty))
ircomm_tty_send_xchar(tty, START_CHAR(tty));
/* Using hardware flow control? */
if (C_CRTSCTS(tty)) {
self->settings.dte |= (IRCOMM_RTS|IRCOMM_DELTA_RTS);
ircomm_param_request(self, IRCOMM_DTE, TRUE);
pr_debug("%s(), FLOW_START\n", __func__);
}
ircomm_flow_request(self->ircomm, FLOW_START);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 95 | 91.35% | 2 | 28.57% |
jean tourrilhes | jean tourrilhes | 4 | 3.85% | 2 | 28.57% |
peter hurley | peter hurley | 3 | 2.88% | 1 | 14.29% |
joe perches | joe perches | 1 | 0.96% | 1 | 14.29% |
harvey harrison | harvey harrison | 1 | 0.96% | 1 | 14.29% |
| Total | 104 | 100.00% | 7 | 100.00% |
/*
* Function ircomm_tty_chars_in_buffer (tty)
*
* Indicates if there are any data in the buffer
*
*/
static int ircomm_tty_chars_in_buffer(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
unsigned long flags;
int len = 0;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
spin_lock_irqsave(&self->spinlock, flags);
if (self->tx_skb)
len = self->tx_skb->len;
spin_unlock_irqrestore(&self->spinlock, flags);
return len;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 75 | 84.27% | 2 | 50.00% |
jean tourrilhes | jean tourrilhes | 14 | 15.73% | 2 | 50.00% |
| Total | 89 | 100.00% | 4 | 100.00% |
static void ircomm_tty_shutdown(struct ircomm_tty_cb *self)
{
unsigned long flags;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
if (!tty_port_initialized(&self->port))
return;
tty_port_set_initialized(&self->port, 0);
ircomm_tty_detach_cable(self);
spin_lock_irqsave(&self->spinlock, flags);
del_timer(&self->watchdog_timer);
/* Free parameter buffer */
if (self->ctrl_skb) {
dev_kfree_skb(self->ctrl_skb);
self->ctrl_skb = NULL;
}
/* Free transmit buffer */
if (self->tx_skb) {
dev_kfree_skb(self->tx_skb);
self->tx_skb = NULL;
}
if (self->ircomm) {
ircomm_close(self->ircomm);
self->ircomm = NULL;
}
spin_unlock_irqrestore(&self->spinlock, flags);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 115 | 77.18% | 1 | 16.67% |
jean tourrilhes | jean tourrilhes | 22 | 14.77% | 3 | 50.00% |
peter hurley | peter hurley | 11 | 7.38% | 1 | 16.67% |
jiri slaby | jiri slaby | 1 | 0.67% | 1 | 16.67% |
| Total | 149 | 100.00% | 6 | 100.00% |
/*
* Function ircomm_tty_hangup (tty)
*
* This routine notifies the tty driver that it should hangup the tty
* device.
*
*/
static void ircomm_tty_hangup(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
struct tty_port *port = &self->port;
unsigned long flags;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
/* ircomm_tty_flush_buffer(tty); */
ircomm_tty_shutdown(self);
spin_lock_irqsave(&port->lock, flags);
if (port->tty) {
set_bit(TTY_IO_ERROR, &port->tty->flags);
tty_kref_put(port->tty);
}
port->tty = NULL;
port->count = 0;
spin_unlock_irqrestore(&port->lock, flags);
tty_port_set_active(port, 0);
wake_up_interruptible(&port->open_wait);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 55 | 41.35% | 3 | 25.00% |
jiri slaby | jiri slaby | 50 | 37.59% | 5 | 41.67% |
jean tourrilhes | jean tourrilhes | 20 | 15.04% | 2 | 16.67% |
peter hurley | peter hurley | 7 | 5.26% | 1 | 8.33% |
al viro | al viro | 1 | 0.75% | 1 | 8.33% |
| Total | 133 | 100.00% | 12 | 100.00% |
/*
* Function ircomm_tty_send_xchar (tty, ch)
*
* This routine is used to send a high-priority XON/XOFF character to
* the device.
*/
static void ircomm_tty_send_xchar(struct tty_struct *tty, char ch)
{
pr_debug("%s(), not impl\n", __func__);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 17 | 80.95% | 1 | 25.00% |
jean tourrilhes | jean tourrilhes | 2 | 9.52% | 1 | 25.00% |
harvey harrison | harvey harrison | 1 | 4.76% | 1 | 25.00% |
joe perches | joe perches | 1 | 4.76% | 1 | 25.00% |
| Total | 21 | 100.00% | 4 | 100.00% |
/*
* Function ircomm_tty_start (tty)
*
* This routine notifies the tty driver that it resume sending
* characters to the tty device.
*/
void ircomm_tty_start(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
ircomm_flow_request(self->ircomm, FLOW_START);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 33 | 100.00% | 1 | 100.00% |
| Total | 33 | 100.00% | 1 | 100.00% |
/*
* Function ircomm_tty_stop (tty)
*
* This routine notifies the tty driver that it should stop outputting
* characters to the tty device.
*/
static void ircomm_tty_stop(struct tty_struct *tty)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
ircomm_flow_request(self->ircomm, FLOW_STOP);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 45 | 93.75% | 2 | 50.00% |
jean tourrilhes | jean tourrilhes | 2 | 4.17% | 1 | 25.00% |
adrian bunk | adrian bunk | 1 | 2.08% | 1 | 25.00% |
| Total | 48 | 100.00% | 4 | 100.00% |
/*
* Function ircomm_check_modem_status (self)
*
* Check for any changes in the DCE's line settings. This function should
* be called whenever the dce parameter settings changes, to update the
* flow control settings and other things
*/
void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self)
{
struct tty_struct *tty;
int status;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
tty = tty_port_tty_get(&self->port);
status = self->settings.dce;
if (status & IRCOMM_DCE_DELTA_ANY) {
/*wake_up_interruptible(&self->delta_msr_wait);*/
}
if (tty_port_check_carrier(&self->port) && (status & IRCOMM_DELTA_CD)) {
pr_debug("%s(), ircomm%d CD now %s...\n", __func__ , self->line,
(status & IRCOMM_CD) ? "on" : "off");
if (status & IRCOMM_CD) {
wake_up_interruptible(&self->port.open_wait);
} else {
pr_debug("%s(), Doing serial hangup..\n", __func__);
if (tty)
tty_hangup(tty);
/* Hangup will remote the tty, so better break out */
goto put;
}
}
if (tty && tty_port_cts_enabled(&self->port)) {
if (tty->hw_stopped) {
if (status & IRCOMM_CTS) {
pr_debug("%s(), CTS tx start...\n", __func__);
tty->hw_stopped = 0;
/* Wake up processes blocked on open */
wake_up_interruptible(&self->port.open_wait);
schedule_work(&self->tqueue);
goto put;
}
} else {
if (!(status & IRCOMM_CTS)) {
pr_debug("%s(), CTS tx stop...\n", __func__);
tty->hw_stopped = 1;
}
}
}
put:
tty_kref_put(tty);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 184 | 77.31% | 4 | 26.67% |
jiri slaby | jiri slaby | 26 | 10.92% | 3 | 20.00% |
jean tourrilhes | jean tourrilhes | 10 | 4.20% | 2 | 13.33% |
peter hurley | peter hurley | 4 | 1.68% | 1 | 6.67% |
huang shijie | huang shijie | 4 | 1.68% | 1 | 6.67% |
joe perches | joe perches | 4 | 1.68% | 1 | 6.67% |
harvey harrison | harvey harrison | 4 | 1.68% | 1 | 6.67% |
al viro | al viro | 1 | 0.42% | 1 | 6.67% |
ingo molnar | ingo molnar | 1 | 0.42% | 1 | 6.67% |
| Total | 238 | 100.00% | 15 | 100.00% |
/*
* Function ircomm_tty_data_indication (instance, sap, skb)
*
* Handle incoming data, and deliver it to the line discipline
*
*/
static int ircomm_tty_data_indication(void *instance, void *sap,
struct sk_buff *skb)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
struct tty_struct *tty;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
IRDA_ASSERT(skb != NULL, return -1;);
tty = tty_port_tty_get(&self->port);
if (!tty) {
pr_debug("%s(), no tty!\n", __func__);
return 0;
}
/*
* If we receive data when hardware is stopped then something is wrong.
* We try to poll the peers line settings to check if we are up todate.
* Devices like WinCE can do this, and since they don't send any
* params, we can just as well declare the hardware for running.
*/
if (tty->hw_stopped && (self->flow == FLOW_START)) {
pr_debug("%s(), polling for line settings!\n", __func__);
ircomm_param_request(self, IRCOMM_POLL, TRUE);
/* We can just as well declare the hardware for running */
ircomm_tty_send_initial_parameters(self);
ircomm_tty_link_established(self);
}
tty_kref_put(tty);
/*
* Use flip buffer functions since the code may be called from interrupt
* context
*/
tty_insert_flip_string(&self->port, skb->data, skb->len);
tty_flip_buffer_push(&self->port);
/* No need to kfree_skb - see ircomm_ttp_data_indication() */
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 121 | 72.02% | 3 | 21.43% |
jiri slaby | jiri slaby | 28 | 16.67% | 3 | 21.43% |
jean tourrilhes | jean tourrilhes | 8 | 4.76% | 3 | 21.43% |
alan cox | alan cox | 3 | 1.79% | 1 | 7.14% |
amit virdi | amit virdi | 3 | 1.79% | 1 | 7.14% |
joe perches | joe perches | 2 | 1.19% | 1 | 7.14% |
harvey harrison | harvey harrison | 2 | 1.19% | 1 | 7.14% |
hideaki yoshifuji | hideaki yoshifuji | 1 | 0.60% | 1 | 7.14% |
| Total | 168 | 100.00% | 14 | 100.00% |
/*
* Function ircomm_tty_control_indication (instance, sap, skb)
*
* Parse all incoming parameters (easy!)
*
*/
static int ircomm_tty_control_indication(void *instance, void *sap,
struct sk_buff *skb)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
int clen;
IRDA_ASSERT(self != NULL, return -1;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
IRDA_ASSERT(skb != NULL, return -1;);
clen = skb->data[0];
irda_param_extract_all(self, skb->data+1, IRDA_MIN(skb->len-1, clen),
&ircomm_param_info);
/* No need to kfree_skb - see ircomm_control_indication() */
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 95 | 95.96% | 2 | 50.00% |
jean tourrilhes | jean tourrilhes | 4 | 4.04% | 2 | 50.00% |
| Total | 99 | 100.00% | 4 | 100.00% |
/*
* Function ircomm_tty_flow_indication (instance, sap, cmd)
*
* This function is called by IrTTP when it wants us to slow down the
* transmission of data. We just mark the hardware as stopped, and wait
* for IrTTP to notify us that things are OK again.
*/
static void ircomm_tty_flow_indication(void *instance, void *sap,
LOCAL_FLOW cmd)
{
struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance;
struct tty_struct *tty;
IRDA_ASSERT(self != NULL, return;);
IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;);
tty = tty_port_tty_get(&self->port);
switch (cmd) {
case FLOW_START:
pr_debug("%s(), hw start!\n", __func__);
if (tty)
tty->hw_stopped = 0;
/* ircomm_tty_do_softint will take care of the rest */
schedule_work(&self->tqueue);
break;
default: /* If we get here, something is very wrong, better stop */
case FLOW_STOP:
pr_debug("%s(), hw stopped!\n", __func__);
if (tty)
tty->hw_stopped = 1;
break;
}
tty_kref_put(tty);
self->flow = cmd;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 99 | 77.34% | 3 | 33.33% |
jiri slaby | jiri slaby | 18 | 14.06% | 1 | 11.11% |
jean tourrilhes | jean tourrilhes | 6 | 4.69% | 2 | 22.22% |
joe perches | joe perches | 2 | 1.56% | 1 | 11.11% |
harvey harrison | harvey harrison | 2 | 1.56% | 1 | 11.11% |
ingo molnar | ingo molnar | 1 | 0.78% | 1 | 11.11% |
| Total | 128 | 100.00% | 9 | 100.00% |
#ifdef CONFIG_PROC_FS
static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m)
{
struct tty_struct *tty;
char sep;
seq_printf(m, "State: %s\n", ircomm_tty_state[self->state]);
seq_puts(m, "Service type: ");
if (self->service_type & IRCOMM_9_WIRE)
seq_puts(m, "9_WIRE");
else if (self->service_type & IRCOMM_3_WIRE)
seq_puts(m, "3_WIRE");
else if (self->service_type & IRCOMM_3_WIRE_RAW)
seq_puts(m, "3_WIRE_RAW");
else
seq_puts(m, "No common service type!\n");
seq_putc(m, '\n');
seq_printf(m, "Port name: %s\n", self->settings.port_name);
seq_printf(m, "DTE status:");
sep = ' ';
if (self->settings.dte & IRCOMM_RTS) {
seq_printf(m, "%cRTS", sep);
sep = '|';
}
if (self->settings.dte & IRCOMM_DTR) {
seq_printf(m, "%cDTR", sep);
sep = '|';
}
seq_putc(m, '\n');
seq_puts(m, "DCE status:");
sep = ' ';
if (self->settings.dce & IRCOMM_CTS) {
seq_printf(m, "%cCTS", sep);
sep = '|';
}
if (self->settings.dce & IRCOMM_DSR) {
seq_printf(m, "%cDSR", sep);
sep = '|';
}
if (self->settings.dce & IRCOMM_CD) {
seq_printf(m, "%cCD", sep);
sep = '|';
}
if (self->settings.dce & IRCOMM_RI) {
seq_printf(m, "%cRI", sep);
sep = '|';
}
seq_putc(m, '\n');
seq_puts(m, "Configuration: ");
if (!self->settings.null_modem)
seq_puts(m, "DTE <-> DCE\n");
else
seq_puts(m, "DTE <-> DTE (null modem emulation)\n");
seq_printf(m, "Data rate: %d\n", self->settings.data_rate);
seq_puts(m, "Flow control:");
sep = ' ';
if (self->settings.flow_control & IRCOMM_XON_XOFF_IN) {
seq_printf(m, "%cXON_XOFF_IN", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_XON_XOFF_OUT) {
seq_printf(m, "%cXON_XOFF_OUT", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_RTS_CTS_IN) {
seq_printf(m, "%cRTS_CTS_IN", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_RTS_CTS_OUT) {
seq_printf(m, "%cRTS_CTS_OUT", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_DSR_DTR_IN) {
seq_printf(m, "%cDSR_DTR_IN", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_DSR_DTR_OUT) {
seq_printf(m, "%cDSR_DTR_OUT", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_ENQ_ACK_IN) {
seq_printf(m, "%cENQ_ACK_IN", sep);
sep = '|';
}
if (self->settings.flow_control & IRCOMM_ENQ_ACK_OUT) {
seq_printf(m, "%cENQ_ACK_OUT", sep);
sep = '|';
}
seq_putc(m, '\n');
seq_puts(m, "Flags:");
sep = ' ';
if (tty_port_cts_enabled(&self->port)) {
seq_printf(m, "%cASYNC_CTS_FLOW", sep);
sep = '|';
}
if (tty_port_check_carrier(&self->port)) {
seq_printf(m, "%cASYNC_CHECK_CD", sep);
sep = '|';
}
if (tty_port_initialized(&self->port)) {
seq_printf(m, "%cASYNC_INITIALIZED", sep);
sep = '|';
}
if (self->port.flags & ASYNC_LOW_LATENCY) {
seq_printf(m, "%cASYNC_LOW_LATENCY", sep);
sep = '|';
}
if (tty_port_active(&self->port)) {
seq_printf(m, "%cASYNC_NORMAL_ACTIVE", sep);
sep = '|';
}
seq_putc(m, '\n');
seq_printf(m, "Role: %s\n", self->client ? "client" : "server");
seq_printf(m, "Open count: %d\n", self->port.count);
seq_printf(m, "Max data size: %d\n", self->max_data_size);
seq_printf(m, "Max header size: %d\n", self->max_header_size);
tty = tty_port_tty_get(&self->port);
if (tty) {
seq_printf(m, "Hardware: %s\n",
tty->hw_stopped ? "Stopped" : "Running");
tty_kref_put(tty);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 464 | 58.22% | 3 | 27.27% |
alexey dobriyan | alexey dobriyan | 286 | 35.88% | 1 | 9.09% |
jiri slaby | jiri slaby | 31 | 3.89% | 3 | 27.27% |
peter hurley | peter hurley | 12 | 1.51% | 3 | 27.27% |
huang shijie | huang shijie | 4 | 0.50% | 1 | 9.09% |
| Total | 797 | 100.00% | 11 | 100.00% |
static int ircomm_tty_proc_show(struct seq_file *m, void *v)
{
struct ircomm_tty_cb *self;
unsigned long flags;
spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags);
self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty);
while (self != NULL) {
if (self->magic != IRCOMM_TTY_MAGIC)
break;
ircomm_tty_line_info(self, m);
self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
}
spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 63 | 66.32% | 1 | 33.33% |
jean tourrilhes | jean tourrilhes | 25 | 26.32% | 1 | 33.33% |
alexey dobriyan | alexey dobriyan | 7 | 7.37% | 1 | 33.33% |
| Total | 95 | 100.00% | 3 | 100.00% |
static int ircomm_tty_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, ircomm_tty_proc_show, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
alexey dobriyan | alexey dobriyan | 23 | 88.46% | 1 | 50.00% |
pre-git | pre-git | 3 | 11.54% | 1 | 50.00% |
| Total | 26 | 100.00% | 2 | 100.00% |
static const struct file_operations ircomm_tty_proc_fops = {
.owner = THIS_MODULE,
.open = ircomm_tty_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* CONFIG_PROC_FS */
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("IrCOMM serial TTY driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS_CHARDEV_MAJOR(IRCOMM_TTY_MAJOR);
module_init(ircomm_tty_init);
module_exit(ircomm_tty_cleanup);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pre-git | pre-git | 3371 | 65.22% | 9 | 10.59% |
jiri slaby | jiri slaby | 505 | 9.77% | 15 | 17.65% |
jean tourrilhes | jean tourrilhes | 461 | 8.92% | 14 | 16.47% |
alexey dobriyan | alexey dobriyan | 360 | 6.96% | 1 | 1.18% |
al viro | al viro | 145 | 2.81% | 4 | 4.71% |
peter hurley | peter hurley | 122 | 2.36% | 9 | 10.59% |
joe perches | joe perches | 27 | 0.52% | 2 | 2.35% |
harvey harrison | harvey harrison | 24 | 0.46% | 1 | 1.18% |
linus torvalds | linus torvalds | 21 | 0.41% | 5 | 5.88% |
johan hovold | johan hovold | 21 | 0.41% | 2 | 2.35% |
hideaki yoshifuji | hideaki yoshifuji | 16 | 0.31% | 1 | 1.18% |
adrian bunk | adrian bunk | 14 | 0.27% | 2 | 2.35% |
david howells | david howells | 13 | 0.25% | 1 | 1.18% |
ingo molnar | ingo molnar | 9 | 0.17% | 1 | 1.18% |
huang shijie | huang shijie | 8 | 0.15% | 1 | 1.18% |
alan cox | alan cox | 8 | 0.15% | 4 | 4.71% |
jeff garzik | jeff garzik | 8 | 0.15% | 1 | 1.18% |
ben collins | ben collins | 7 | 0.14% | 1 | 1.18% |
amit virdi | amit virdi | 6 | 0.12% | 1 | 1.18% |
sasha levin | sasha levin | 6 | 0.12% | 1 | 1.18% |
samuel ortiz | samuel ortiz | 3 | 0.06% | 1 | 1.18% |
fabian frederick | fabian frederick | 3 | 0.06% | 1 | 1.18% |
tejun heo | tejun heo | 3 | 0.06% | 1 | 1.18% |
pavel emelianov | pavel emelianov | 3 | 0.06% | 1 | 1.18% |
panagiotis issaris* | panagiotis issaris* | 1 | 0.02% | 1 | 1.18% |
nishanth aravamudan | nishanth aravamudan | 1 | 0.02% | 1 | 1.18% |
andrew morton | andrew morton | 1 | 0.02% | 1 | 1.18% |
jeff dike | jeff dike | 1 | 0.02% | 1 | 1.18% |
jeff kirsher | jeff kirsher | 1 | 0.02% | 1 | 1.18% |
| Total | 5169 | 100.00% | 85 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.