X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=net%2Firda%2Fircomm%2Fircomm_tty_ioctl.c;h=24cb3aa2bbfbd779e99fd393661fb5fb35fb8e7b;hb=0dc47877a3de00ceadea0005189656ae8dc52669;hp=75e39ea599d81147fca02e540eb03f77e3f329d0;hpb=678f2b7df24c34f90fee264fa3a8069bca9c99ad;p=deliverable%2Flinux.git diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index 75e39ea599d8..24cb3aa2bbfb 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c @@ -1,36 +1,35 @@ /********************************************************************* - * + * * Filename: ircomm_tty_ioctl.c - * Version: - * Description: + * Version: + * Description: * Status: Experimental. * Author: Dag Brattli * Created at: Thu Jun 10 14:39:09 1999 * Modified at: Wed Jan 5 14:45:43 2000 * Modified by: Dag Brattli - * + * * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved. - * - * 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 + * + * 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, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA - * + * ********************************************************************/ #include #include -#include #include #include #include @@ -58,7 +57,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) unsigned cflag, cval; int baud; - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __func__ ); if (!self->tty || !self->tty->termios || !self->ircomm) return; @@ -75,7 +74,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) } if (cflag & CSTOPB) cval |= IRCOMM_2_STOP_BIT; - + if (cflag & PARENB) cval |= IRCOMM_PARITY_ENABLE; if (!(cflag & PARODD)) @@ -88,14 +87,14 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) self->settings.data_rate = baud; ircomm_param_request(self, IRCOMM_DATA_RATE, FALSE); - + /* CTS flow control flag and modem status interrupts */ if (cflag & CRTSCTS) { self->flags |= ASYNC_CTS_FLOW; self->settings.flow_control |= IRCOMM_RTS_CTS_IN; /* This got me. Bummer. Jean II */ if (self->service_type == IRCOMM_3_WIRE_RAW) - IRDA_WARNING("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n", __FUNCTION__); + IRDA_WARNING("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n", __func__); } else { self->flags &= ~ASYNC_CTS_FLOW; self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN; @@ -104,7 +103,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) self->flags &= ~ASYNC_CHECK_CD; else self->flags |= ASYNC_CHECK_CD; -#if 0 +#if 0 /* * Set up parity check flag */ @@ -113,7 +112,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) driver->read_status_mask |= LSR_FE | LSR_PE; if (I_BRKINT(driver->tty) || I_PARMRK(driver->tty)) driver->read_status_mask |= LSR_BI; - + /* * Characters to ignore */ @@ -124,17 +123,17 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) if (I_IGNBRK(self->tty)) { self->ignore_status_mask |= LSR_BI; /* - * If we're ignore parity and break indicators, ignore + * If we're ignore parity and break indicators, ignore * overruns too. (For real raw support). */ - if (I_IGNPAR(self->tty)) + if (I_IGNPAR(self->tty)) self->ignore_status_mask |= LSR_OE; } #endif self->settings.data_format = cval; ircomm_param_request(self, IRCOMM_DATA_FORMAT, FALSE); - ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); + ircomm_param_request(self, IRCOMM_FLOW_CONTROL, TRUE); } /* @@ -145,16 +144,16 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) * should be prepared to accept the case where old == NULL, and try to * do something rational. */ -void ircomm_tty_set_termios(struct tty_struct *tty, +void ircomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old_termios) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned int cflag = tty->termios->c_cflag; - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __func__ ); - if ((cflag == old_termios->c_cflag) && - (RELEVANT_IFLAG(tty->termios->c_iflag) == + if ((cflag == old_termios->c_cflag) && + (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old_termios->c_iflag))) { return; @@ -168,21 +167,21 @@ void ircomm_tty_set_termios(struct tty_struct *tty, self->settings.dte &= ~(IRCOMM_DTR|IRCOMM_RTS); ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + /* Handle transition away from B0 status */ if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) { self->settings.dte |= IRCOMM_DTR; - if (!(tty->termios->c_cflag & CRTSCTS) || + if (!(tty->termios->c_cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) { self->settings.dte |= IRCOMM_RTS; } ircomm_param_request(self, IRCOMM_DTE, TRUE); } - + /* Handle turning off CRTSCTS */ if ((old_termios->c_cflag & CRTSCTS) && - !(tty->termios->c_cflag & CRTSCTS)) + !(tty->termios->c_cflag & CRTSCTS)) { tty->hw_stopped = 0; ircomm_tty_start(tty); @@ -192,7 +191,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, /* * Function ircomm_tty_tiocmget (tty, file) * - * + * * */ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) @@ -200,7 +199,7 @@ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; unsigned int result; - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __func__ ); if (tty->flags & (1 << TTY_IO_ERROR)) return -EIO; @@ -217,15 +216,15 @@ int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file) /* * Function ircomm_tty_tiocmset (tty, file, set, clear) * - * + * * */ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) -{ +{ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __func__ ); if (tty->flags & (1 << TTY_IO_ERROR)) return -EIO; @@ -249,25 +248,25 @@ int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file, self->settings.dte |= IRCOMM_DELTA_DTR; ircomm_param_request(self, IRCOMM_DTE, TRUE); - + return 0; } /* * Function get_serial_info (driver, retinfo) * - * + * * */ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, struct serial_struct __user *retinfo) { struct serial_struct info; - + if (!retinfo) return -EFAULT; - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __func__ ); memset(&info, 0, sizeof(info)); info.line = self->line; @@ -277,11 +276,11 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, info.closing_wait = self->closing_wait; /* For compatibility */ - info.type = PORT_16550A; - info.port = 0; - info.irq = 0; + info.type = PORT_16550A; + info.port = 0; + info.irq = 0; info.xmit_fifo_size = 0; - info.hub6 = 0; + info.hub6 = 0; info.custom_divisor = 0; if (copy_to_user(retinfo, &info, sizeof(*retinfo))) @@ -293,7 +292,7 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, /* * Function set_serial_info (driver, new_info) * - * + * * */ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, @@ -303,7 +302,7 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, struct serial_struct new_serial; struct ircomm_tty_cb old_state, *state; - IRDA_DEBUG(0, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s()\n", __func__ ); if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) return -EFAULT; @@ -311,7 +310,7 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, state = self old_state = *self; - + if (!capable(CAP_SYS_ADMIN)) { if ((new_serial.baud_base != state->settings.data_rate) || (new_serial.close_delay != state->close_delay) || @@ -368,16 +367,16 @@ static int ircomm_tty_set_serial_info(struct ircomm_tty_cb *self, /* * Function ircomm_tty_ioctl (tty, file, cmd, arg) * - * + * * */ -int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, +int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; int ret = 0; - IRDA_DEBUG(2, "%s()\n", __FUNCTION__ ); + IRDA_DEBUG(2, "%s()\n", __func__ ); if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) && @@ -398,7 +397,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, break; case TIOCGICOUNT: - IRDA_DEBUG(0, "%s(), TIOCGICOUNT not impl!\n", __FUNCTION__ ); + IRDA_DEBUG(0, "%s(), TIOCGICOUNT not impl!\n", __func__ ); #if 0 save_flags(flags); cli(); cnow = driver->icount; @@ -416,7 +415,7 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, put_user(cnow.brk, &p_cuser->brk) || put_user(cnow.buf_overrun, &p_cuser->buf_overrun)) return -EFAULT; -#endif +#endif return 0; default: ret = -ENOIOCTLCMD; /* ioctls which we must ignore */