]> Pileus Git - ~andy/linux/blobdiff - drivers/scsi/dpt_i2o.c
SCSI: remove fake "address-of" expression
[~andy/linux] / drivers / scsi / dpt_i2o.c
index 0435d044c9da1fa12dfc03455e79629126c9593b..ffc1edf5e80da4bb9158caa312a395029539a29c 100644 (file)
@@ -114,12 +114,13 @@ static int hba_count = 0;
 
 static struct class *adpt_sysfs_class;
 
+static long adpt_unlocked_ioctl(struct file *, unsigned int, unsigned long);
 #ifdef CONFIG_COMPAT
 static long compat_adpt_ioctl(struct file *, unsigned int, unsigned long);
 #endif
 
 static const struct file_operations adpt_fops = {
-       .ioctl          = adpt_ioctl,
+       .unlocked_ioctl = adpt_unlocked_ioctl,
        .open           = adpt_open,
        .release        = adpt_close,
 #ifdef CONFIG_COMPAT
@@ -1289,7 +1290,7 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
        ulong flags = 0;
        struct adpt_i2o_post_wait_data *p1, *p2;
        struct adpt_i2o_post_wait_data *wait_data =
-               kmalloc(sizeof(struct adpt_i2o_post_wait_data),GFP_KERNEL);
+               kmalloc(sizeof(struct adpt_i2o_post_wait_data), GFP_ATOMIC);
        DECLARE_WAITQUEUE(wait, current);
 
        if (!wait_data)
@@ -2069,8 +2070,7 @@ static int adpt_system_info(void __user *buffer)
        return 0;
 }
 
-static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
-             ulong arg)
+static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
 {
        int minor;
        int error = 0;
@@ -2153,6 +2153,20 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd,
        return error;
 }
 
+static long adpt_unlocked_ioctl(struct file *file, uint cmd, ulong arg)
+{
+       struct inode *inode;
+       long ret;
+       inode = file->f_dentry->d_inode;
+       lock_kernel();
+       ret = adpt_ioctl(inode, file, cmd, arg);
+       unlock_kernel();
+
+       return ret;
+}
+
 #ifdef CONFIG_COMPAT
 static long compat_adpt_ioctl(struct file *file,
                                unsigned int cmd, unsigned long arg)
@@ -2626,6 +2640,13 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
                                continue;
                        }
                        bus_no = buf[0]>>16;
+                       if (bus_no >= MAX_CHANNEL) {    /* Something wrong skip it */
+                               printk(KERN_WARNING
+                                       "%s: Channel number %d out of range\n",
+                                       pHba->name, bus_no);
+                               continue;
+                       }
+
                        scsi_id = buf[1];
                        scsi_lun = (buf[2]>>8 )&0xff;
                        pDev = pHba->channel[bus_no].device[scsi_id];
@@ -2637,7 +2658,8 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
                                pDev = pDev->next_lun;
                        }
                        if(!pDev ) { // Something new add it
-                               d = kmalloc(sizeof(struct i2o_device), GFP_KERNEL);
+                               d = kmalloc(sizeof(struct i2o_device),
+                                           GFP_ATOMIC);
                                if(d==NULL)
                                {
                                        printk(KERN_CRIT "Out of memory for I2O device data.\n");
@@ -2653,13 +2675,11 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
                                adpt_i2o_report_hba_unit(pHba, d);
                                adpt_i2o_install_device(pHba, d);
        
-                               if(bus_no >= MAX_CHANNEL) {     // Something wrong skip it
-                                       printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no);
-                                       continue;
-                               }
                                pDev = pHba->channel[bus_no].device[scsi_id];   
                                if( pDev == NULL){
-                                       pDev =  kzalloc(sizeof(struct adpt_device),GFP_KERNEL);
+                                       pDev =
+                                         kzalloc(sizeof(struct adpt_device),
+                                                 GFP_ATOMIC);
                                        if(pDev == NULL) {
                                                return -ENOMEM;
                                        }
@@ -2668,7 +2688,9 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
                                        while (pDev->next_lun) {
                                                pDev = pDev->next_lun;
                                        }
-                                       pDev = pDev->next_lun = kzalloc(sizeof(struct adpt_device),GFP_KERNEL);
+                                       pDev = pDev->next_lun =
+                                         kzalloc(sizeof(struct adpt_device),
+                                                 GFP_ATOMIC);
                                        if(pDev == NULL) {
                                                return -ENOMEM;
                                        }
@@ -3113,7 +3135,7 @@ static int adpt_i2o_lct_get(adpt_hba* pHba)
                if (pHba->lct == NULL) {
                        pHba->lct = dma_alloc_coherent(&pHba->pDev->dev,
                                        pHba->lct_size, &pHba->lct_pa,
-                                       GFP_KERNEL);
+                                       GFP_ATOMIC);
                        if(pHba->lct == NULL) {
                                printk(KERN_CRIT "%s: Lct Get failed. Out of memory.\n",
                                        pHba->name);