#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
+#include <linux/wait.h>
#include <asm/io.h>
#include <asm/uaccess.h>
/*{ BRD_ECP, 0x2a0, 0, 0xcc000, 0, 0 },*/
};
-static int stli_nrbrds = sizeof(stli_brdconf) / sizeof(stlconf_t);
+static int stli_nrbrds = ARRAY_SIZE(stli_brdconf);
/*
* There is some experimental EISA board detection code in this driver.
0xff000000, 0xff010000, 0xff020000, 0xff030000,
};
-static int stli_eisamempsize = sizeof(stli_eisamemprobeaddrs) / sizeof(unsigned long);
-int stli_eisaprobe = STLI_EISAPROBE;
+static int stli_eisamempsize = ARRAY_SIZE(stli_eisamemprobeaddrs);
/*
* Define the Stallion PCI vendor and device IDs.
int stli_init(void);
static int stli_open(struct tty_struct *tty, struct file *filp);
static void stli_close(struct tty_struct *tty, struct file *filp);
-static int stli_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count);
+static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count);
static void stli_putchar(struct tty_struct *tty, unsigned char ch);
static void stli_flushchars(struct tty_struct *tty);
static int stli_writeroom(struct tty_struct *tty);
static int stli_brdinit(stlibrd_t *brdp);
static int stli_startbrd(stlibrd_t *brdp);
-static ssize_t stli_memread(struct file *fp, char *buf, size_t count, loff_t *offp);
-static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, loff_t *offp);
+static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp);
+static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp);
static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg);
static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp);
static void stli_poll(unsigned long arg);
static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, int wait);
static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *filp);
static void stli_dohangup(void *arg);
-static void stli_delay(int len);
static int stli_setport(stliport_t *portp);
static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);
static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, void *arg, int size, int copyback);
static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts);
static long stli_mktiocm(unsigned long sigvalue);
static void stli_read(stlibrd_t *brdp, stliport_t *portp);
-static int stli_getserial(stliport_t *portp, struct serial_struct *sp);
-static int stli_setserial(stliport_t *portp, struct serial_struct *sp);
-static int stli_getbrdstats(combrd_t *bp);
-static int stli_getportstats(stliport_t *portp, comstats_t *cp);
+static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp);
+static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp);
+static int stli_getbrdstats(combrd_t __user *bp);
+static int stli_getportstats(stliport_t *portp, comstats_t __user *cp);
static int stli_portcmdstats(stliport_t *portp);
-static int stli_clrportstats(stliport_t *portp, comstats_t *cp);
-static int stli_getportstruct(unsigned long arg);
-static int stli_getbrdstruct(unsigned long arg);
+static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp);
+static int stli_getportstruct(stliport_t __user *arg);
+static int stli_getbrdstruct(stlibrd_t __user *arg);
static void *stli_memalloc(int len);
static stlibrd_t *stli_allocbrd(void);
static stliport_t *stli_getport(int brdnr, int panelnr, int portnr);
-static inline int stli_initbrds(void);
-static inline int stli_initecp(stlibrd_t *brdp);
-static inline int stli_initonb(stlibrd_t *brdp);
-static inline int stli_findeisabrds(void);
-static inline int stli_eisamemprobe(stlibrd_t *brdp);
-static inline int stli_initports(stlibrd_t *brdp);
-static inline int stli_getbrdnr(void);
+static int stli_initecp(stlibrd_t *brdp);
+static int stli_initonb(stlibrd_t *brdp);
+static int stli_eisamemprobe(stlibrd_t *brdp);
+static int stli_initports(stlibrd_t *brdp);
#ifdef CONFIG_PCI
-static inline int stli_findpcibrds(void);
-static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp);
+static int stli_initpcibrd(int brdtype, struct pci_dev *devp);
#endif
/*****************************************************************************/
* much cheaper on host cpu than using interrupts. It turns out to
* not increase character latency by much either...
*/
-static struct timer_list stli_timerlist = TIMER_INITIALIZER(stli_poll, 0, 0);
+static DEFINE_TIMER(stli_timerlist, stli_poll, 0, 0);
static int stli_timeron;
/*****************************************************************************/
-static struct class_simple *istallion_class;
+static struct class *istallion_class;
#ifdef MODULE
{
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk("init_module()\n");
#endif
unsigned long flags;
int i, j;
-#if DEBUG
+#ifdef DEBUG
printk("cleanup_module()\n");
#endif
put_tty_driver(stli_serial);
for (i = 0; i < 4; i++) {
devfs_remove("staliomem/%d", i);
- class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i));
+ class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i));
}
devfs_remove("staliomem");
- class_simple_destroy(istallion_class);
+ class_destroy(istallion_class);
if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i);
- if (stli_tmpwritebuf != (char *) NULL)
- kfree(stli_tmpwritebuf);
- if (stli_txcookbuf != (char *) NULL)
- kfree(stli_txcookbuf);
+
+ kfree(stli_tmpwritebuf);
+ kfree(stli_txcookbuf);
for (i = 0; (i < stli_nrbrds); i++) {
if ((brdp = stli_brds[i]) == (stlibrd_t *) NULL)
* Check for any arguments passed in on the module load command line.
*/
-static void stli_argbrds()
+static void stli_argbrds(void)
{
stlconf_t conf;
stlibrd_t *brdp;
- int nrargs, i;
+ int i;
-#if DEBUG
+#ifdef DEBUG
printk("stli_argbrds()\n");
#endif
- nrargs = sizeof(stli_brdsp) / sizeof(char **);
-
- for (i = stli_nrbrds; (i < nrargs); i++) {
+ for (i = stli_nrbrds; i < ARRAY_SIZE(stli_brdsp); i++) {
memset(&conf, 0, sizeof(conf));
if (stli_parsebrd(&conf, stli_brdsp[i]) == 0)
continue;
static int stli_parsebrd(stlconf_t *confp, char **argp)
{
char *sp;
- int nrbrdnames, i;
+ int i;
-#if DEBUG
+#ifdef DEBUG
printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
#endif
for (sp = argp[0], i = 0; ((*sp != 0) && (i < 25)); sp++, i++)
*sp = TOLOWER(*sp);
- nrbrdnames = sizeof(stli_brdstr) / sizeof(stlibrdtype_t);
- for (i = 0; (i < nrbrdnames); i++) {
+ for (i = 0; i < ARRAY_SIZE(stli_brdstr); i++) {
if (strcmp(stli_brdstr[i].name, argp[0]) == 0)
break;
}
- if (i >= nrbrdnames) {
+ if (i == ARRAY_SIZE(stli_brdstr)) {
printk("STALLION: unknown board name, %s?\n", argp[0]);
- return(0);
+ return 0;
}
confp->brdtype = stli_brdstr[i].type;
unsigned int minordev;
int brdnr, portnr, rc;
-#if DEBUG
+#ifdef DEBUG
printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty,
(int) filp, tty->name);
#endif
tty->driver_data = portp;
portp->refcount++;
- while (test_bit(ST_INITIALIZING, &portp->state)) {
- if (signal_pending(current))
- return(-ERESTARTSYS);
- interruptible_sleep_on(&portp->raw_wait);
- }
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_INITIALIZING, &portp->state));
+ if (signal_pending(current))
+ return(-ERESTARTSYS);
if ((portp->flags & ASYNC_INITIALIZED) == 0) {
set_bit(ST_INITIALIZING, &portp->state);
stliport_t *portp;
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp);
#endif
if (portp->openwaitcnt) {
if (portp->close_delay)
- stli_delay(portp->close_delay);
+ msleep_interruptible(jiffies_to_msecs(portp->close_delay));
wake_up_interruptible(&portp->open_wait);
}
asyport_t aport;
int rc;
-#if DEBUG
+#ifdef DEBUG
printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp);
#endif
unsigned long flags;
int rc;
-#if DEBUG
+#ifdef DEBUG
printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n",
(int) brdp, (int) portp, (int) arg, wait);
#endif
* order of opens and closes may not be preserved across shared
* memory, so we must wait until it is complete.
*/
- while (test_bit(ST_CLOSING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CLOSING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
/*
*/
rc = 0;
set_bit(ST_OPENING, &portp->state);
- while (test_bit(ST_OPENING, &portp->state)) {
- if (signal_pending(current)) {
- rc = -ERESTARTSYS;
- break;
- }
- interruptible_sleep_on(&portp->raw_wait);
- }
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_OPENING, &portp->state));
+ if (signal_pending(current))
+ rc = -ERESTARTSYS;
restore_flags(flags);
if ((rc == 0) && (portp->rc != 0))
unsigned long flags;
int rc;
-#if DEBUG
+#ifdef DEBUG
printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n",
(int) brdp, (int) portp, (int) arg, wait);
#endif
* occurs on this port.
*/
if (wait) {
- while (test_bit(ST_CLOSING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CLOSING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
}
* to come back.
*/
rc = 0;
- while (test_bit(ST_CLOSING, &portp->state)) {
- if (signal_pending(current)) {
- rc = -ERESTARTSYS;
- break;
- }
- interruptible_sleep_on(&portp->raw_wait);
- }
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CLOSING, &portp->state));
+ if (signal_pending(current))
+ rc = -ERESTARTSYS;
restore_flags(flags);
if ((rc == 0) && (portp->rc != 0))
{
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"
"copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,
(int) arg, size, copyback);
save_flags(flags);
cli();
- while (test_bit(ST_CMDING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CMDING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
stli_sendcmd(brdp, portp, cmd, arg, size, copyback);
- while (test_bit(ST_CMDING, &portp->state)) {
- if (signal_pending(current)) {
- restore_flags(flags);
- return(-ERESTARTSYS);
- }
- interruptible_sleep_on(&portp->raw_wait);
+ wait_event_interruptible(portp->raw_wait,
+ !test_bit(ST_CMDING, &portp->state));
+ if (signal_pending(current)) {
+ restore_flags(flags);
+ return -ERESTARTSYS;
}
restore_flags(flags);
stlibrd_t *brdp;
asyport_t aport;
-#if DEBUG
+#ifdef DEBUG
printk("stli_setport(portp=%x)\n", (int) portp);
#endif
/*****************************************************************************/
-/*
- * Wait for a specified delay period, this is not a busy-loop. It will
- * give up the processor while waiting. Unfortunately this has some
- * rather intimate knowledge of the process management stuff.
- */
-
-static void stli_delay(int len)
-{
-#if DEBUG
- printk("stli_delay(len=%d)\n", len);
-#endif
- if (len > 0) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(len);
- }
-}
-
-/*****************************************************************************/
-
/*
* Possibly need to wait for carrier (DCD signal) to come high. Say
* maybe because if we are clocal then we don't need to wait...
unsigned long flags;
int rc, doclocal;
-#if DEBUG
+#ifdef DEBUG
printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n",
(int) brdp, (int) portp, (int) filp);
#endif
* service bits for this port.
*/
-static int stli_write(struct tty_struct *tty, int from_user, const unsigned char *buf, int count)
+static int stli_write(struct tty_struct *tty, const unsigned char *buf, int count)
{
volatile cdkasy_t *ap;
volatile cdkhdr_t *hdrp;
unsigned int len, stlen, head, tail, size;
unsigned long flags;
-#if DEBUG
- printk("stli_write(tty=%x,from_user=%d,buf=%x,count=%d)\n",
- (int) tty, from_user, (int) buf, count);
+#ifdef DEBUG
+ printk("stli_write(tty=%x,buf=%x,count=%d)\n",
+ (int) tty, (int) buf, count);
#endif
if ((tty == (struct tty_struct *) NULL) ||
return(0);
chbuf = (unsigned char *) buf;
-/*
- * If copying direct from user space we need to be able to handle page
- * faults while we are copying. To do this copy as much as we can now
- * into a kernel buffer. From there we copy it into shared memory. The
- * big problem is that we do not want shared memory enabled when we are
- * sleeping (other boards may be serviced while asleep). Something else
- * to note here is the reading of the tail twice. Since the boards
- * shared memory can be on an 8-bit bus then we need to be very careful
- * reading 16 bit quantities - since both the board (slave) and host
- * could be writing and reading at the same time.
- */
- if (from_user) {
- save_flags(flags);
- cli();
- EBRDENABLE(brdp);
- ap = (volatile cdkasy_t *) EBRDGETMEMPTR(brdp, portp->addr);
- head = (unsigned int) ap->txq.head;
- tail = (unsigned int) ap->txq.tail;
- if (tail != ((unsigned int) ap->txq.tail))
- tail = (unsigned int) ap->txq.tail;
- len = (head >= tail) ? (portp->txsize - (head - tail) - 1) :
- (tail - head - 1);
- count = MIN(len, count);
- EBRDDISABLE(brdp);
- restore_flags(flags);
-
- down(&stli_tmpwritesem);
- if (copy_from_user(stli_tmpwritebuf, chbuf, count))
- return -EFAULT;
- chbuf = &stli_tmpwritebuf[0];
- }
-
/*
* All data is now local, shove as much as possible into shared memory.
*/
set_bit(ST_TXBUSY, &portp->state);
EBRDDISABLE(brdp);
- if (from_user)
- up(&stli_tmpwritesem);
restore_flags(flags);
return(count);
static void stli_putchar(struct tty_struct *tty, unsigned char ch)
{
-#if DEBUG
+#ifdef DEBUG
printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch);
#endif
unsigned char *buf, *shbuf;
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk("stli_flushchars(tty=%x)\n", (int) tty);
#endif
unsigned int head, tail, len;
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk("stli_writeroom(tty=%x)\n", (int) tty);
#endif
unsigned int head, tail, len;
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk("stli_charsinbuffer(tty=%x)\n", (int) tty);
#endif
* Generate the serial struct info.
*/
-static int stli_getserial(stliport_t *portp, struct serial_struct *sp)
+static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp)
{
struct serial_struct sio;
stlibrd_t *brdp;
-#if DEBUG
+#ifdef DEBUG
printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
#endif
* just quietly ignore any requests to change irq, etc.
*/
-static int stli_setserial(stliport_t *portp, struct serial_struct *sp)
+static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp)
{
struct serial_struct sio;
int rc;
-#if DEBUG
- printk("stli_setserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
+#ifdef DEBUG
+ printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp);
#endif
if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
stlibrd_t *brdp;
unsigned int ival;
int rc;
+ void __user *argp = (void __user *)arg;
-#if DEBUG
+#ifdef DEBUG
printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n",
(int) tty, (int) file, cmd, (int) arg);
#endif
switch (cmd) {
case TIOCGSOFTCAR:
rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
- (unsigned int *) arg);
+ (unsigned __user *) arg);
break;
case TIOCSSOFTCAR:
- if ((rc = get_user(ival, (unsigned int *) arg)) == 0)
+ if ((rc = get_user(ival, (unsigned __user *) arg)) == 0)
tty->termios->c_cflag =
(tty->termios->c_cflag & ~CLOCAL) |
(ival ? CLOCAL : 0);
break;
case TIOCGSERIAL:
- if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
- sizeof(struct serial_struct))) == 0)
- rc = stli_getserial(portp, (struct serial_struct *) arg);
+ rc = stli_getserial(portp, argp);
break;
case TIOCSSERIAL:
- if ((rc = verify_area(VERIFY_READ, (void *) arg,
- sizeof(struct serial_struct))) == 0)
- rc = stli_setserial(portp, (struct serial_struct *)arg);
+ rc = stli_setserial(portp, argp);
break;
case STL_GETPFLAG:
- rc = put_user(portp->pflag, (unsigned int *) arg);
+ rc = put_user(portp->pflag, (unsigned __user *)argp);
break;
case STL_SETPFLAG:
- if ((rc = get_user(portp->pflag, (unsigned int *) arg)) == 0)
+ if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0)
stli_setport(portp);
break;
case COM_GETPORTSTATS:
- if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
- sizeof(comstats_t))) == 0)
- rc = stli_getportstats(portp, (comstats_t *) arg);
+ rc = stli_getportstats(portp, argp);
break;
case COM_CLRPORTSTATS:
- if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
- sizeof(comstats_t))) == 0)
- rc = stli_clrportstats(portp, (comstats_t *) arg);
+ rc = stli_clrportstats(portp, argp);
break;
case TIOCSERCONFIG:
case TIOCSERGWILD:
struct termios *tiosp;
asyport_t aport;
-#if DEBUG
+#ifdef DEBUG
printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old);
#endif
{
stliport_t *portp;
-#if DEBUG
+#ifdef DEBUG
printk("stli_throttle(tty=%x)\n", (int) tty);
#endif
{
stliport_t *portp;
-#if DEBUG
+#ifdef DEBUG
printk("stli_unthrottle(tty=%x)\n", (int) tty);
#endif
stliport_t *portp;
asyctrl_t actrl;
-#if DEBUG
+#ifdef DEBUG
printk("stli_stop(tty=%x)\n", (int) tty);
#endif
stlibrd_t *brdp;
asyctrl_t actrl;
-#if DEBUG
+#ifdef DEBUG
printk("stli_start(tty=%x)\n", (int) tty);
#endif
{
stliport_t *portp;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg);
#endif
stlibrd_t *brdp;
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty);
#endif
stlibrd_t *brdp;
unsigned long ftype, flags;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty);
#endif
long arg;
/* long savestate, savetime; */
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state);
#endif
stliport_t *portp;
unsigned long tend;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout);
#endif
while (test_bit(ST_TXBUSY, &portp->state)) {
if (signal_pending(current))
break;
- stli_delay(2);
+ msleep_interruptible(20);
if (time_after_eq(jiffies, tend))
break;
}
stliport_t *portp;
asyctrl_t actrl;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch);
#endif
int curoff, maxoff;
char *pos;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x,"
"data=%x\n", (int) page, (int) start, (int) off, count,
(int) eof, (int) data);
volatile unsigned char *bits;
unsigned long flags;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"
"copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,
(int) arg, size, copyback);
* more chars to unload.
*/
-static inline void stli_read(stlibrd_t *brdp, stliport_t *portp)
+static void stli_read(stlibrd_t *brdp, stliport_t *portp)
{
volatile cdkasyrq_t *rp;
volatile char *shbuf;
unsigned int head, tail, size;
unsigned int len, stlen;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n",
(int) brdp, (int) portp);
#endif
stlen = size - tail;
}
- len = MIN(len, (TTY_FLIPBUF_SIZE - tty->flip.count));
+ len = tty_buffer_request_room(tty, len);
+ /* FIXME : iomap ? */
shbuf = (volatile char *) EBRDGETMEMPTR(brdp, portp->rxoffset);
while (len > 0) {
stlen = MIN(len, stlen);
- memcpy(tty->flip.char_buf_ptr, (char *) (shbuf + tail), stlen);
- memset(tty->flip.flag_buf_ptr, 0, stlen);
- tty->flip.char_buf_ptr += stlen;
- tty->flip.flag_buf_ptr += stlen;
- tty->flip.count += stlen;
-
+ tty_insert_flip_string(tty, (char *)(shbuf + tail), stlen);
len -= stlen;
tail += stlen;
if (tail >= size) {
* difficult to deal with them here.
*/
-static inline void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp)
+static void stli_dodelaycmd(stliport_t *portp, volatile cdkctrl_t *cp)
{
int cmd;
* then port is still busy, otherwise no longer busy.
*/
-static inline int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
+static int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
{
volatile cdkasy_t *ap;
volatile cdkctrl_t *cp;
unsigned long oldsigs;
int rc, donerx;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n",
(int) brdp, channr);
#endif
if ((nt.data & DT_RXBREAK) && (portp->rxmarkmsk & BRKINT)) {
if (tty != (struct tty_struct *) NULL) {
- if (tty->flip.count < TTY_FLIPBUF_SIZE) {
- tty->flip.count++;
- *tty->flip.flag_buf_ptr++ = TTY_BREAK;
- *tty->flip.char_buf_ptr++ = 0;
- if (portp->flags & ASYNC_SAK) {
- do_SAK(tty);
- EBRDENABLE(brdp);
- }
- tty_schedule_flip(tty);
+ tty_insert_flip_char(tty, 0, TTY_BREAK);
+ if (portp->flags & ASYNC_SAK) {
+ do_SAK(tty);
+ EBRDENABLE(brdp);
}
+ tty_schedule_flip(tty);
}
}
* at the cdk header structure.
*/
-static inline void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp)
+static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp)
{
stliport_t *portp;
unsigned char hostbits[(STL_MAXCHANS / 8) + 1];
static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n",
(int) portp, (int) pp, (int) tiosp);
#endif
static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n",
(int) sp, dtr, rts);
#endif
{
long tiocm;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue);
#endif
* we need to do here is set up the appropriate per port data structures.
*/
-static inline int stli_initports(stlibrd_t *brdp)
+static int stli_initports(stlibrd_t *brdp)
{
stliport_t *portp;
int i, panelnr, panelport;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp);
#endif
{
unsigned long memconf;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp);
#endif
static void stli_ecpenable(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp);
#endif
outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR));
static void stli_ecpdisable(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp);
#endif
outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));
void *ptr;
unsigned char val;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
(int) offset);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
val = 0;
} else {
ptr = brdp->membase + (offset % ECP_ATPAGESIZE);
static void stli_ecpreset(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp);
#endif
static void stli_ecpintr(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp);
#endif
outb(0x1, brdp->iobase);
{
unsigned long memconf;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp);
#endif
void *ptr;
unsigned char val;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n",
(int) brdp, (int) offset, line);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
val = 0;
} else {
ptr = brdp->membase + (offset % ECP_EIPAGESIZE);
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
val = 0;
} else {
ptr = brdp->membase + (offset % ECP_MCPAGESIZE);
static void stli_ecppciinit(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp);
#endif
void *ptr;
unsigned char val;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n",
(int) brdp, (int) offset, line);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), board=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
val = 0;
} else {
ptr = brdp->membase + (offset % ECP_PCIPAGESIZE);
{
unsigned long memconf;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp);
#endif
static void stli_onbenable(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp);
#endif
outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR));
static void stli_onbdisable(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp);
#endif
outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR));
{
void *ptr;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
(int) offset);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
} else {
ptr = brdp->membase + (offset % ONB_ATPAGESIZE);
}
static void stli_onbreset(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp);
#endif
{
unsigned long memconf;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp);
#endif
static void stli_onbeenable(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp);
#endif
outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR));
static void stli_onbedisable(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp);
#endif
outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR));
void *ptr;
unsigned char val;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n",
(int) brdp, (int) offset, line);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
val = 0;
} else {
ptr = brdp->membase + (offset % ONB_EIPAGESIZE);
static void stli_onbereset(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp);
#endif
static void stli_bbyinit(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp);
#endif
void *ptr;
unsigned char val;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
(int) offset);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
val = 0;
} else {
ptr = brdp->membase + (offset % BBY_PAGESIZE);
static void stli_bbyreset(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp);
#endif
static void stli_stalinit(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp);
#endif
{
void *ptr;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
(int) offset);
#endif
printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
"range at line=%d(%d), brd=%d\n",
(int) offset, line, __LINE__, brdp->brdnr);
- ptr = 0;
+ ptr = NULL;
} else {
ptr = brdp->membase + (offset % STAL_PAGESIZE);
}
{
volatile unsigned long *vecp;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp);
#endif
* board types.
*/
-static inline int stli_initecp(stlibrd_t *brdp)
+static int stli_initecp(stlibrd_t *brdp)
{
cdkecpsig_t sig;
cdkecpsig_t *sigsp;
char *name;
int panelnr, nrports;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp);
#endif
* This handles only these board types.
*/
-static inline int stli_initonb(stlibrd_t *brdp)
+static int stli_initonb(stlibrd_t *brdp)
{
cdkonbsig_t sig;
cdkonbsig_t *sigsp;
char *name;
int i;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp);
#endif
stliport_t *portp;
int portnr, nrdevs, i, rc;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp);
#endif
static int __init stli_brdinit(stlibrd_t *brdp)
{
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp);
#endif
* might be. This is a bit if hack, but it is the best we can do.
*/
-static inline int stli_eisamemprobe(stlibrd_t *brdp)
+static int stli_eisamemprobe(stlibrd_t *brdp)
{
cdkecpsig_t ecpsig, *ecpsigp;
cdkonbsig_t onbsig, *onbsigp;
int i, foundit;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp);
#endif
if (! foundit) {
brdp->memaddr = 0;
- brdp->membase = 0;
+ brdp->membase = NULL;
printk(KERN_ERR "STALLION: failed to probe shared memory "
"region for %s in EISA slot=%d\n",
stli_brdnames[brdp->brdtype], (brdp->iobase >> 12));
return(0);
}
+static int stli_getbrdnr(void)
+{
+ int i;
+
+ for (i = 0; i < STL_MAXBRDS; i++) {
+ if (!stli_brds[i]) {
+ if (i >= stli_nrbrds)
+ stli_nrbrds = i + 1;
+ return i;
+ }
+ }
+ return -1;
+}
+
/*****************************************************************************/
/*
* do is go probing around in the usual places hoping we can find it.
*/
-static inline int stli_findeisabrds()
+static int stli_findeisabrds(void)
{
stlibrd_t *brdp;
unsigned int iobase, eid;
int i;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_findeisabrds()\n");
#endif
* Find the next available board number that is free.
*/
-static inline int stli_getbrdnr()
-{
- int i;
-
- for (i = 0; (i < STL_MAXBRDS); i++) {
- if (stli_brds[i] == (stlibrd_t *) NULL) {
- if (i >= stli_nrbrds)
- stli_nrbrds = i + 1;
- return(i);
- }
- }
- return(-1);
-}
-
/*****************************************************************************/
#ifdef CONFIG_PCI
* configuration space.
*/
-static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp)
+static int stli_initpcibrd(int brdtype, struct pci_dev *devp)
{
stlibrd_t *brdp;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n",
brdtype, dev->bus->number, dev->devfn);
#endif
}
brdp->brdtype = brdtype;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__,
pci_resource_start(devp, 0),
pci_resource_start(devp, 1),
* one as it is found.
*/
-static inline int stli_findpcibrds()
+static int stli_findpcibrds(void)
{
struct pci_dev *dev = NULL;
int rc;
-#if DEBUG
+#ifdef DEBUG
printk("stli_findpcibrds()\n");
#endif
* Allocate a new board structure. Fill out the basic info in it.
*/
-static stlibrd_t *stli_allocbrd()
+static stlibrd_t *stli_allocbrd(void)
{
stlibrd_t *brdp;
* can find.
*/
-static inline int stli_initbrds()
+static int stli_initbrds(void)
{
stlibrd_t *brdp, *nxtbrdp;
stlconf_t *confp;
int i, j;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_initbrds()\n");
#endif
#ifdef MODULE
stli_argbrds();
#endif
- if (stli_eisaprobe)
+ if (STLI_EISAPROBE)
stli_findeisabrds();
#ifdef CONFIG_PCI
stli_findpcibrds();
* the slave image (and debugging :-)
*/
-static ssize_t stli_memread(struct file *fp, char *buf, size_t count, loff_t *offp)
+static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp)
{
unsigned long flags;
void *memptr;
stlibrd_t *brdp;
int brdnr, size, n;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n",
(int) fp, (int) buf, count, (int) offp);
#endif
* the slave image (and debugging :-)
*/
-static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, loff_t *offp)
+static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp)
{
unsigned long flags;
void *memptr;
stlibrd_t *brdp;
- char *chbuf;
+ char __user *chbuf;
int brdnr, size, n;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n",
(int) fp, (int) buf, count, (int) offp);
#endif
if (fp->f_pos >= brdp->memsize)
return(0);
- chbuf = (char *) buf;
+ chbuf = (char __user *) buf;
size = MIN(count, (brdp->memsize - fp->f_pos));
save_flags(flags);
* Return the board stats structure to user app.
*/
-static int stli_getbrdstats(combrd_t *bp)
+static int stli_getbrdstats(combrd_t __user *bp)
{
stlibrd_t *brdp;
int i;
if (portp->tty != (struct tty_struct *) NULL) {
if (portp->tty->driver_data == portp) {
stli_comstats.ttystate = portp->tty->flags;
- stli_comstats.rxbuffered = portp->tty->flip.count;
+ stli_comstats.rxbuffered = -1 /*portp->tty->flip.count*/;
if (portp->tty->termios != (struct termios *) NULL) {
stli_comstats.cflags = portp->tty->termios->c_cflag;
stli_comstats.iflags = portp->tty->termios->c_iflag;
* what port to get stats for (used through board control device).
*/
-static int stli_getportstats(stliport_t *portp, comstats_t *cp)
+static int stli_getportstats(stliport_t *portp, comstats_t __user *cp)
{
stlibrd_t *brdp;
int rc;
- if (portp == (stliport_t *) NULL) {
+ if (!portp) {
if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))
return -EFAULT;
portp = stli_getport(stli_comstats.brd, stli_comstats.panel,
stli_comstats.port);
- if (portp == (stliport_t *) NULL)
- return(-ENODEV);
+ if (!portp)
+ return -ENODEV;
}
brdp = stli_brds[portp->brdnr];
- if (brdp == (stlibrd_t *) NULL)
- return(-ENODEV);
+ if (!brdp)
+ return -ENODEV;
if ((rc = stli_portcmdstats(portp)) < 0)
- return(rc);
+ return rc;
return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ?
-EFAULT : 0;
* Clear the port stats structure. We also return it zeroed out...
*/
-static int stli_clrportstats(stliport_t *portp, comstats_t *cp)
+static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp)
{
stlibrd_t *brdp;
int rc;
- if (portp == (stliport_t *) NULL) {
+ if (!portp) {
if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))
return -EFAULT;
portp = stli_getport(stli_comstats.brd, stli_comstats.panel,
stli_comstats.port);
- if (portp == (stliport_t *) NULL)
- return(-ENODEV);
+ if (!portp)
+ return -ENODEV;
}
brdp = stli_brds[portp->brdnr];
- if (brdp == (stlibrd_t *) NULL)
- return(-ENODEV);
+ if (!brdp)
+ return -ENODEV;
if (brdp->state & BST_STARTED) {
- if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, 0, 0, 0)) < 0)
- return(rc);
+ if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, NULL, 0, 0)) < 0)
+ return rc;
}
memset(&stli_comstats, 0, sizeof(comstats_t));
if (copy_to_user(cp, &stli_comstats, sizeof(comstats_t)))
return -EFAULT;
- return(0);
+ return 0;
}
/*****************************************************************************/
* Return the entire driver ports structure to a user app.
*/
-static int stli_getportstruct(unsigned long arg)
+static int stli_getportstruct(stliport_t __user *arg)
{
stliport_t *portp;
- if (copy_from_user(&stli_dummyport, (void *)arg, sizeof(stliport_t)))
+ if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t)))
return -EFAULT;
portp = stli_getport(stli_dummyport.brdnr, stli_dummyport.panelnr,
stli_dummyport.portnr);
- if (portp == (stliport_t *) NULL)
- return(-ENODEV);
- if (copy_to_user((void *) arg, portp, sizeof(stliport_t)))
+ if (!portp)
+ return -ENODEV;
+ if (copy_to_user(arg, portp, sizeof(stliport_t)))
return -EFAULT;
- return(0);
+ return 0;
}
/*****************************************************************************/
* Return the entire driver board structure to a user app.
*/
-static int stli_getbrdstruct(unsigned long arg)
+static int stli_getbrdstruct(stlibrd_t __user *arg)
{
stlibrd_t *brdp;
- if (copy_from_user(&stli_dummybrd, (void *)arg, sizeof(stlibrd_t)))
+ if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t)))
return -EFAULT;
if ((stli_dummybrd.brdnr < 0) || (stli_dummybrd.brdnr >= STL_MAXBRDS))
- return(-ENODEV);
+ return -ENODEV;
brdp = stli_brds[stli_dummybrd.brdnr];
- if (brdp == (stlibrd_t *) NULL)
- return(-ENODEV);
- if (copy_to_user((void *) arg, brdp, sizeof(stlibrd_t)))
+ if (!brdp)
+ return -ENODEV;
+ if (copy_to_user(arg, brdp, sizeof(stlibrd_t)))
return -EFAULT;
- return(0);
+ return 0;
}
/*****************************************************************************/
{
stlibrd_t *brdp;
int brdnr, rc, done;
+ void __user *argp = (void __user *)arg;
-#if DEBUG
+#ifdef DEBUG
printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n",
(int) ip, (int) fp, cmd, (int) arg);
#endif
switch (cmd) {
case COM_GETPORTSTATS:
- rc = stli_getportstats((stliport_t *)NULL, (comstats_t *)arg);
+ rc = stli_getportstats(NULL, argp);
done++;
break;
case COM_CLRPORTSTATS:
- rc = stli_clrportstats((stliport_t *)NULL, (comstats_t *)arg);
+ rc = stli_clrportstats(NULL, argp);
done++;
break;
case COM_GETBRDSTATS:
- rc = stli_getbrdstats((combrd_t *) arg);
+ rc = stli_getbrdstats(argp);
done++;
break;
case COM_READPORT:
- rc = stli_getportstruct(arg);
+ rc = stli_getportstruct(argp);
done++;
break;
case COM_READBOARD:
- rc = stli_getbrdstruct(arg);
+ rc = stli_getbrdstruct(argp);
done++;
break;
}
if (brdnr >= STL_MAXBRDS)
return(-ENODEV);
brdp = stli_brds[brdnr];
- if (brdp == (stlibrd_t *) NULL)
+ if (!brdp)
return(-ENODEV);
if (brdp->state == 0)
return(-ENODEV);
"device\n");
devfs_mk_dir("staliomem");
- istallion_class = class_simple_create(THIS_MODULE, "staliomem");
+ istallion_class = class_create(THIS_MODULE, "staliomem");
for (i = 0; i < 4; i++) {
devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
S_IFCHR | S_IRUSR | S_IWUSR,
"staliomem/%d", i);
- class_simple_device_add(istallion_class, MKDEV(STL_SIOMEMMAJOR, i),
+ class_device_create(istallion_class, NULL,
+ MKDEV(STL_SIOMEMMAJOR, i),
NULL, "staliomem%d", i);
}