#include <linux/tty_flip.h>
#include <linux/serial_reg.h>
#include <linux/slab.h>
-#include <linux/delay.h> /* For udelay */
+#include <linux/delay.h> /* For udelay */
#include <asm/uaccess.h> /* For copy_from_user/copy_to_user */
#include <linux/pci.h>
#include "dgnc_sysfs.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
-#define init_MUTEX(sem) sema_init(sem, 1)
+#define init_MUTEX(sem) sema_init(sem, 1)
#define DECLARE_MUTEX(name) \
- struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
+ struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
#endif
/*
DPR_INIT(("tty_register start\n"));
- memset(&brd->SerialDriver, 0, sizeof(struct tty_driver));
+ memset(&brd->SerialDriver, 0, sizeof(struct tty_driver));
memset(&brd->PrintDriver, 0, sizeof(struct tty_driver));
brd->SerialDriver.magic = TTY_DRIVER_MAGIC;
return(-ENOMEM);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
- brd->SerialDriver.refcount = brd->TtyRefCnt;
+ brd->SerialDriver.refcount = brd->TtyRefCnt;
#else
- kref_init(&brd->SerialDriver.kref);
+ kref_init(&brd->SerialDriver.kref);
#endif
brd->SerialDriver.termios = dgnc_driver_kzmalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL);
return(-ENOMEM);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
- brd->PrintDriver.refcount = brd->TtyRefCnt;
+ brd->PrintDriver.refcount = brd->TtyRefCnt;
#else
- kref_init(&brd->PrintDriver.kref);
+ kref_init(&brd->PrintDriver.kref);
#endif
brd->PrintDriver.termios = dgnc_driver_kzmalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL);
if (!brd->dgnc_Major_TransparentPrint_Registered) {
/* Register Transparent Print devices */
- rc = tty_register_driver(&brd->PrintDriver);
+ rc = tty_register_driver(&brd->PrintDriver);
if (rc < 0) {
APR(("Can't register Transparent Print device (%d)\n", rc));
return(rc);
if (brd->PrintDriver.ttys) {
kfree(brd->PrintDriver.ttys);
brd->PrintDriver.ttys = NULL;
- }
+ }
}
*
* dgnc_input - Process received data.
*
- * ch - Pointer to channel structure.
+ * ch - Pointer to channel structure.
*
*=======================================================================*/
void dgnc_input(struct channel_t *ch)
/*
* If the device is not open, or CREAD is off,
- * flush input data and return immediately.
+ * flush input data and return immediately.
*/
if (!tp || (tp->magic != TTY_MAGIC) || !(ch->ch_tun.un_flags & UN_ISOPEN) ||
!(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING)) {
{
struct board_t *bd;
- int virt_carrier = 0;
- int phys_carrier = 0;
+ int virt_carrier = 0;
+ int phys_carrier = 0;
DPR_CARR(("dgnc_carrier called...\n"));
newrate = ((ch->ch_bd->bd_dividend / 0xFFFF) + 1);
if (newrate && newrate > ch->ch_bd->bd_dividend)
- newrate = ch->ch_bd->bd_dividend;
+ newrate = ch->ch_bd->bd_dividend;
while (newrate > 0) {
testdiv = ch->ch_bd->bd_dividend / newrate;
if (deltahigh < deltalow) {
newrate = testrate_high;
- } else {
+ } else {
newrate = testrate_low;
}
* If channel now has space, wake up anyone waiting on the condition.
*/
if ((qlen = ch->ch_w_head - ch->ch_w_tail) < 0)
- qlen += WQUEUESIZE;
+ qlen += WQUEUESIZE;
if (qlen >= (WQUEUESIZE - 256)) {
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (ch->ch_tun.un_flags & UN_ISOPEN) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- ch->ch_tun.un_tty->ldisc->ops->write_wakeup)
- {
- DGNC_UNLOCK(ch->ch_lock, lock_flags);
- (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty);
- DGNC_LOCK(ch->ch_lock, lock_flags);
- }
+ if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
+ ch->ch_tun.un_tty->ldisc->ops->write_wakeup)
+ {
+ DGNC_UNLOCK(ch->ch_lock, lock_flags);
+ (ch->ch_tun.un_tty->ldisc->ops->write_wakeup)(ch->ch_tun.un_tty);
+ DGNC_LOCK(ch->ch_lock, lock_flags);
+ }
#else
if ((ch->ch_tun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_tun.un_tty->ldisc.ops->write_wakeup)
if (ch->ch_pun.un_flags & UN_ISOPEN) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
- if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- ch->ch_pun.un_tty->ldisc->ops->write_wakeup)
- {
- DGNC_UNLOCK(ch->ch_lock, lock_flags);
- (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty);
- DGNC_LOCK(ch->ch_lock, lock_flags);
- }
+ if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
+ ch->ch_pun.un_tty->ldisc->ops->write_wakeup)
+ {
+ DGNC_UNLOCK(ch->ch_lock, lock_flags);
+ (ch->ch_pun.un_tty->ldisc->ops->write_wakeup)(ch->ch_pun.un_tty);
+ DGNC_LOCK(ch->ch_lock, lock_flags);
+ }
#else
if ((ch->ch_pun.un_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
ch->ch_pun.un_tty->ldisc.ops->write_wakeup)
ch->ch_open_count, un->un_open_count));
DGNC_UNLOCK(ch->ch_lock, lock_flags);
- return;
- }
+ return;
+ }
/* OK, its the last close on the unit */
DPR_CLOSE(("dgnc_tty_close - last close on unit procedures\n"));
/*
* Only officially close channel if count is 0 and
- * DIGI_PRINTER bit is not set.
+ * DIGI_PRINTER bit is not set.
*/
if ((ch->ch_open_count == 0) && !(ch->ch_digi.digi_flags & DIGI_PRINTER)) {
DGNC_UNLOCK(ch->ch_lock, lock_flags);
- DPR_BASIC(("dgnc_tty_close - complete\n"));
+ DPR_BASIC(("dgnc_tty_close - complete\n"));
}
chars = thead - ttail + WQUEUESIZE;
}
- DPR_WRITE(("dgnc_tty_chars_in_buffer. Port: %x - %d (head: %d tail: %d)\n",
+ DPR_WRITE(("dgnc_tty_chars_in_buffer. Port: %x - %d (head: %d tail: %d)\n",
ch->ch_portnum, chars, thead, ttail));
- return(chars);
+ return(chars);
}
if (ch->ch_cpstime < current_time) {
/* buffer is empty */
- ch->ch_cpstime = current_time; /* reset ch_cpstime */
+ ch->ch_cpstime = current_time; /* reset ch_cpstime */
cps_limit = ch->ch_digi.digi_bufsize;
}
else if (ch->ch_cpstime < buffer_time) {
DPR_WRITE(("dgnc_tty_write_room - %d tail: %d head: %d\n", ret, tail, head));
- return(ret);
+ return(ret);
}
/* Update printer buffer empty time. */
if ((un->un_type == DGNC_PRINT) && (ch->ch_digi.digi_maxcps > 0)
&& (ch->ch_digi.digi_bufsize > 0)) {
- ch->ch_cpstime += (HZ * count) / ch->ch_digi.digi_maxcps;
+ ch->ch_cpstime += (HZ * count) / ch->ch_digi.digi_maxcps;
}
if (from_user) {
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
static int dgnc_tty_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear)
+ unsigned int set, unsigned int clear)
#else
static int dgnc_tty_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
if (set & TIOCM_RTS) {
ch->ch_mostat |= UART_MCR_RTS;
- }
+ }
if (set & TIOCM_DTR) {
ch->ch_mostat |= UART_MCR_DTR;
- }
+ }
if (clear & TIOCM_RTS) {
ch->ch_mostat &= ~(UART_MCR_RTS);
- }
+ }
if (clear & TIOCM_DTR) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- }
+ }
ch->ch_bd->bd_ops->assert_modem_signals(ch);
case TIOCMBIS:
if (arg & TIOCM_RTS) {
ch->ch_mostat |= UART_MCR_RTS;
- }
+ }
if (arg & TIOCM_DTR) {
ch->ch_mostat |= UART_MCR_DTR;
- }
+ }
break;
case TIOCMBIC:
if (arg & TIOCM_RTS) {
ch->ch_mostat &= ~(UART_MCR_RTS);
- }
+ }
if (arg & TIOCM_DTR) {
ch->ch_mostat &= ~(UART_MCR_DTR);
- }
+ }
break;
- case TIOCMSET:
+ case TIOCMSET:
if (arg & TIOCM_RTS) {
ch->ch_mostat |= UART_MCR_RTS;
- }
+ }
else {
ch->ch_mostat &= ~(UART_MCR_RTS);
}
if (arg & TIOCM_DTR) {
ch->ch_mostat |= UART_MCR_DTR;
- }
+ }
else {
ch->ch_mostat &= ~(UART_MCR_DTR);
}
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (-EFAULT);
- if (copy_from_user(&new_digi, new_info, sizeof(struct digi_t))) {
+ if (copy_from_user(&new_digi, new_info, sizeof(struct digi_t))) {
DPR_IOCTL(("DIGI_SETA failed copy_from_user\n"));
- return(-EFAULT);
+ return(-EFAULT);
}
DGNC_LOCK(ch->ch_lock, lock_flags);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
- return;
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ return;
DPR_IOCTL(("dgnc_tty_throttle start\n"));
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
- return;
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ return;
DPR_IOCTL(("dgnc_tty_unthrottle start\n"));
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
- return;
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ return;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
- return;
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ return;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
- return;
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ return;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
- return;
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ return;
DPR_IOCTL(("dgnc_tty_flush_buffer on port: %d start\n", ch->ch_portnum));
case TCSBRKP:
- /* support for POSIX tcsendbreak()
+ /* support for POSIX tcsendbreak()
* According to POSIX.1 spec (7.2.2.1.2) breaks should be
* between 0.25 and 0.5 seconds so we'll ask for something
* in the middle: 0.375 seconds.
case TIOCMGET:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
- return(dgnc_get_modem_info(ch, uarg));
+ return(dgnc_get_modem_info(ch, uarg));
case TIOCMBIS:
case TIOCMBIC:
ch->ch_bd->bd_ops->param(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
- }
+ }
case DIGI_GETCUSTOMBAUD:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
ch->ch_bd->bd_ops->param(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
- }
+ }
/*
* This ioctl allows insertion of a character into the front
*
* This ioctl is to satify the "Event Reporting"
* call that the RealPort protocol spec requires.
- */
+ */
case DIGI_REALPORT_GETEVENTS:
{
unsigned int events = 0;
* upon the values passed in by the RealPort Server.
* It also passes back whether the UART Transmitter is
* empty as well.
- */
+ */
case DIGI_REALPORT_GETBUFFERS:
{
struct digi_getbuffer buf;