fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / char / mwave / mwavedd.c
index d37625d..8d14823 100644 (file)
@@ -57,6 +57,7 @@
 #include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/delay.h>
+#include <linux/serial_8250.h>
 #include "smapi.h"
 #include "mwavedd.h"
 #include "3780i.h"
@@ -270,7 +271,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
                                ipcnum,
                                pDrvData->IPCs[ipcnum].usIntCount);
        
-                       if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+                       if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
                                PRINTK_ERROR(KERN_ERR_MWAVE
                                                "mwavedd::mwave_ioctl:"
                                                " IOCTL_MW_REGISTER_IPC:"
@@ -296,7 +297,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
                                " ipcnum %x, usIntCount %x\n",
                                ipcnum,
                                pDrvData->IPCs[ipcnum].usIntCount);
-                       if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+                       if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
                                PRINTK_ERROR(KERN_ERR_MWAVE
                                                "mwavedd::mwave_ioctl:"
                                                " IOCTL_MW_GET_IPC: Error:"
@@ -354,7 +355,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
                                "mwavedd::mwave_ioctl IOCTL_MW_UNREGISTER_IPC"
                                " ipcnum %x\n",
                                ipcnum);
-                       if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+                       if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
                                PRINTK_ERROR(KERN_ERR_MWAVE
                                                "mwavedd::mwave_ioctl:"
                                                " IOCTL_MW_UNREGISTER_IPC:"
@@ -410,8 +411,8 @@ static ssize_t mwave_write(struct file *file, const char __user *buf,
 
 static int register_serial_portandirq(unsigned int port, int irq)
 {
-       struct serial_struct serial;
-
+       struct uart_port uart;
+       
        switch ( port ) {
                case 0x3f8:
                case 0x2f8:
@@ -442,16 +443,18 @@ static int register_serial_portandirq(unsigned int port, int irq)
        } /* switch */
        /* irq is okay */
 
-       memset(&serial, 0, sizeof(serial));
-       serial.port = port;
-       serial.irq = irq;
-       serial.flags = ASYNC_SHARE_IRQ;
-
-       return register_serial(&serial);
+       memset(&uart, 0, sizeof(struct uart_port));
+       
+       uart.uartclk =  1843200;
+       uart.iobase = port;
+       uart.irq = irq;
+       uart.iotype = UPIO_PORT;
+       uart.flags =  UPF_SHARE_IRQ;
+       return serial8250_register_port(&uart);
 }
 
 
-static struct file_operations mwave_fops = {
+static const struct file_operations mwave_fops = {
        .owner          = THIS_MODULE,
        .read           = mwave_read,
        .write          = mwave_write,
@@ -472,7 +475,7 @@ struct device mwave_device;
 
 /* Prevent code redundancy, create a macro for mwave_show_* functions. */
 #define mwave_show_function(attr_name, format_string, field)           \
-static ssize_t mwave_show_##attr_name(struct device *dev, char *buf)   \
+static ssize_t mwave_show_##attr_name(struct device *dev, struct device_attribute *attr, char *buf)    \
 {                                                                      \
        DSP_3780I_CONFIG_SETTINGS *pSettings =                          \
                &mwave_s_mdd.rBDData.rDspSettings;                      \
@@ -523,7 +526,7 @@ static void mwave_exit(void)
 #endif
 
        if ( pDrvData->sLine >= 0 ) {
-               unregister_serial(pDrvData->sLine);
+               serial8250_unregister_port(pDrvData->sLine);
        }
        if (pDrvData->bMwaveDevRegistered) {
                misc_deregister(&mwave_misc_dev);