Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[pandora-kernel.git] / drivers / char / istallion.c
index 216c792..d6e0315 100644 (file)
@@ -26,7 +26,6 @@
 
 /*****************************************************************************/
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/interrupt.h>
@@ -39,7 +38,6 @@
 #include <linux/ioport.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/device.h>
 #include <linux/wait.h>
 #include <linux/eisa.h>
@@ -283,7 +281,6 @@ static char *stli_brdnames[] = {
 
 /*****************************************************************************/
 
-#ifdef MODULE
 /*
  *     Define some string labels for arguments passed from the module
  *     load line. These allow for easy board definitions, and easy
@@ -382,8 +379,6 @@ MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]");
 module_param_array(board3, charp, NULL, 0);
 MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]");
 
-#endif
-
 /*
  *     Set up a default memory address table for EISA board probing.
  *     The default addresses are all bellow 1Mbyte, which has to be the
@@ -617,16 +612,6 @@ MODULE_DEVICE_TABLE(pci, istallion_pci_tbl);
 #define        MINOR2BRD(min)          (((min) & 0xc0) >> 6)
 #define        MINOR2PORT(min)         ((min) & 0x3f)
 
-/*
- *     Define a baud rate table that converts termios baud rate selector
- *     into the actual baud rate value. All baud rate calculations are based
- *     on the actual baud rate required.
- */
-static unsigned int    stli_baudrates[] = {
-       0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-       9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600
-};
-
 /*****************************************************************************/
 
 /*
@@ -644,14 +629,8 @@ static unsigned int        stli_baudrates[] = {
  *     Prototype all functions in this driver!
  */
 
-#ifdef MODULE
-static void    stli_argbrds(void);
 static int     stli_parsebrd(stlconf_t *confp, char **argp);
-
-static unsigned long   stli_atol(char *str);
-#endif
-
-int            stli_init(void);
+static 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, const unsigned char *buf, int count);
@@ -759,7 +738,7 @@ static int  stli_initpcibrd(int brdtype, struct pci_dev *devp);
  *     will give access to the shared memory on the Stallion intelligent
  *     board. This is also a very useful debugging tool.
  */
-static struct file_operations  stli_fsiomem = {
+static const struct file_operations    stli_fsiomem = {
        .owner          = THIS_MODULE,
        .read           = stli_memread,
        .write          = stli_memwrite,
@@ -787,8 +766,6 @@ static int  stli_timeron;
 
 static struct class *istallion_class;
 
-#ifdef MODULE
-
 /*
  *     Loadable module initialization stuff.
  */
@@ -826,11 +803,8 @@ static void __exit istallion_module_exit(void)
                return;
        }
        put_tty_driver(stli_serial);
-       for (i = 0; i < 4; i++) {
-               devfs_remove("staliomem/%d", i);
+       for (i = 0; i < 4; i++)
                class_device_destroy(istallion_class, MKDEV(STL_SIOMEMMAJOR, i));
-       }
-       devfs_remove("staliomem");
        class_destroy(istallion_class);
        if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
                printk("STALLION: failed to un-register serial memory device, "
@@ -958,8 +932,6 @@ static int stli_parsebrd(stlconf_t *confp, char **argp)
        return(1);
 }
 
-#endif
-
 /*****************************************************************************/
 
 static int stli_open(struct tty_struct *tty, struct file *filp)
@@ -2765,15 +2737,7 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio
 /*
  *     Start of by setting the baud, char size, parity and stop bit info.
  */
-       pp->baudout = tiosp->c_cflag & CBAUD;
-       if (pp->baudout & CBAUDEX) {
-               pp->baudout &= ~CBAUDEX;
-               if ((pp->baudout < 1) || (pp->baudout > 4))
-                       tiosp->c_cflag &= ~CBAUDEX;
-               else
-                       pp->baudout += 15;
-       }
-       pp->baudout = stli_baudrates[pp->baudout];
+       pp->baudout = tty_get_baud_rate(portp->tty);
        if ((tiosp->c_cflag & CBAUD) == B38400) {
                if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
                        pp->baudout = 57600;
@@ -3506,7 +3470,7 @@ static int stli_initecp(stlibrd_t *brdp)
  */
        EBRDENABLE(brdp);
        sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR);
-       memcpy(&sig, sigsp, sizeof(cdkecpsig_t));
+       memcpy_fromio(&sig, sigsp, sizeof(cdkecpsig_t));
        EBRDDISABLE(brdp);
 
        if (sig.magic != cpu_to_le32(ECP_MAGIC))
@@ -4672,7 +4636,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
        return rc;
 }
 
-static struct tty_operations stli_ops = {
+static const struct tty_operations stli_ops = {
        .open = stli_open,
        .close = stli_close,
        .write = stli_write,
@@ -4698,7 +4662,7 @@ static struct tty_operations stli_ops = {
 
 /*****************************************************************************/
 
-int __init stli_init(void)
+static int __init stli_init(void)
 {
        int i;
        printk(KERN_INFO "%s: version %s\n", stli_drvtitle, stli_drvversion);
@@ -4728,16 +4692,11 @@ int __init stli_init(void)
                printk(KERN_ERR "STALLION: failed to register serial memory "
                                "device\n");
 
-       devfs_mk_dir("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);
+       for (i = 0; i < 4; i++)
                class_device_create(istallion_class, NULL,
                                MKDEV(STL_SIOMEMMAJOR, i),
                                NULL, "staliomem%d", i);
-       }
 
 /*
  *     Set up the tty driver structure and register us as a driver.