#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)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Digi International, http://www.digi.com");
static void dgap_err(char *s);
/*
- * Function prototypes from dgap_sysfs.h
- */
+ * Function prototypes from dgap_sysfs.h
+ */
struct board_t;
struct channel_t;
struct un_t;
.c_cflag = (DEFAULT_CFLAGS), /* cflags */
.c_lflag = (DEFAULT_LFLAGS), /* lflags */
.c_cc = INIT_C_CC,
- .c_line = 0,
+ .c_line = 0,
};
static const struct tty_operations dgap_tty_ops = {
dgap_driver_start = TRUE;
- /* make sure that the globals are init'd before we do anything else */
- dgap_init_globals();
+ /*
+ * make sure that the globals are
+ * init'd before we do anything else
+ */
+ dgap_init_globals();
dgap_NumBoards = 0;
{
int i = 0;
- if(!brd || brd->magic != DGAP_BOARD_MAGIC)
+ if (!brd || brd->magic != DGAP_BOARD_MAGIC)
return;
if (brd->intr_used && brd->irq)
brd->re_map_membase = NULL;
}
- if (brd->msgbuf_head) {
- unsigned long flags;
+ if (brd->msgbuf_head) {
+ unsigned long flags;
- DGAP_LOCK(dgap_global_lock, flags);
- brd->msgbuf = NULL;
- printk("%s", brd->msgbuf_head);
- kfree(brd->msgbuf_head);
- brd->msgbuf_head = NULL;
- DGAP_UNLOCK(dgap_global_lock, flags);
- }
+ DGAP_LOCK(dgap_global_lock, flags);
+ brd->msgbuf = NULL;
+ printk("%s", brd->msgbuf_head);
+ kfree(brd->msgbuf_head);
+ brd->msgbuf_head = NULL;
+ DGAP_UNLOCK(dgap_global_lock, flags);
+ }
/* Free all allocated channels structs */
for (i = 0; i < MAXPORTS ; i++) {
dgap_Board[brd->boardnum] = NULL;
- kfree(brd);
+ kfree(brd);
}
static int dgap_finalize_board_init(struct board_t *brd) {
- int rc;
+ int rc;
if (!brd || brd->magic != DGAP_BOARD_MAGIC)
return -ENODEV;
if (!request_mem_region(brd->membase + PCI_IO_OFFSET, 0x200000, "dgap")) {
release_mem_region(brd->membase, 0x200000);
return -ENOMEM;
- }
+ }
brd->re_map_membase = ioremap(brd->membase, 0x200000);
if (!brd->re_map_membase) {
static void dgap_poll_handler(ulong dummy)
{
int i;
- struct board_t *brd;
- unsigned long lock_flags;
+ struct board_t *brd;
+ unsigned long lock_flags;
ulong new_time;
dgap_poll_counter++;
return -ENOMEM;
}
- DGAP_UNLOCK(dgap_global_lock, flags);
+ DGAP_UNLOCK(dgap_global_lock, flags);
return 0;
}
if (!brd->dgap_Major_TransparentPrint_Registered) {
/* Register Transparent Print devices */
- rc = tty_register_driver(brd->PrintDriver);
+ rc = tty_register_driver(brd->PrintDriver);
if (rc < 0)
return rc;
brd->dgap_Major_TransparentPrint_Registered = TRUE;
* If the device is not open, or CREAD is off, flush
* input data and return immediately.
*/
- if ((bd->state != BOARD_READY) || !tp || (tp->magic != TTY_MAGIC) ||
- !(ch->ch_tun.un_flags & UN_ISOPEN) || !(tp->termios.c_cflag & CREAD) ||
+ if ((bd->state != BOARD_READY) || !tp ||
+ (tp->magic != TTY_MAGIC) ||
+ !(ch->ch_tun.un_flags & UN_ISOPEN) ||
+ !(tp->termios.c_cflag & CREAD) ||
(ch->ch_tun.un_flags & UN_CLOSING)) {
writew(head, &(bs->rx_tail));
{
struct board_t *bd;
- int virt_carrier = 0;
- int phys_carrier = 0;
+ int virt_carrier = 0;
+ int phys_carrier = 0;
if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
DGAP_UNLOCK(ch->ch_lock, lock_flags2);
DGAP_UNLOCK(brd->bd_lock, lock_flags);
return -ENXIO;
- }
+ }
/*
* Initialize tty's
if (ch->ch_open_count && un->un_open_count) {
DGAP_UNLOCK(ch->ch_lock, lock_flags);
- return;
- }
+ return;
+ }
/* OK, its the last close on the unit */
/*
* 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)) {
if (!bd || bd->magic != DGAP_BOARD_MAGIC)
return 0;
- bs = ch->ch_bs;
+ bs = ch->ch_bs;
if (!bs)
return 0;
* 1) Transmit head and tail are equal (empty).
* 2) Command queue head and tail are equal (empty).
* 3) The "TBUSY" flag is 0. (Transmitter not busy).
- */
+ */
if ((ttail == thead) && (tbusy == 0) && (chead == ctail)) {
chars = 0;
if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return ret;
- bs = ch->ch_bs;
+ bs = ch->ch_bs;
if (!bs)
return ret;
ch = un->un_ch;
if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
- bs = ch->ch_bs;
+ bs = ch->ch_bs;
if (!bs)
return;
if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return 0;
- bs = ch->ch_bs;
+ bs = ch->ch_bs;
if (!bs)
return 0;
head = readw(&(bs->tx_head)) & tmask;
tail = readw(&(bs->tx_tail)) & tmask;
- if ((ret = tail - head - 1) < 0)
- ret += ch->ch_tsize;
+ ret = tail - head - 1;
+ if (ret < 0)
+ ret += ch->ch_tsize;
/* Limit printer to maxcps */
ret = dgap_maxcps_room(tty, ret);
if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return 0;
- bs = ch->ch_bs;
+ bs = ch->ch_bs;
if (!bs)
return 0;
/* Update printer buffer empty time. */
if ((un->un_type == DGAP_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) {
DGAP_LOCK(ch->ch_lock, lock_flags);
mstat = readb(&(ch->ch_bs->m_stat));
- /* Append any outbound signals that might be pending... */
- mstat |= ch->ch_mostat;
+ /* Append any outbound signals that might be pending... */
+ mstat |= ch->ch_mostat;
DGAP_UNLOCK(ch->ch_lock, lock_flags);
*/
static int dgap_tty_tiocmset(struct tty_struct *tty,
- unsigned int set, unsigned int clear)
+ unsigned int set, unsigned int clear)
{
struct board_t *bd;
struct channel_t *ch;
if (set & TIOCM_RTS) {
ch->ch_mforce |= D_RTS(ch);
ch->ch_mval |= D_RTS(ch);
- }
+ }
if (set & TIOCM_DTR) {
ch->ch_mforce |= D_DTR(ch);
ch->ch_mval |= D_DTR(ch);
- }
+ }
if (clear & TIOCM_RTS) {
ch->ch_mforce |= D_RTS(ch);
ch->ch_mval &= ~(D_RTS(ch));
- }
+ }
if (clear & TIOCM_DTR) {
ch->ch_mforce |= D_DTR(ch);
ch->ch_mval &= ~(D_DTR(ch));
- }
+ }
dgap_param(tty);
if (arg & TIOCM_RTS) {
ch->ch_mforce |= D_RTS(ch);
ch->ch_mval |= D_RTS(ch);
- }
+ }
if (arg & TIOCM_DTR) {
ch->ch_mforce |= D_DTR(ch);
ch->ch_mval |= D_DTR(ch);
- }
+ }
break;
if (arg & TIOCM_RTS) {
ch->ch_mforce |= D_RTS(ch);
ch->ch_mval &= ~(D_RTS(ch));
- }
+ }
if (arg & TIOCM_DTR) {
ch->ch_mforce |= D_DTR(ch);
ch->ch_mval &= ~(D_DTR(ch));
- }
+ }
break;
- case TIOCMSET:
+ case TIOCMSET:
ch->ch_mforce = D_DTR(ch)|D_RTS(ch);
if (arg & TIOCM_RTS) {
ch->ch_mval |= D_RTS(ch);
- }
+ }
else {
ch->ch_mval &= ~(D_RTS(ch));
}
if (arg & TIOCM_DTR) {
ch->ch_mval |= (D_DTR(ch));
- }
+ }
else {
ch->ch_mval &= ~(D_DTR(ch));
}
if (!un || un->magic != DGAP_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
bd = ch->ch_bd;
if (!un || un->magic != DGAP_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
bd = ch->ch_bd;
if (!un || un->magic != DGAP_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
bd = ch->ch_bd;
if (!un || un->magic != DGAP_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
bd = ch->ch_bd;
if (!un || un->magic != DGAP_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
bd = ch->ch_bd;
if (!un || un->magic != DGAP_UNIT_MAGIC)
return;
- ch = un->un_ch;
- if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
+ ch = un->un_ch;
+ if (!ch || ch->magic != DGAP_CHANNEL_MAGIC)
return;
bd = ch->ch_bd;
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
return 0;
- case TIOCSBRK:
+ case TIOCSBRK:
/*
* FEP5 doesn't support turning on a break unconditionally.
* The FEP5 device will stop sending a break automatically
return 0;
- case TIOCCBRK:
+ case TIOCCBRK:
/*
* FEP5 doesn't support turning off a break unconditionally.
* The FEP5 device will stop sending a break automatically
if (bd->state != BOARD_READY)
return 0;
- bn = bd->boardnum;
+ bn = bd->boardnum;
cn = ch->ch_portnum;
for (cptr = bd->bd_config; cptr; cptr = cptr->next) {
{
char *ret_ptr = *in;
- char *ptr = dgap_sindex(*in, " \t\n");
+ char *ptr = dgap_sindex(*in, " \t\n");
/* If no word found, return null */
if (!ptr)