diff options
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r-- | drivers/block/cciss.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 6374dc103521..62b6c2cc80b5 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -168,8 +168,6 @@ static irqreturn_t do_cciss_msix_intr(int irq, void *dev_id); | |||
168 | static int cciss_open(struct block_device *bdev, fmode_t mode); | 168 | static int cciss_open(struct block_device *bdev, fmode_t mode); |
169 | static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode); | 169 | static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode); |
170 | static void cciss_release(struct gendisk *disk, fmode_t mode); | 170 | static void cciss_release(struct gendisk *disk, fmode_t mode); |
171 | static int do_ioctl(struct block_device *bdev, fmode_t mode, | ||
172 | unsigned int cmd, unsigned long arg); | ||
173 | static int cciss_ioctl(struct block_device *bdev, fmode_t mode, | 171 | static int cciss_ioctl(struct block_device *bdev, fmode_t mode, |
174 | unsigned int cmd, unsigned long arg); | 172 | unsigned int cmd, unsigned long arg); |
175 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 173 | static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
@@ -235,7 +233,7 @@ static const struct block_device_operations cciss_fops = { | |||
235 | .owner = THIS_MODULE, | 233 | .owner = THIS_MODULE, |
236 | .open = cciss_unlocked_open, | 234 | .open = cciss_unlocked_open, |
237 | .release = cciss_release, | 235 | .release = cciss_release, |
238 | .ioctl = do_ioctl, | 236 | .ioctl = cciss_ioctl, |
239 | .getgeo = cciss_getgeo, | 237 | .getgeo = cciss_getgeo, |
240 | #ifdef CONFIG_COMPAT | 238 | #ifdef CONFIG_COMPAT |
241 | .compat_ioctl = cciss_compat_ioctl, | 239 | .compat_ioctl = cciss_compat_ioctl, |
@@ -1143,16 +1141,6 @@ static void cciss_release(struct gendisk *disk, fmode_t mode) | |||
1143 | mutex_unlock(&cciss_mutex); | 1141 | mutex_unlock(&cciss_mutex); |
1144 | } | 1142 | } |
1145 | 1143 | ||
1146 | static int do_ioctl(struct block_device *bdev, fmode_t mode, | ||
1147 | unsigned cmd, unsigned long arg) | ||
1148 | { | ||
1149 | int ret; | ||
1150 | mutex_lock(&cciss_mutex); | ||
1151 | ret = cciss_ioctl(bdev, mode, cmd, arg); | ||
1152 | mutex_unlock(&cciss_mutex); | ||
1153 | return ret; | ||
1154 | } | ||
1155 | |||
1156 | #ifdef CONFIG_COMPAT | 1144 | #ifdef CONFIG_COMPAT |
1157 | 1145 | ||
1158 | static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, | 1146 | static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, |
@@ -1179,7 +1167,7 @@ static int cciss_compat_ioctl(struct block_device *bdev, fmode_t mode, | |||
1179 | case CCISS_REGNEWD: | 1167 | case CCISS_REGNEWD: |
1180 | case CCISS_RESCANDISK: | 1168 | case CCISS_RESCANDISK: |
1181 | case CCISS_GETLUNINFO: | 1169 | case CCISS_GETLUNINFO: |
1182 | return do_ioctl(bdev, mode, cmd, arg); | 1170 | return cciss_ioctl(bdev, mode, cmd, arg); |
1183 | 1171 | ||
1184 | case CCISS_PASSTHRU32: | 1172 | case CCISS_PASSTHRU32: |
1185 | return cciss_ioctl32_passthru(bdev, mode, cmd, arg); | 1173 | return cciss_ioctl32_passthru(bdev, mode, cmd, arg); |
@@ -1219,7 +1207,7 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode, | |||
1219 | if (err) | 1207 | if (err) |
1220 | return -EFAULT; | 1208 | return -EFAULT; |
1221 | 1209 | ||
1222 | err = do_ioctl(bdev, mode, CCISS_PASSTHRU, (unsigned long)p); | 1210 | err = cciss_ioctl(bdev, mode, CCISS_PASSTHRU, (unsigned long)p); |
1223 | if (err) | 1211 | if (err) |
1224 | return err; | 1212 | return err; |
1225 | err |= | 1213 | err |= |
@@ -1261,7 +1249,7 @@ static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode, | |||
1261 | if (err) | 1249 | if (err) |
1262 | return -EFAULT; | 1250 | return -EFAULT; |
1263 | 1251 | ||
1264 | err = do_ioctl(bdev, mode, CCISS_BIG_PASSTHRU, (unsigned long)p); | 1252 | err = cciss_ioctl(bdev, mode, CCISS_BIG_PASSTHRU, (unsigned long)p); |
1265 | if (err) | 1253 | if (err) |
1266 | return err; | 1254 | return err; |
1267 | err |= | 1255 | err |= |
@@ -1311,11 +1299,14 @@ static int cciss_getpciinfo(ctlr_info_t *h, void __user *argp) | |||
1311 | static int cciss_getintinfo(ctlr_info_t *h, void __user *argp) | 1299 | static int cciss_getintinfo(ctlr_info_t *h, void __user *argp) |
1312 | { | 1300 | { |
1313 | cciss_coalint_struct intinfo; | 1301 | cciss_coalint_struct intinfo; |
1302 | unsigned long flags; | ||
1314 | 1303 | ||
1315 | if (!argp) | 1304 | if (!argp) |
1316 | return -EINVAL; | 1305 | return -EINVAL; |
1306 | spin_lock_irqsave(&h->lock, flags); | ||
1317 | intinfo.delay = readl(&h->cfgtable->HostWrite.CoalIntDelay); | 1307 | intinfo.delay = readl(&h->cfgtable->HostWrite.CoalIntDelay); |
1318 | intinfo.count = readl(&h->cfgtable->HostWrite.CoalIntCount); | 1308 | intinfo.count = readl(&h->cfgtable->HostWrite.CoalIntCount); |
1309 | spin_unlock_irqrestore(&h->lock, flags); | ||
1319 | if (copy_to_user | 1310 | if (copy_to_user |
1320 | (argp, &intinfo, sizeof(cciss_coalint_struct))) | 1311 | (argp, &intinfo, sizeof(cciss_coalint_struct))) |
1321 | return -EFAULT; | 1312 | return -EFAULT; |
@@ -1356,12 +1347,15 @@ static int cciss_setintinfo(ctlr_info_t *h, void __user *argp) | |||
1356 | static int cciss_getnodename(ctlr_info_t *h, void __user *argp) | 1347 | static int cciss_getnodename(ctlr_info_t *h, void __user *argp) |
1357 | { | 1348 | { |
1358 | NodeName_type NodeName; | 1349 | NodeName_type NodeName; |
1350 | unsigned long flags; | ||
1359 | int i; | 1351 | int i; |
1360 | 1352 | ||
1361 | if (!argp) | 1353 | if (!argp) |
1362 | return -EINVAL; | 1354 | return -EINVAL; |
1355 | spin_lock_irqsave(&h->lock, flags); | ||
1363 | for (i = 0; i < 16; i++) | 1356 | for (i = 0; i < 16; i++) |
1364 | NodeName[i] = readb(&h->cfgtable->ServerName[i]); | 1357 | NodeName[i] = readb(&h->cfgtable->ServerName[i]); |
1358 | spin_unlock_irqrestore(&h->lock, flags); | ||
1365 | if (copy_to_user(argp, NodeName, sizeof(NodeName_type))) | 1359 | if (copy_to_user(argp, NodeName, sizeof(NodeName_type))) |
1366 | return -EFAULT; | 1360 | return -EFAULT; |
1367 | return 0; | 1361 | return 0; |
@@ -1398,10 +1392,13 @@ static int cciss_setnodename(ctlr_info_t *h, void __user *argp) | |||
1398 | static int cciss_getheartbeat(ctlr_info_t *h, void __user *argp) | 1392 | static int cciss_getheartbeat(ctlr_info_t *h, void __user *argp) |
1399 | { | 1393 | { |
1400 | Heartbeat_type heartbeat; | 1394 | Heartbeat_type heartbeat; |
1395 | unsigned long flags; | ||
1401 | 1396 | ||
1402 | if (!argp) | 1397 | if (!argp) |
1403 | return -EINVAL; | 1398 | return -EINVAL; |
1399 | spin_lock_irqsave(&h->lock, flags); | ||
1404 | heartbeat = readl(&h->cfgtable->HeartBeat); | 1400 | heartbeat = readl(&h->cfgtable->HeartBeat); |
1401 | spin_unlock_irqrestore(&h->lock, flags); | ||
1405 | if (copy_to_user(argp, &heartbeat, sizeof(Heartbeat_type))) | 1402 | if (copy_to_user(argp, &heartbeat, sizeof(Heartbeat_type))) |
1406 | return -EFAULT; | 1403 | return -EFAULT; |
1407 | return 0; | 1404 | return 0; |
@@ -1410,10 +1407,13 @@ static int cciss_getheartbeat(ctlr_info_t *h, void __user *argp) | |||
1410 | static int cciss_getbustypes(ctlr_info_t *h, void __user *argp) | 1407 | static int cciss_getbustypes(ctlr_info_t *h, void __user *argp) |
1411 | { | 1408 | { |
1412 | BusTypes_type BusTypes; | 1409 | BusTypes_type BusTypes; |
1410 | unsigned long flags; | ||
1413 | 1411 | ||
1414 | if (!argp) | 1412 | if (!argp) |
1415 | return -EINVAL; | 1413 | return -EINVAL; |
1414 | spin_lock_irqsave(&h->lock, flags); | ||
1416 | BusTypes = readl(&h->cfgtable->BusTypes); | 1415 | BusTypes = readl(&h->cfgtable->BusTypes); |
1416 | spin_unlock_irqrestore(&h->lock, flags); | ||
1417 | if (copy_to_user(argp, &BusTypes, sizeof(BusTypes_type))) | 1417 | if (copy_to_user(argp, &BusTypes, sizeof(BusTypes_type))) |
1418 | return -EFAULT; | 1418 | return -EFAULT; |
1419 | return 0; | 1419 | return 0; |