Merge with rsync://fileserver/linux
[powerpc.git] / drivers / message / i2o / i2o_config.c
index 849d90a..3c3a7ab 100644 (file)
@@ -36,7 +36,9 @@
 
 #include <asm/uaccess.h>
 
-extern int i2o_parm_issue(struct i2o_device *, int, void *, int, void *, int);
+#include "core.h"
+
+#define SG_TABLESIZE           30
 
 static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
                         unsigned long arg);
@@ -366,9 +368,9 @@ static int i2o_cfg_swul(unsigned long arg)
 
        i2o_dma_free(&c->pdev->dev, &buffer);
 
-return_ret:
+      return_ret:
        return ret;
-return_fault:
+      return_fault:
        ret = -EFAULT;
        goto return_ret;
 };
@@ -515,8 +517,10 @@ static int i2o_cfg_evt_get(unsigned long arg, struct file *fp)
        return 0;
 }
 
+#ifdef CONFIG_I2O_EXT_ADAPTEC
 #ifdef CONFIG_COMPAT
-static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long arg)
+static int i2o_cfg_passthru32(struct file *file, unsigned cmnd,
+                             unsigned long arg)
 {
        struct i2o_cmd_passthru32 __user *cmd;
        struct i2o_controller *c;
@@ -643,8 +647,9 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long ar
                            flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) {
                                // TODO 64bit fix
                                if (copy_from_user
-                                   (p->virt, (void __user *)(unsigned long)sg[i].addr_bus,
-                                    sg_size)) {
+                                   (p->virt,
+                                    (void __user *)(unsigned long)sg[i].
+                                    addr_bus, sg_size)) {
                                        printk(KERN_DEBUG
                                               "%s: Could not copy SG buf %d FROM user\n",
                                               c->name, i);
@@ -662,7 +667,7 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long ar
                goto sg_list_cleanup;
 
        if (sg_offset) {
-               u32 msg[MSG_FRAME_SIZE];
+               u32 msg[I2O_OUTBOUND_MSG_FRAME_SIZE];
                /* Copy back the Scatter Gather buffers back to user space */
                u32 j;
                // TODO 64bit fix
@@ -670,7 +675,7 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long ar
                int sg_size;
 
                // re-acquire the original message to handle correctly the sg copy operation
-               memset(&msg, 0, MSG_FRAME_SIZE * 4);
+               memset(&msg, 0, I2O_OUTBOUND_MSG_FRAME_SIZE * 4);
                // get user msg size in u32s
                if (get_user(size, &user_msg[0])) {
                        rcode = -EFAULT;
@@ -735,11 +740,12 @@ static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long ar
        return rcode;
 }
 
-static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd, unsigned long arg)
+static long i2o_cfg_compat_ioctl(struct file *file, unsigned cmd,
+                                unsigned long arg)
 {
        int ret;
-       lock_kernel();          
-       switch (cmd) { 
+       lock_kernel();
+       switch (cmd) {
        case I2OGETIOPS:
                ret = i2o_cfg_ioctl(NULL, file, cmd, arg);
                break;
@@ -901,7 +907,7 @@ static int i2o_cfg_passthru(unsigned long arg)
                int sg_size;
 
                // re-acquire the original message to handle correctly the sg copy operation
-               memset(&msg, 0, MSG_FRAME_SIZE * 4);
+               memset(&msg, 0, I2O_OUTBOUND_MSG_FRAME_SIZE * 4);
                // get user msg size in u32s
                if (get_user(size, &user_msg[0])) {
                        rcode = -EFAULT;
@@ -964,6 +970,7 @@ static int i2o_cfg_passthru(unsigned long arg)
        kfree(reply);
        return rcode;
 }
+#endif
 
 /*
  * IOCTL Handler
@@ -1018,9 +1025,11 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
                ret = i2o_cfg_evt_get(arg, fp);
                break;
 
+#ifdef CONFIG_I2O_EXT_ADAPTEC
        case I2OPASSTHRU:
                ret = i2o_cfg_passthru(arg);
                break;
+#endif
 
        default:
                osm_debug("unknown ioctl called!\n");
@@ -1130,6 +1139,7 @@ static int __init i2o_config_old_init(void)
                osm_err("can't register device.\n");
                return -EBUSY;
        }
+
        return 0;
 }