Commit 8f90ef80 authored by Lidza Louina's avatar Lidza Louina Committed by Greg Kroah-Hartman

staging: dgnc: removes parentheses around return statements

This patch removes parentheses around return
statements. They aren't needed.
Signed-off-by: default avatarLidza Louina <lidza.louina@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 03425f55
......@@ -976,17 +976,17 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
int rc = 0;
if (!tty || tty->magic != TTY_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
un = (struct un_t *) tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -1002,7 +1002,7 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
if (rc)
DPR_IOCTL(("%d Drain - User ctrl c'ed\n", __LINE__));
return (rc);
return rc;
}
......
......@@ -225,7 +225,7 @@ int dgnc_init_module(void)
rc = dgnc_start();
if (rc < 0) {
return(rc);
return rc;
}
/*
......@@ -250,7 +250,7 @@ int dgnc_init_module(void)
}
DPR_INIT(("Finished init_module. Returning %d\n", rc));
return (rc);
return rc;
}
......@@ -286,7 +286,7 @@ static int dgnc_start(void)
if (rc <= 0) {
APR(("Can't register dgnc driver device (%d)\n", rc));
rc = -ENXIO;
return(rc);
return rc;
}
dgnc_Major = rc;
......@@ -311,7 +311,7 @@ static int dgnc_start(void)
if (rc < 0) {
APR(("tty preinit - not enough memory (%d)\n", rc));
return(rc);
return rc;
}
/* Start the poller */
......@@ -328,7 +328,7 @@ static int dgnc_start(void)
dgnc_driver_state = DRIVER_READY;
}
return(rc);
return rc;
}
/*
......@@ -502,7 +502,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
(struct dgnc_board *) kzalloc(sizeof(struct dgnc_board), GFP_KERNEL);
if (!brd) {
APR(("memory allocation for board structure failed\n"));
return(-ENOMEM);
return -ENOMEM;
}
/* make a temporary message buffer for the boot messages */
......@@ -511,7 +511,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
if (!brd->msgbuf) {
kfree(brd);
APR(("memory allocation for board msgbuf failed\n"));
return(-ENOMEM);
return -ENOMEM;
}
/* store the info for the board we've found */
......@@ -663,7 +663,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
default:
APR(("Did not find any compatible Neo or Classic PCI boards in system.\n"));
return (-ENXIO);
return -ENXIO;
}
......@@ -725,11 +725,11 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
wake_up_interruptible(&brd->state_wait);
return(0);
return 0;
failed:
return (-ENXIO);
return -ENXIO;
}
......@@ -740,7 +740,7 @@ static int dgnc_finalize_board_init(struct dgnc_board *brd) {
DPR_INIT(("dgnc_finalize_board_init() - start\n"));
if (!brd || brd->magic != DGNC_BOARD_MAGIC)
return(-ENODEV);
return -ENODEV;
DPR_INIT(("dgnc_finalize_board_init() - start #2\n"));
......@@ -756,7 +756,7 @@ static int dgnc_finalize_board_init(struct dgnc_board *brd) {
DPR_INIT(("Requested and received usage of IRQ %d\n", brd->irq));
}
}
return(rc);
return rc;
}
/*
......@@ -900,7 +900,7 @@ int dgnc_ms_sleep(ulong ms)
{
current->state = TASK_INTERRUPTIBLE;
schedule_timeout((ms * HZ) / 1000);
return (signal_pending(current));
return signal_pending(current);
}
......@@ -912,47 +912,47 @@ char *dgnc_ioctl_name(int cmd)
{
switch(cmd) {
case TCGETA: return("TCGETA");
case TCGETS: return("TCGETS");
case TCSETA: return("TCSETA");
case TCSETS: return("TCSETS");
case TCSETAW: return("TCSETAW");
case TCSETSW: return("TCSETSW");
case TCSETAF: return("TCSETAF");
case TCSETSF: return("TCSETSF");
case TCSBRK: return("TCSBRK");
case TCXONC: return("TCXONC");
case TCFLSH: return("TCFLSH");
case TIOCGSID: return("TIOCGSID");
case TIOCGETD: return("TIOCGETD");
case TIOCSETD: return("TIOCSETD");
case TIOCGWINSZ: return("TIOCGWINSZ");
case TIOCSWINSZ: return("TIOCSWINSZ");
case TIOCMGET: return("TIOCMGET");
case TIOCMSET: return("TIOCMSET");
case TIOCMBIS: return("TIOCMBIS");
case TIOCMBIC: return("TIOCMBIC");
case TCGETA: return "TCGETA";
case TCGETS: return "TCGETS";
case TCSETA: return "TCSETA";
case TCSETS: return "TCSETS";
case TCSETAW: return "TCSETAW";
case TCSETSW: return "TCSETSW";
case TCSETAF: return "TCSETAF";
case TCSETSF: return "TCSETSF";
case TCSBRK: return "TCSBRK";
case TCXONC: return "TCXONC";
case TCFLSH: return "TCFLSH";
case TIOCGSID: return "TIOCGSID";
case TIOCGETD: return "TIOCGETD";
case TIOCSETD: return "TIOCSETD";
case TIOCGWINSZ: return "TIOCGWINSZ";
case TIOCSWINSZ: return "TIOCSWINSZ";
case TIOCMGET: return "TIOCMGET";
case TIOCMSET: return "TIOCMSET";
case TIOCMBIS: return "TIOCMBIS";
case TIOCMBIC: return "TIOCMBIC";
/* from digi.h */
case DIGI_SETA: return("DIGI_SETA");
case DIGI_SETAW: return("DIGI_SETAW");
case DIGI_SETAF: return("DIGI_SETAF");
case DIGI_SETFLOW: return("DIGI_SETFLOW");
case DIGI_SETAFLOW: return("DIGI_SETAFLOW");
case DIGI_GETFLOW: return("DIGI_GETFLOW");
case DIGI_GETAFLOW: return("DIGI_GETAFLOW");
case DIGI_GETA: return("DIGI_GETA");
case DIGI_GEDELAY: return("DIGI_GEDELAY");
case DIGI_SEDELAY: return("DIGI_SEDELAY");
case DIGI_GETCUSTOMBAUD: return("DIGI_GETCUSTOMBAUD");
case DIGI_SETCUSTOMBAUD: return("DIGI_SETCUSTOMBAUD");
case TIOCMODG: return("TIOCMODG");
case TIOCMODS: return("TIOCMODS");
case TIOCSDTR: return("TIOCSDTR");
case TIOCCDTR: return("TIOCCDTR");
default: return("unknown");
case DIGI_SETA: return "DIGI_SETA";
case DIGI_SETAW: return "DIGI_SETAW";
case DIGI_SETAF: return "DIGI_SETAF";
case DIGI_SETFLOW: return "DIGI_SETFLOW";
case DIGI_SETAFLOW: return "DIGI_SETAFLOW";
case DIGI_GETFLOW: return "DIGI_GETFLOW";
case DIGI_GETAFLOW: return "DIGI_GETAFLOW";
case DIGI_GETA: return "DIGI_GETA";
case DIGI_GEDELAY: return "DIGI_GEDELAY";
case DIGI_SEDELAY: return "DIGI_SEDELAY";
case DIGI_GETCUSTOMBAUD: return "DIGI_GETCUSTOMBAUD";
case DIGI_SETCUSTOMBAUD: return "DIGI_SETCUSTOMBAUD";
case TIOCMODG: return "TIOCMODG";
case TIOCMODS: return "TIOCMODS";
case TIOCSDTR: return "TIOCSDTR";
case TIOCCDTR: return "TIOCCDTR";
default: return "unknown";
}
}
......@@ -74,13 +74,13 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
/* Only allow 1 open at a time on mgmt device */
if (dgnc_mgmt_in_use[minor]) {
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
return (-EBUSY);
return -EBUSY;
}
dgnc_mgmt_in_use[minor]++;
}
else {
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
return (-ENXIO);
return -ENXIO;
}
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
......@@ -154,7 +154,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ddi.dinfo_nboards, ddi.dinfo_version));
if (copy_to_user(uarg, &ddi, sizeof (ddi)))
return(-EFAULT);
return -EFAULT;
break;
}
......@@ -166,13 +166,13 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct digi_info di;
if (copy_from_user(&brd, uarg, sizeof(int))) {
return(-EFAULT);
return -EFAULT;
}
DPR_MGMT(("DIGI_GETBD asking about board: %d\n", brd));
if ((brd < 0) || (brd > dgnc_NumBoards) || (dgnc_NumBoards == 0))
return (-ENODEV);
return -ENODEV;
memset(&di, 0, sizeof(di));
......@@ -196,7 +196,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
di.info_bdtype, di.info_bdstate, di.info_nports, di.info_physsize));
if (copy_to_user(uarg, &di, sizeof (di)))
return (-EFAULT);
return -EFAULT;
break;
}
......@@ -210,7 +210,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
uint channel = 0;
if (copy_from_user(&ni, uarg, sizeof(struct ni_info))) {
return(-EFAULT);
return -EFAULT;
}
DPR_MGMT(("DIGI_GETBD asking about board: %d channel: %d\n",
......@@ -221,16 +221,16 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* Verify boundaries on board */
if ((board < 0) || (board > dgnc_NumBoards) || (dgnc_NumBoards == 0))
return (-ENODEV);
return -ENODEV;
/* Verify boundaries on channel */
if ((channel < 0) || (channel > dgnc_Board[board]->nasync))
return (-ENODEV);
return -ENODEV;
ch = dgnc_Board[board]->channels[channel];
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (-ENODEV);
return -ENODEV;
memset(&ni, 0, sizeof(ni));
ni.board = board;
......@@ -291,7 +291,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (copy_to_user(uarg, &ni, sizeof(ni)))
return (-EFAULT);
return -EFAULT;
break;
}
......
......@@ -1404,17 +1404,17 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
int rc = 0;
if (!tty || tty->magic != TTY_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
un = (struct un_t *) tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
DPR_IOCTL(("%d Drain wait started.\n", __LINE__));
......@@ -1439,7 +1439,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
DPR_IOCTL(("%d Drain wait finished.\n", __LINE__));
}
return (rc);
return rc;
}
......
......@@ -152,13 +152,13 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
#define DGNC_VERIFY_BOARD(p, bd) \
if (!p) \
return (0); \
return 0; \
\
bd = dev_get_drvdata(p); \
if (!bd || bd->magic != DGNC_BOARD_MAGIC) \
return (0); \
return 0; \
if (bd->state != BOARD_READY) \
return (0); \
return 0; \
......@@ -432,18 +432,18 @@ static ssize_t dgnc_tty_state_show(struct device *d, struct device_attribute *at
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%s", un->un_open_count ? "Open" : "Closed");
}
......@@ -457,18 +457,18 @@ static ssize_t dgnc_tty_baud_show(struct device *d, struct device_attribute *att
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%d\n", ch->ch_old_baud);
}
......@@ -482,18 +482,18 @@ static ssize_t dgnc_tty_msignals_show(struct device *d, struct device_attribute
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
if (ch->ch_open_count) {
return snprintf(buf, PAGE_SIZE, "%s %s %s %s %s %s\n",
......@@ -516,18 +516,18 @@ static ssize_t dgnc_tty_iflag_show(struct device *d, struct device_attribute *at
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_iflag);
}
......@@ -541,18 +541,18 @@ static ssize_t dgnc_tty_cflag_show(struct device *d, struct device_attribute *at
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_cflag);
}
......@@ -566,18 +566,18 @@ static ssize_t dgnc_tty_oflag_show(struct device *d, struct device_attribute *at
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_oflag);
}
......@@ -591,18 +591,18 @@ static ssize_t dgnc_tty_lflag_show(struct device *d, struct device_attribute *at
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_lflag);
}
......@@ -616,18 +616,18 @@ static ssize_t dgnc_tty_digi_flag_show(struct device *d, struct device_attribute
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_digi.digi_flags);
}
......@@ -641,18 +641,18 @@ static ssize_t dgnc_tty_rxcount_show(struct device *d, struct device_attribute *
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_rxcount);
}
......@@ -666,18 +666,18 @@ static ssize_t dgnc_tty_txcount_show(struct device *d, struct device_attribute *
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%ld\n", ch->ch_txcount);
}
......@@ -691,18 +691,18 @@ static ssize_t dgnc_tty_name_show(struct device *d, struct device_attribute *att
struct un_t *un;
if (!d)
return (0);
return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (0);
return 0;
if (bd->state != BOARD_READY)
return (0);
return 0;
return snprintf(buf, PAGE_SIZE, "%sn%d%c\n",
(un->un_type == DGNC_PRINT) ? "pr" : "tty",
......
......@@ -190,10 +190,10 @@ int dgnc_tty_preinit(void)
if (!dgnc_TmpWriteBuf) {
DPR_INIT(("unable to allocate tmp write buf"));
return (-ENOMEM);
return -ENOMEM;
}
return(0);
return 0;
}
......@@ -232,7 +232,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
*/
brd->SerialDriver.ttys = kzalloc(brd->maxports * sizeof(struct tty_struct *), GFP_KERNEL);
if (!brd->SerialDriver.ttys)
return(-ENOMEM);
return -ENOMEM;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
brd->SerialDriver.refcount = brd->TtyRefCnt;
......@@ -242,12 +242,12 @@ int dgnc_tty_register(struct dgnc_board *brd)
brd->SerialDriver.termios = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL);
if (!brd->SerialDriver.termios)
return(-ENOMEM);
return -ENOMEM;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
brd->SerialDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL);
if (!brd->SerialDriver.termios_locked)
return(-ENOMEM);
return -ENOMEM;
#endif
/*
* Entry points for driver. Called by the kernel from
......@@ -260,7 +260,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
rc = tty_register_driver(&brd->SerialDriver);
if (rc < 0) {
APR(("Can't register tty device (%d)\n", rc));
return(rc);
return rc;
}
brd->dgnc_Major_Serial_Registered = TRUE;
}
......@@ -291,7 +291,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
*/
brd->PrintDriver.ttys = kzalloc(brd->maxports * sizeof(struct tty_struct *), GFP_KERNEL);
if (!brd->PrintDriver.ttys)
return(-ENOMEM);
return -ENOMEM;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
brd->PrintDriver.refcount = brd->TtyRefCnt;
......@@ -301,12 +301,12 @@ int dgnc_tty_register(struct dgnc_board *brd)
brd->PrintDriver.termios = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL);
if (!brd->PrintDriver.termios)
return(-ENOMEM);
return -ENOMEM;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
brd->PrintDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct ktermios *), GFP_KERNEL);
if (!brd->PrintDriver.termios_locked)
return(-ENOMEM);
return -ENOMEM;
#endif
/*
......@@ -320,7 +320,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
rc = tty_register_driver(&brd->PrintDriver);
if (rc < 0) {
APR(("Can't register Transparent Print device (%d)\n", rc));
return(rc);
return rc;
}
brd->dgnc_Major_TransparentPrint_Registered = TRUE;
}
......@@ -331,7 +331,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
DPR_INIT(("DGNC REGISTER TTY: MAJOR: %d\n", brd->SerialDriver.major));
return (rc);
return rc;
}
......@@ -348,7 +348,7 @@ int dgnc_tty_init(struct dgnc_board *brd)
struct channel_t *ch;
if (!brd)
return (-ENXIO);
return -ENXIO;
DPR_INIT(("dgnc_tty_init start\n"));
......@@ -436,7 +436,7 @@ int dgnc_tty_init(struct dgnc_board *brd)
DPR_INIT(("dgnc_tty_init finish\n"));
return (0);
return 0;
}
......@@ -1473,7 +1473,7 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file)
DGNC_UNLOCK(ch->ch_lock, lock_flags);
DPR_OPEN(("dgnc_tty_open finished\n"));
return (rc);
return rc;
}
......@@ -1491,12 +1491,12 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
int sleep_on_un_flags = 0;
if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC) {
return (-ENXIO);
return -ENXIO;
}
DPR_OPEN(("dgnc_block_til_ready - before block.\n"));
......@@ -1624,12 +1624,12 @@ static int dgnc_block_til_ready(struct tty_struct *tty, struct file *file, struc
if (retval) {
DPR_OPEN(("dgnc_block_til_ready - done. error. retval: %x\n", retval));
return(retval);
return retval;
}
DPR_OPEN(("dgnc_block_til_ready - done no error. jiffies: %lu\n", jiffies));
return(0);
return 0;
}
......@@ -1843,15 +1843,15 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty)
ulong lock_flags = 0;
if (tty == NULL)
return(0);
return 0;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -1873,7 +1873,7 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct *tty)
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;
}
......@@ -1891,22 +1891,22 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int bytes_available)
struct un_t *un = NULL;
if (!tty)
return (bytes_available);
return bytes_available;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (bytes_available);
return bytes_available;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (bytes_available);
return bytes_available;
/*
* If its not the Transparent print device, return
* the full data amount.
*/
if (un->un_type != DGNC_PRINT)
return (bytes_available);
return bytes_available;
if (ch->ch_digi.digi_maxcps > 0 && ch->ch_digi.digi_bufsize > 0 ) {
int cps_limit = 0;
......@@ -1931,7 +1931,7 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int bytes_available)
bytes_available = min(cps_limit, bytes_available);
}
return (bytes_available);
return bytes_available;
}
......@@ -1951,15 +1951,15 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
ulong lock_flags = 0;
if (tty == NULL || dgnc_TmpWriteBuf == NULL)
return(0);
return 0;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (0);
return 0;
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -1994,7 +1994,7 @@ static int dgnc_tty_write_room(struct tty_struct *tty)
DPR_WRITE(("dgnc_tty_write_room - %d tail: %d head: %d\n", ret, tail, head));
return(ret);
return ret;
}
......@@ -2037,18 +2037,18 @@ static int dgnc_tty_write(struct tty_struct *tty,
int from_user = 0;
if (tty == NULL || dgnc_TmpWriteBuf == NULL)
return(0);
return 0;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return(0);
return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return(0);
return 0;
if (!count)
return(0);
return 0;
DPR_WRITE(("dgnc_tty_write: Port: %x tty=%p user=%d len=%d\n",
ch->ch_portnum, tty, from_user, count));
......@@ -2090,7 +2090,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
*/
if (count <= 0) {
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
return 0;
}
/*
......@@ -2120,7 +2120,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
*/
if (count <= 0) {
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
return 0;
}
if (from_user) {
......@@ -2136,7 +2136,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
*/
/* we're allowed to block if it's from_user */
if (down_interruptible(&dgnc_TmpWriteSem)) {
return (-EINTR);
return -EINTR;
}
/*
......@@ -2147,7 +2147,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
if (!count) {
up(&dgnc_TmpWriteSem);
return(-EFAULT);
return -EFAULT;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -2229,7 +2229,7 @@ static int dgnc_tty_write(struct tty_struct *tty,
ch->ch_bd->bd_ops->copy_data_from_queue_to_uart(ch);
}
return (count);
return count;
}
......@@ -2349,7 +2349,7 @@ static int dgnc_tty_tiocmset(struct tty_struct *tty, struct file *file,
DPR_IOCTL(("dgnc_tty_tiocmset finish\n"));
return (0);
return 0;
}
......@@ -2402,7 +2402,7 @@ static int dgnc_tty_send_break(struct tty_struct *tty, int msec)
DPR_IOCTL(("dgnc_tty_send_break finish\n"));
return (0);
return 0;
}
......@@ -2497,7 +2497,7 @@ static inline int dgnc_get_mstat(struct channel_t *ch)
DPR_IOCTL(("dgnc_getmstat start\n"));
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return(-ENXIO);
return -ENXIO;
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -2522,7 +2522,7 @@ static inline int dgnc_get_mstat(struct channel_t *ch)
DPR_IOCTL(("dgnc_getmstat finish\n"));
return(result);
return result;
}
......@@ -2538,17 +2538,17 @@ static int dgnc_get_modem_info(struct channel_t *ch, unsigned int __user *value
DPR_IOCTL(("dgnc_get_modem_info start\n"));
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return(-ENXIO);
return -ENXIO;
result = dgnc_get_mstat(ch);
if (result < 0)
return (-ENXIO);
return -ENXIO;
rc = put_user(result, value);
DPR_IOCTL(("dgnc_get_modem_info finish\n"));
return(rc);
return rc;
}
......@@ -2587,7 +2587,7 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns
ret = get_user(arg, value);
if (ret)
return(ret);
return ret;
switch (command) {
case TIOCMBIS:
......@@ -2631,7 +2631,7 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns
break;
default:
return(-EINVAL);
return -EINVAL;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -2642,7 +2642,7 @@ static int dgnc_set_modem_info(struct tty_struct *tty, unsigned int command, uns
DPR_IOCTL(("dgnc_set_modem_info finish\n"));
return (0);
return 0;
}
......@@ -2662,18 +2662,18 @@ static int dgnc_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retin
ulong lock_flags;
if (!retinfo)
return (-EFAULT);
return -EFAULT;
if (!tty || tty->magic != TTY_MAGIC)
return (-EFAULT);
return -EFAULT;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (-EFAULT);
return -EFAULT;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (-EFAULT);
return -EFAULT;
memset(&tmp, 0, sizeof(tmp));
......@@ -2682,9 +2682,9 @@ static int dgnc_tty_digigeta(struct tty_struct *tty, struct digi_t __user *retin
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
return (-EFAULT);
return -EFAULT;
return (0);
return 0;
}
......@@ -2707,23 +2707,23 @@ static int dgnc_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_i
DPR_IOCTL(("DIGI_SETA start\n"));
if (!tty || tty->magic != TTY_MAGIC)
return (-EFAULT);
return -EFAULT;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (-EFAULT);
return -EFAULT;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (-EFAULT);
return -EFAULT;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (-EFAULT);
return -EFAULT;
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);
......@@ -2773,7 +2773,7 @@ static int dgnc_tty_digiseta(struct tty_struct *tty, struct digi_t __user *new_i
DPR_IOCTL(("DIGI_SETA finish\n"));
return(0);
return 0;
}
......@@ -3064,19 +3064,19 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
void __user *uarg = (void __user *) arg;
if (!tty || tty->magic != TTY_MAGIC)
return (-ENODEV);
return -ENODEV;
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
return (-ENODEV);
return -ENODEV;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return (-ENODEV);
return -ENODEV;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return (-ENODEV);
return -ENODEV;
DPR_IOCTL(("dgnc_tty_ioctl start on port %d - cmd %s (%x), arg %lx\n",
ch->ch_portnum, dgnc_ioctl_name(cmd), cmd, arg));
......@@ -3086,7 +3086,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
if (un->un_open_count <= 0) {
DPR_BASIC(("dgnc_tty_ioctl - unit not open.\n"));
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(-EIO);
return -EIO;
}
switch (cmd) {
......@@ -3105,14 +3105,14 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
rc = tty_check_change(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (rc) {
return(rc);
return rc;
}
rc = ch->ch_bd->bd_ops->drain(tty, 0);
if (rc) {
DPR_IOCTL(("dgnc_tty_ioctl - bad return: %d ", rc));
return(-EINTR);
return -EINTR;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -3126,7 +3126,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DPR_IOCTL(("dgnc_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
ch->ch_portnum, dgnc_ioctl_name(cmd), cmd, arg));
return(0);
return 0;
case TCSBRKP:
......@@ -3138,13 +3138,13 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
rc = tty_check_change(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (rc) {
return(rc);
return rc;
}
rc = ch->ch_bd->bd_ops->drain(tty, 0);
if (rc) {
DPR_IOCTL(("dgnc_tty_ioctl - bad return: %d ", rc));
return(-EINTR);
return -EINTR;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -3156,19 +3156,19 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DPR_IOCTL(("dgnc_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
ch->ch_portnum, dgnc_ioctl_name(cmd), cmd, arg));
return(0);
return 0;
case TIOCSBRK:
rc = tty_check_change(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (rc) {
return(rc);
return rc;
}
rc = ch->ch_bd->bd_ops->drain(tty, 0);
if (rc) {
DPR_IOCTL(("dgnc_tty_ioctl - bad return: %d ", rc));
return(-EINTR);
return -EINTR;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -3180,7 +3180,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DPR_IOCTL(("dgnc_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
ch->ch_portnum, dgnc_ioctl_name(cmd), cmd, arg));
return(0);
return 0;
case TIOCCBRK:
/* Do Nothing */
......@@ -3192,31 +3192,31 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) arg);
return(rc);
return rc;
case TIOCSSOFTCAR:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = get_user(arg, (unsigned long __user *) arg);
if (rc)
return(rc);
return rc;
DGNC_LOCK(ch->ch_lock, lock_flags);
tty->termios.c_cflag = ((tty->termios.c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0));
ch->ch_bd->bd_ops->param(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
return 0;
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:
case TIOCMSET:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(dgnc_set_modem_info(tty, cmd, uarg));
return dgnc_set_modem_info(tty, cmd, uarg);
/*
* Here are any additional ioctl's that we want to implement
......@@ -3235,7 +3235,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
rc = tty_check_change(tty);
if (rc) {
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(rc);
return rc;
}
if ((arg == TCIFLUSH) || (arg == TCIOFLUSH)) {
......@@ -3265,7 +3265,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
/* pretend we didn't recognize this IOCTL */
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(-ENOIOCTLCMD);
return -ENOIOCTLCMD;
case TCSETSF:
case TCSETSW:
/*
......@@ -3291,14 +3291,14 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
rc = ch->ch_bd->bd_ops->drain(tty, 0);
if (rc) {
DPR_IOCTL(("dgnc_tty_ioctl - bad return: %d\n", rc));
return(-EINTR);
return -EINTR;
}
DPR_IOCTL(("dgnc_tty_ioctl finish on port %d - cmd %s (%x), arg %lx\n",
ch->ch_portnum, dgnc_ioctl_name(cmd), cmd, arg));
/* pretend we didn't recognize this */
return(-ENOIOCTLCMD);
return -ENOIOCTLCMD;
case TCSETAW:
......@@ -3306,21 +3306,21 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
rc = ch->ch_bd->bd_ops->drain(tty, 0);
if (rc) {
DPR_IOCTL(("dgnc_tty_ioctl - bad return: %d ", rc));
return(-EINTR);
return -EINTR;
}
/* pretend we didn't recognize this */
return(-ENOIOCTLCMD);
return -ENOIOCTLCMD;
case TCXONC:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
/* Make the ld do it */
return(-ENOIOCTLCMD);
return -ENOIOCTLCMD;
case DIGI_GETA:
/* get information for ditty */
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(dgnc_tty_digigeta(tty, uarg));
return dgnc_tty_digigeta(tty, uarg);
case DIGI_SETAW:
case DIGI_SETAF:
......@@ -3332,7 +3332,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
rc = ch->ch_bd->bd_ops->drain(tty, 0);
if (rc) {
DPR_IOCTL(("dgnc_tty_ioctl - bad return: %d ", rc));
return(-EINTR);
return -EINTR;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
}
......@@ -3343,7 +3343,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
case DIGI_SETA:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(dgnc_tty_digiseta(tty, uarg));
return dgnc_tty_digiseta(tty, uarg);
case DIGI_LOOPBACK:
{
......@@ -3352,7 +3352,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = get_user(loopback, (unsigned int __user *) arg);
if (rc)
return(rc);
return rc;
DGNC_LOCK(ch->ch_lock, lock_flags);
/* Enable/disable internal loopback for this port */
......@@ -3363,13 +3363,13 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
ch->ch_bd->bd_ops->param(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
return 0;
}
case DIGI_GETCUSTOMBAUD:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = put_user(ch->ch_custom_speed, (unsigned int __user *) arg);
return(rc);
return rc;
case DIGI_SETCUSTOMBAUD:
{
......@@ -3378,12 +3378,12 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = get_user(new_rate, (unsigned int __user *) arg);
if (rc)
return(rc);
return rc;
DGNC_LOCK(ch->ch_lock, lock_flags);
dgnc_set_custom_speed(ch, new_rate);
ch->ch_bd->bd_ops->param(tty);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
return 0;
}
/*
......@@ -3399,11 +3399,11 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = get_user(c, (unsigned char __user *) arg);
if (rc)
return(rc);
return rc;
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_bd->bd_ops->send_immediate_char(ch, c);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
return(0);
return 0;
}
/*
......@@ -3427,9 +3427,9 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (copy_to_user(uarg, &buf, sizeof(struct digi_getcounter))) {
return (-EFAULT);
return -EFAULT;
}
return(0);
return 0;
}
/*
......@@ -3454,7 +3454,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
rc = put_user(events, (unsigned int __user *) arg);
return(rc);
return rc;
}
/*
......@@ -3475,7 +3475,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
* Get data from user first.
*/
if (copy_from_user(&buf, uarg, sizeof(struct digi_getbuffer))) {
return (-EFAULT);
return -EFAULT;
}
DGNC_LOCK(ch->ch_lock, lock_flags);
......@@ -3521,9 +3521,9 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DGNC_UNLOCK(ch->ch_lock, lock_flags);
if (copy_to_user(uarg, &buf, sizeof(struct digi_getbuffer))) {
return (-EFAULT);
return -EFAULT;
}
return(0);
return 0;
}
default:
DGNC_UNLOCK(ch->ch_lock, lock_flags);
......@@ -3532,7 +3532,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DPR_IOCTL(("dgnc_tty_ioctl end - cmd %s (%x), arg %lx\n",
dgnc_ioctl_name(cmd), cmd, arg));
return(-ENOIOCTLCMD);
return -ENOIOCTLCMD;
}
DGNC_UNLOCK(ch->ch_lock, lock_flags);
......@@ -3540,5 +3540,5 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
DPR_IOCTL(("dgnc_tty_ioctl end - cmd %s (%x), arg %lx\n",
dgnc_ioctl_name(cmd), cmd, arg));
return(0);
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment