Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43686
b: refs/heads/master
c: 96b066b
h: refs/heads/master
v: v3
  • Loading branch information
Jiri Slaby authored and Linus Torvalds committed Dec 8, 2006
1 parent 6d2b904 commit 7e4fde8
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 132 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40e82652128f67ffc2d8117e186736a92a15d64c
refs/heads/master: 96b066b85c8e5b28fa7f25a7f0644f70f46b8881
222 changes: 91 additions & 131 deletions trunk/drivers/char/stallion.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,51 +450,11 @@ static unsigned int stl_baudrates[] = {
* Declare all those functions in this driver!
*/

static void stl_argbrds(void);
static int stl_parsebrd(struct stlconf *confp, char **argp);

static unsigned long stl_atol(char *str);

static int stl_open(struct tty_struct *tty, struct file *filp);
static void stl_close(struct tty_struct *tty, struct file *filp);
static int stl_write(struct tty_struct *tty, const unsigned char *buf, int count);
static void stl_putchar(struct tty_struct *tty, unsigned char ch);
static void stl_flushchars(struct tty_struct *tty);
static int stl_writeroom(struct tty_struct *tty);
static int stl_charsinbuffer(struct tty_struct *tty);
static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg);
static void stl_settermios(struct tty_struct *tty, struct termios *old);
static void stl_throttle(struct tty_struct *tty);
static void stl_unthrottle(struct tty_struct *tty);
static void stl_stop(struct tty_struct *tty);
static void stl_start(struct tty_struct *tty);
static void stl_flushbuffer(struct tty_struct *tty);
static void stl_breakctl(struct tty_struct *tty, int state);
static void stl_waituntilsent(struct tty_struct *tty, int timeout);
static void stl_sendxchar(struct tty_struct *tty, char ch);
static void stl_hangup(struct tty_struct *tty);
static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg);
static int stl_portinfo(struct stlport *portp, int portnr, char *pos);
static int stl_readproc(char *page, char **start, off_t off, int count, int *eof, void *data);

static int stl_brdinit(struct stlbrd *brdp);
static int stl_initports(struct stlbrd *brdp, struct stlpanel *panelp);
static int stl_getserial(struct stlport *portp, struct serial_struct __user *sp);
static int stl_setserial(struct stlport *portp, struct serial_struct __user *sp);
static int stl_getbrdstats(combrd_t __user *bp);
static int stl_getportstats(struct stlport *portp, comstats_t __user *cp);
static int stl_clrportstats(struct stlport *portp, comstats_t __user *cp);
static int stl_getportstruct(struct stlport __user *arg);
static int stl_getbrdstruct(struct stlbrd __user *arg);
static int stl_waitcarrier(struct stlport *portp, struct file *filp);
static int stl_eiointr(struct stlbrd *brdp);
static int stl_echatintr(struct stlbrd *brdp);
static int stl_echmcaintr(struct stlbrd *brdp);
static int stl_echpciintr(struct stlbrd *brdp);
static int stl_echpci64intr(struct stlbrd *brdp);
static void stl_offintr(struct work_struct *);
static struct stlbrd *stl_allocbrd(void);
static struct stlport *stl_getport(int brdnr, int panelnr, int portnr);

/*
* CD1400 uart specific handling functions.
Expand Down Expand Up @@ -700,31 +660,6 @@ static struct class *stallion_class;
* Check for any arguments passed in on the module load command line.
*/

static void __init stl_argbrds(void)
{
struct stlconf conf;
struct stlbrd *brdp;
int i;

pr_debug("stl_argbrds()\n");

for (i = stl_nrbrds; (i < stl_nargs); i++) {
memset(&conf, 0, sizeof(conf));
if (stl_parsebrd(&conf, stl_brdsp[i]) == 0)
continue;
if ((brdp = stl_allocbrd()) == NULL)
continue;
stl_nrbrds = i + 1;
brdp->brdnr = i;
brdp->brdtype = conf.brdtype;
brdp->ioaddr1 = conf.ioaddr1;
brdp->ioaddr2 = conf.ioaddr2;
brdp->irq = conf.irq;
brdp->irqtype = conf.irqtype;
stl_brdinit(brdp);
}
}

/*****************************************************************************/

/*
Expand Down Expand Up @@ -826,6 +761,31 @@ static struct stlbrd *stl_allocbrd(void)
return brdp;
}

static void __init stl_argbrds(void)
{
struct stlconf conf;
struct stlbrd *brdp;
int i;

pr_debug("stl_argbrds()\n");

for (i = stl_nrbrds; (i < stl_nargs); i++) {
memset(&conf, 0, sizeof(conf));
if (stl_parsebrd(&conf, stl_brdsp[i]) == 0)
continue;
if ((brdp = stl_allocbrd()) == NULL)
continue;
stl_nrbrds = i + 1;
brdp->brdnr = i;
brdp->brdtype = conf.brdtype;
brdp->ioaddr1 = conf.ioaddr1;
brdp->ioaddr2 = conf.ioaddr2;
brdp->irq = conf.irq;
brdp->irqtype = conf.irqtype;
stl_brdinit(brdp);
}
}

/*****************************************************************************/

static int stl_open(struct tty_struct *tty, struct file *filp)
Expand Down Expand Up @@ -972,6 +932,52 @@ static int stl_waitcarrier(struct stlport *portp, struct file *filp)

/*****************************************************************************/

static void stl_flushbuffer(struct tty_struct *tty)
{
struct stlport *portp;

pr_debug("stl_flushbuffer(tty=%p)\n", tty);

if (tty == NULL)
return;
portp = tty->driver_data;
if (portp == NULL)
return;

stl_flush(portp);
tty_wakeup(tty);
}

/*****************************************************************************/

static void stl_waituntilsent(struct tty_struct *tty, int timeout)
{
struct stlport *portp;
unsigned long tend;

pr_debug("stl_waituntilsent(tty=%p,timeout=%d)\n", tty, timeout);

if (tty == NULL)
return;
portp = tty->driver_data;
if (portp == NULL)
return;

if (timeout == 0)
timeout = HZ;
tend = jiffies + timeout;

while (stl_datastate(portp)) {
if (signal_pending(current))
break;
msleep_interruptible(20);
if (time_after_eq(jiffies, tend))
break;
}
}

/*****************************************************************************/

static void stl_close(struct tty_struct *tty, struct file *filp)
{
struct stlport *portp;
Expand Down Expand Up @@ -1401,6 +1407,26 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd

/*****************************************************************************/

/*
* Start the transmitter again. Just turn TX interrupts back on.
*/

static void stl_start(struct tty_struct *tty)
{
struct stlport *portp;

pr_debug("stl_start(tty=%p)\n", tty);

if (tty == NULL)
return;
portp = tty->driver_data;
if (portp == NULL)
return;
stl_startrxtx(portp, -1, 1);
}

/*****************************************************************************/

static void stl_settermios(struct tty_struct *tty, struct termios *old)
{
struct stlport *portp;
Expand Down Expand Up @@ -1494,26 +1520,6 @@ static void stl_stop(struct tty_struct *tty)

/*****************************************************************************/

/*
* Start the transmitter again. Just turn TX interrupts back on.
*/

static void stl_start(struct tty_struct *tty)
{
struct stlport *portp;

pr_debug("stl_start(tty=%p)\n", tty);

if (tty == NULL)
return;
portp = tty->driver_data;
if (portp == NULL)
return;
stl_startrxtx(portp, -1, 1);
}

/*****************************************************************************/

/*
* Hangup this port. This is pretty much like closing the port, only
* a little more brutal. No waiting for data to drain. Shutdown the
Expand Down Expand Up @@ -1554,24 +1560,6 @@ static void stl_hangup(struct tty_struct *tty)

/*****************************************************************************/

static void stl_flushbuffer(struct tty_struct *tty)
{
struct stlport *portp;

pr_debug("stl_flushbuffer(tty=%p)\n", tty);

if (tty == NULL)
return;
portp = tty->driver_data;
if (portp == NULL)
return;

stl_flush(portp);
tty_wakeup(tty);
}

/*****************************************************************************/

static void stl_breakctl(struct tty_struct *tty, int state)
{
struct stlport *portp;
Expand All @@ -1589,34 +1577,6 @@ static void stl_breakctl(struct tty_struct *tty, int state)

/*****************************************************************************/

static void stl_waituntilsent(struct tty_struct *tty, int timeout)
{
struct stlport *portp;
unsigned long tend;

pr_debug("stl_waituntilsent(tty=%p,timeout=%d)\n", tty, timeout);

if (tty == NULL)
return;
portp = tty->driver_data;
if (portp == NULL)
return;

if (timeout == 0)
timeout = HZ;
tend = jiffies + timeout;

while (stl_datastate(portp)) {
if (signal_pending(current))
break;
msleep_interruptible(20);
if (time_after_eq(jiffies, tend))
break;
}
}

/*****************************************************************************/

static void stl_sendxchar(struct tty_struct *tty, char ch)
{
struct stlport *portp;
Expand Down

0 comments on commit 7e4fde8

Please sign in to comment.