diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_cfdc.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_cfdc.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c index ef681dfed0cc..25d9e0ae9c57 100644 --- a/drivers/s390/scsi/zfcp_cfdc.c +++ b/drivers/s390/scsi/zfcp_cfdc.c | |||
@@ -10,8 +10,10 @@ | |||
10 | #define KMSG_COMPONENT "zfcp" | 10 | #define KMSG_COMPONENT "zfcp" |
11 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | 11 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
12 | 12 | ||
13 | #include <linux/slab.h> | ||
13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
14 | #include <linux/miscdevice.h> | 15 | #include <linux/miscdevice.h> |
16 | #include <asm/compat.h> | ||
15 | #include <asm/ccwdev.h> | 17 | #include <asm/ccwdev.h> |
16 | #include "zfcp_def.h" | 18 | #include "zfcp_def.h" |
17 | #include "zfcp_ext.h" | 19 | #include "zfcp_ext.h" |
@@ -86,22 +88,17 @@ static int zfcp_cfdc_copy_to_user(void __user *user_buffer, | |||
86 | static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno) | 88 | static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno) |
87 | { | 89 | { |
88 | char busid[9]; | 90 | char busid[9]; |
89 | struct ccw_device *ccwdev; | 91 | struct ccw_device *cdev; |
90 | struct zfcp_adapter *adapter = NULL; | 92 | struct zfcp_adapter *adapter; |
91 | 93 | ||
92 | snprintf(busid, sizeof(busid), "0.0.%04x", devno); | 94 | snprintf(busid, sizeof(busid), "0.0.%04x", devno); |
93 | ccwdev = get_ccwdev_by_busid(&zfcp_ccw_driver, busid); | 95 | cdev = get_ccwdev_by_busid(&zfcp_ccw_driver, busid); |
94 | if (!ccwdev) | 96 | if (!cdev) |
95 | goto out; | 97 | return NULL; |
96 | 98 | ||
97 | adapter = dev_get_drvdata(&ccwdev->dev); | 99 | adapter = zfcp_ccw_adapter_by_cdev(cdev); |
98 | if (!adapter) | 100 | |
99 | goto out_put; | 101 | put_device(&cdev->dev); |
100 | |||
101 | zfcp_adapter_get(adapter); | ||
102 | out_put: | ||
103 | put_device(&ccwdev->dev); | ||
104 | out: | ||
105 | return adapter; | 102 | return adapter; |
106 | } | 103 | } |
107 | 104 | ||
@@ -168,7 +165,7 @@ static void zfcp_cfdc_req_to_sense(struct zfcp_cfdc_data *data, | |||
168 | } | 165 | } |
169 | 166 | ||
170 | static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, | 167 | static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, |
171 | unsigned long buffer) | 168 | unsigned long arg) |
172 | { | 169 | { |
173 | struct zfcp_cfdc_data *data; | 170 | struct zfcp_cfdc_data *data; |
174 | struct zfcp_cfdc_data __user *data_user; | 171 | struct zfcp_cfdc_data __user *data_user; |
@@ -180,7 +177,11 @@ static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, | |||
180 | if (command != ZFCP_CFDC_IOC) | 177 | if (command != ZFCP_CFDC_IOC) |
181 | return -ENOTTY; | 178 | return -ENOTTY; |
182 | 179 | ||
183 | data_user = (void __user *) buffer; | 180 | if (is_compat_task()) |
181 | data_user = compat_ptr(arg); | ||
182 | else | ||
183 | data_user = (void __user *)arg; | ||
184 | |||
184 | if (!data_user) | 185 | if (!data_user) |
185 | return -EINVAL; | 186 | return -EINVAL; |
186 | 187 | ||
@@ -212,7 +213,6 @@ static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, | |||
212 | retval = -ENXIO; | 213 | retval = -ENXIO; |
213 | goto free_buffer; | 214 | goto free_buffer; |
214 | } | 215 | } |
215 | zfcp_adapter_get(adapter); | ||
216 | 216 | ||
217 | retval = zfcp_cfdc_sg_setup(data->command, fsf_cfdc->sg, | 217 | retval = zfcp_cfdc_sg_setup(data->command, fsf_cfdc->sg, |
218 | data_user->control_file); | 218 | data_user->control_file); |
@@ -245,7 +245,7 @@ static long zfcp_cfdc_dev_ioctl(struct file *file, unsigned int command, | |||
245 | free_sg: | 245 | free_sg: |
246 | zfcp_sg_free_table(fsf_cfdc->sg, ZFCP_CFDC_PAGES); | 246 | zfcp_sg_free_table(fsf_cfdc->sg, ZFCP_CFDC_PAGES); |
247 | adapter_put: | 247 | adapter_put: |
248 | zfcp_adapter_put(adapter); | 248 | zfcp_ccw_adapter_put(adapter); |
249 | free_buffer: | 249 | free_buffer: |
250 | kfree(data); | 250 | kfree(data); |
251 | no_mem_sense: | 251 | no_mem_sense: |