aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/dgnc/dgnc_cls.c44
-rw-r--r--drivers/staging/dgnc/dgnc_driver.c3
-rw-r--r--drivers/staging/dgnc/dgnc_driver.h11
-rw-r--r--drivers/staging/dgnc/dgnc_mgmt.c2
-rw-r--r--drivers/staging/dgnc/dgnc_neo.c48
-rw-r--r--drivers/staging/dgnc/dgnc_tty.c150
6 files changed, 119 insertions, 139 deletions
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 4862c9d095f8..9639035fddd1 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -282,7 +282,7 @@ static inline void cls_clear_break(struct channel_t *ch, int force)
{
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -314,7 +314,7 @@ static void cls_copy_data_from_uart_to_queue(struct channel_t *ch)
ushort tail;
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -386,7 +386,7 @@ static void cls_assert_modem_signals(struct channel_t *ch)
{
unsigned char out;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
out = ch->ch_mostat;
@@ -409,7 +409,7 @@ static void cls_copy_data_from_queue_to_uart(struct channel_t *ch)
uint len_written = 0;
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -479,7 +479,7 @@ static void cls_parse_modem(struct channel_t *ch, unsigned char signals)
unsigned char msignals = signals;
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
/*
@@ -551,8 +551,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port)
return;
ch = brd->channels[port];
- if (ch->magic != DGNC_CHANNEL_MAGIC)
- return;
/* Here we try to figure out what caused the interrupt to happen */
while (1) {
@@ -582,7 +580,7 @@ static inline void cls_parse_isr(struct dgnc_board *brd, uint port)
/* Channel lock MUST be held before calling this function! */
static void cls_flush_uart_write(struct channel_t *ch)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
@@ -597,7 +595,7 @@ static void cls_flush_uart_write(struct channel_t *ch)
/* Channel lock MUST be held before calling this function! */
static void cls_flush_uart_read(struct channel_t *ch)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
/*
@@ -627,19 +625,19 @@ static void cls_param(struct tty_struct *tty)
struct channel_t *ch;
struct un_t *un;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = (struct un_t *)tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
/* If baud rate is zero, flush queues, and set mval to drop DTR. */
@@ -858,7 +856,7 @@ static void cls_tasklet(unsigned long data)
int state = 0;
int ports = 0;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&bd->bd_lock, flags);
@@ -914,7 +912,7 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
unsigned char poll_reg;
unsigned long flags;
- if (!brd || brd->magic != DGNC_BOARD_MAGIC)
+ if (!brd)
return IRQ_NONE;
spin_lock_irqsave(&brd->bd_intr_lock, flags);
@@ -961,15 +959,15 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
struct channel_t *ch;
struct un_t *un;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -ENXIO;
un = (struct un_t *)tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -ENXIO;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -ENXIO;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -986,7 +984,7 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
static void cls_send_start_character(struct channel_t *ch)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
if (ch->ch_startc != _POSIX_VDISABLE) {
@@ -997,7 +995,7 @@ static void cls_send_start_character(struct channel_t *ch)
static void cls_send_stop_character(struct channel_t *ch)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
if (ch->ch_stopc != _POSIX_VDISABLE) {
@@ -1056,7 +1054,7 @@ static uint cls_get_uart_bytes_left(struct channel_t *ch)
unsigned char left = 0;
unsigned char lsr = 0;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return 0;
lsr = readb(&ch->ch_cls_uart->lsr);
@@ -1080,7 +1078,7 @@ static uint cls_get_uart_bytes_left(struct channel_t *ch)
*/
static void cls_send_break(struct channel_t *ch, int msecs)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
/* If we receive a time of 0, this means turn off the break. */
@@ -1119,7 +1117,7 @@ static void cls_send_break(struct channel_t *ch, int msecs)
*/
static void cls_send_immediate_char(struct channel_t *ch, unsigned char c)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
writeb(c, &ch->ch_cls_uart->txrx);
diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index 91c4fab1cd89..253f38b25a54 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -110,7 +110,6 @@ static struct dgnc_board *dgnc_found_board(struct pci_dev *pdev, int id)
return ERR_PTR(-ENOMEM);
/* store the info for the board we've found */
- brd->magic = DGNC_BOARD_MAGIC;
brd->boardnum = dgnc_num_boards;
brd->vendor = dgnc_pci_tbl[id].vendor;
brd->device = dgnc_pci_tbl[id].device;
@@ -444,7 +443,7 @@ static void dgnc_cleanup_board(struct dgnc_board *brd)
{
int i = 0;
- if (!brd || brd->magic != DGNC_BOARD_MAGIC)
+ if (!brd)
return;
switch (brd->device) {
diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h
index a25801d76095..980410fc4801 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -35,11 +35,6 @@
#define MAXPORTS 8
#define MAXTTYNAMELEN 200
-/* Our 3 magic numbers for our board, channel and unit structs */
-#define DGNC_BOARD_MAGIC 0x5c6df104
-#define DGNC_CHANNEL_MAGIC 0x6c6df104
-#define DGNC_UNIT_MAGIC 0x7c6df104
-
/* Serial port types */
#define DGNC_SERIAL 0
#define DGNC_PRINT 1
@@ -120,7 +115,6 @@ struct board_ops {
/**
* struct dgnc_board - Per board information.
- * @magic: Board magic number.
* @boardnum: Board number (0 - 32).
*
* @type: Type of board.
@@ -163,7 +157,6 @@ struct board_ops {
* @dgnc_board_table: Proc/<board> entry
*/
struct dgnc_board {
- int magic;
int boardnum;
int type;
@@ -245,7 +238,6 @@ struct device;
/**
* struct un_t - terminal or printer unit
- * @magic: Unit magic number.
* @un_open_count: Counter of opens to port.
* @un_tty: Pointer to unit tty structure.
* @un_flags: Unit flags.
@@ -253,7 +245,6 @@ struct device;
* @un_dev: Minor device number.
*/
struct un_t {
- int magic;
struct channel_t *un_ch;
ulong un_time;
uint un_type;
@@ -295,7 +286,6 @@ struct un_t {
/**
* struct channel_t - Channel information.
- * @magic: Channel magic number.
* @dgnc_board: Pointer to board structure.
* @ch_bd: Transparent print structure.
* @ch_tun: Terminal unit information.
@@ -348,7 +338,6 @@ struct un_t {
* @dgnc_channel_table: Proc/<board>/<channel> entry.
*/
struct channel_t {
- int magic;
struct dgnc_board *ch_bd;
struct digi_t ch_digi;
struct un_t ch_tun;
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index 9e45ac8e0005..3ca473b47daf 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -175,7 +175,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ch = dgnc_board[board]->channels[channel];
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -ENODEV;
memset(&ni, 0, sizeof(ni));
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8febe4f1436f..b478bb44339f 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -392,7 +392,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, uint port)
unsigned long flags;
ch = brd->channels[port];
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
/* Here we try to figure out what caused the interrupt to happen */
@@ -505,14 +505,14 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, uint port)
int linestatus;
unsigned long flags;
- if (!brd || brd->magic != DGNC_BOARD_MAGIC)
+ if (!brd)
return;
if (port >= brd->maxports)
return;
ch = brd->channels[port];
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
linestatus = readb(&ch->ch_neo_uart->lsr);
@@ -579,19 +579,19 @@ static void neo_param(struct tty_struct *tty)
struct channel_t *ch;
struct un_t *un;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = (struct un_t *)tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
/* If baud rate is zero, flush queues, and set mval to drop DTR. */
@@ -822,7 +822,7 @@ static void neo_tasklet(unsigned long data)
int state = 0;
int ports = 0;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&bd->bd_lock, flags);
@@ -839,9 +839,7 @@ static void neo_tasklet(unsigned long data)
if ((state == BOARD_READY) && (ports > 0)) {
for (i = 0; i < ports; i++) {
ch = bd->channels[i];
-
- /* Just being careful... */
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
continue;
/*
@@ -888,7 +886,7 @@ static irqreturn_t neo_intr(int irq, void *voidbrd)
unsigned long flags;
unsigned long flags2;
- if (!brd || brd->magic != DGNC_BOARD_MAGIC)
+ if (!brd)
return IRQ_NONE;
/* Lock out the slow poller from running on this board. */
@@ -1023,7 +1021,7 @@ static void neo_copy_data_from_uart_to_queue(struct channel_t *ch)
ushort tail;
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1195,15 +1193,15 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
struct un_t *un;
int rc = 0;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -ENXIO;
un = (struct un_t *)tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -ENXIO;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -ENXIO;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1227,7 +1225,7 @@ static void neo_flush_uart_write(struct channel_t *ch)
unsigned char tmp = 0;
int i = 0;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_XMIT),
@@ -1258,7 +1256,7 @@ static void neo_flush_uart_read(struct channel_t *ch)
unsigned char tmp = 0;
int i = 0;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR,
@@ -1288,7 +1286,7 @@ static void neo_copy_data_from_queue_to_uart(struct channel_t *ch)
uint len_written = 0;
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1425,7 +1423,7 @@ static void neo_parse_modem(struct channel_t *ch, unsigned char signals)
{
unsigned char msignals = signals;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
/*
@@ -1482,7 +1480,7 @@ static void neo_assert_modem_signals(struct channel_t *ch)
{
unsigned char out;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
out = ch->ch_mostat;
@@ -1499,7 +1497,7 @@ static void neo_assert_modem_signals(struct channel_t *ch)
static void neo_send_start_character(struct channel_t *ch)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
if (ch->ch_startc != _POSIX_VDISABLE) {
@@ -1512,7 +1510,7 @@ static void neo_send_start_character(struct channel_t *ch)
static void neo_send_stop_character(struct channel_t *ch)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
if (ch->ch_stopc != _POSIX_VDISABLE) {
@@ -1619,7 +1617,7 @@ static void neo_send_break(struct channel_t *ch, int msecs)
*/
static void neo_send_immediate_char(struct channel_t *ch, unsigned char c)
{
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
writeb(c, &ch->ch_neo_uart->txrx);
@@ -1672,7 +1670,7 @@ static void neo_vpd(struct dgnc_board *brd)
unsigned int i = 0;
unsigned int a;
- if (!brd || brd->magic != DGNC_BOARD_MAGIC)
+ if (!brd)
return;
if (!brd->re_map_membase)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 6376f62c436e..9e98781ca6fe 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -264,14 +264,10 @@ int dgnc_tty_init(struct dgnc_board *brd)
for (i = 0; i < brd->nasync; i++, ch = brd->channels[i]) {
spin_lock_init(&ch->ch_lock);
- /* Store all our magic numbers */
- ch->magic = DGNC_CHANNEL_MAGIC;
- ch->ch_tun.magic = DGNC_UNIT_MAGIC;
ch->ch_tun.un_ch = ch;
ch->ch_tun.un_type = DGNC_SERIAL;
ch->ch_tun.un_dev = i;
- ch->ch_pun.magic = DGNC_UNIT_MAGIC;
ch->ch_pun.un_ch = ch;
ch->ch_pun.un_type = DGNC_PRINT;
ch->ch_pun.un_dev = i + 128;
@@ -351,7 +347,7 @@ static void dgnc_wmove(struct channel_t *ch, char *buf, uint n)
int remain;
uint head;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
head = ch->ch_w_head & WQUEUEMASK;
@@ -401,13 +397,13 @@ void dgnc_input(struct channel_t *ch)
int s = 0;
int i = 0;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
tp = ch->ch_tun.un_tty;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -424,7 +420,7 @@ void dgnc_input(struct channel_t *ch)
* If the device is not open, or CREAD is off,
* flush input data and return immediately.
*/
- if (!tp || (tp->magic != TTY_MAGIC) ||
+ if (!tp ||
!(ch->ch_tun.un_flags & UN_ISOPEN) ||
!C_CREAD(tp) ||
(ch->ch_tun.un_flags & UN_CLOSING)) {
@@ -547,7 +543,7 @@ void dgnc_carrier(struct channel_t *ch)
int virt_carrier = 0;
int phys_carrier = 0;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
if (ch->ch_mistat & UART_MSR_DCD)
@@ -771,7 +767,7 @@ void dgnc_wakeup_writes(struct channel_t *ch)
int qlen = 0;
unsigned long flags;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1163,7 +1159,7 @@ static int dgnc_block_til_ready(struct tty_struct *tty,
/* Hangup the port. Like a close, but don't wait for output to drain. */
static void dgnc_tty_hangup(struct tty_struct *tty)
{
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
/* flush the transmit queues */
@@ -1177,19 +1173,19 @@ static void dgnc_tty_close(struct tty_struct *tty, struct file *file)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1322,11 +1318,11 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty)
return 0;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return 0;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return 0;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1398,11 +1394,11 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
return 0;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return 0;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return 0;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1469,11 +1465,11 @@ static int dgnc_tty_write(struct tty_struct *tty,
return 0;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return 0;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return 0;
if (!count)
@@ -1584,15 +1580,15 @@ static int dgnc_tty_tiocmget(struct tty_struct *tty)
unsigned char mstat = 0;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -EIO;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -EIO;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -EIO;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1628,19 +1624,19 @@ static int dgnc_tty_tiocmset(struct tty_struct *tty,
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -EIO;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -EIO;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -EIO;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return -EIO;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1672,19 +1668,19 @@ static int dgnc_tty_send_break(struct tty_struct *tty, int msec)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -EIO;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -EIO;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -EIO;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return -EIO;
if (msec < 0)
@@ -1706,19 +1702,19 @@ static void dgnc_tty_wait_until_sent(struct tty_struct *tty, int timeout)
struct channel_t *ch;
struct un_t *un;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
bd->bd_ops->drain(tty, 0);
@@ -1732,19 +1728,19 @@ static void dgnc_tty_send_xchar(struct tty_struct *tty, char c)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1759,7 +1755,7 @@ static inline int dgnc_get_mstat(struct channel_t *ch)
unsigned long flags;
int rc;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -ENXIO;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -1864,15 +1860,15 @@ static int dgnc_tty_digigeta(struct tty_struct *tty,
if (!retinfo)
return -EFAULT;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -EFAULT;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -EFAULT;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -EFAULT;
memset(&tmp, 0, sizeof(tmp));
@@ -1897,19 +1893,19 @@ static int dgnc_tty_digiseta(struct tty_struct *tty,
struct digi_t new_digi;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -EFAULT;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -EFAULT;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -EFAULT;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return -EFAULT;
if (copy_from_user(&new_digi, new_info, sizeof(new_digi)))
@@ -1973,19 +1969,19 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2009,15 +2005,15 @@ static void dgnc_tty_throttle(struct tty_struct *tty)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2033,15 +2029,15 @@ static void dgnc_tty_unthrottle(struct tty_struct *tty)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2058,19 +2054,19 @@ static void dgnc_tty_start(struct tty_struct *tty)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2087,19 +2083,19 @@ static void dgnc_tty_stop(struct tty_struct *tty)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2127,19 +2123,19 @@ static void dgnc_tty_flush_chars(struct tty_struct *tty)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2156,15 +2152,15 @@ static void dgnc_tty_flush_buffer(struct tty_struct *tty)
struct un_t *un;
unsigned long flags;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return;
spin_lock_irqsave(&ch->ch_lock, flags);
@@ -2210,19 +2206,19 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned long flags;
void __user *uarg = (void __user *)arg;
- if (!tty || tty->magic != TTY_MAGIC)
+ if (!tty)
return -ENODEV;
un = tty->driver_data;
- if (!un || un->magic != DGNC_UNIT_MAGIC)
+ if (!un)
return -ENODEV;
ch = un->un_ch;
- if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
+ if (!ch)
return -ENODEV;
bd = ch->ch_bd;
- if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+ if (!bd)
return -ENODEV;
ch_bd_ops = bd->bd_ops;