diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/aha152x.c | 2 | ||||
-rw-r--r-- | drivers/scsi/arcmsr/arcmsr_attr.c | 3 | ||||
-rw-r--r-- | drivers/scsi/ide-scsi.c | 48 | ||||
-rw-r--r-- | drivers/scsi/ipr.c | 1 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_def.h | 2 | ||||
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 5 | ||||
-rw-r--r-- | drivers/scsi/scsi_ioctl.c | 6 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 35 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sr.c | 40 | ||||
-rw-r--r-- | drivers/scsi/sr_vendor.c | 12 | ||||
-rw-r--r-- | drivers/scsi/st.c | 7 |
12 files changed, 75 insertions, 88 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index b5a868d85eb4..1e5478abd90e 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -337,7 +337,7 @@ CMD_INC_RESID(struct scsi_cmnd *cmd, int inc) | |||
337 | #else | 337 | #else |
338 | #define IRQ_MIN 9 | 338 | #define IRQ_MIN 9 |
339 | #if defined(__PPC) | 339 | #if defined(__PPC) |
340 | #define IRQ_MAX (NR_IRQS-1) | 340 | #define IRQ_MAX (nr_irqs-1) |
341 | #else | 341 | #else |
342 | #define IRQ_MAX 12 | 342 | #define IRQ_MAX 12 |
343 | #endif | 343 | #endif |
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index 69f8346aa288..5877f29a6005 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -189,7 +189,6 @@ static struct bin_attribute arcmsr_sysfs_message_read_attr = { | |||
189 | .attr = { | 189 | .attr = { |
190 | .name = "mu_read", | 190 | .name = "mu_read", |
191 | .mode = S_IRUSR , | 191 | .mode = S_IRUSR , |
192 | .owner = THIS_MODULE, | ||
193 | }, | 192 | }, |
194 | .size = 1032, | 193 | .size = 1032, |
195 | .read = arcmsr_sysfs_iop_message_read, | 194 | .read = arcmsr_sysfs_iop_message_read, |
@@ -199,7 +198,6 @@ static struct bin_attribute arcmsr_sysfs_message_write_attr = { | |||
199 | .attr = { | 198 | .attr = { |
200 | .name = "mu_write", | 199 | .name = "mu_write", |
201 | .mode = S_IWUSR, | 200 | .mode = S_IWUSR, |
202 | .owner = THIS_MODULE, | ||
203 | }, | 201 | }, |
204 | .size = 1032, | 202 | .size = 1032, |
205 | .write = arcmsr_sysfs_iop_message_write, | 203 | .write = arcmsr_sysfs_iop_message_write, |
@@ -209,7 +207,6 @@ static struct bin_attribute arcmsr_sysfs_message_clear_attr = { | |||
209 | .attr = { | 207 | .attr = { |
210 | .name = "mu_clear", | 208 | .name = "mu_clear", |
211 | .mode = S_IWUSR, | 209 | .mode = S_IWUSR, |
212 | .owner = THIS_MODULE, | ||
213 | }, | 210 | }, |
214 | .size = 1, | 211 | .size = 1, |
215 | .write = arcmsr_sysfs_iop_message_clear, | 212 | .write = arcmsr_sysfs_iop_message_clear, |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 740bad435995..2370fd82ebfe 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -343,6 +343,11 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r | |||
343 | } | 343 | } |
344 | 344 | ||
345 | #ifdef CONFIG_IDE_PROC_FS | 345 | #ifdef CONFIG_IDE_PROC_FS |
346 | static ide_proc_entry_t idescsi_proc[] = { | ||
347 | { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL }, | ||
348 | { NULL, 0, NULL, NULL } | ||
349 | }; | ||
350 | |||
346 | #define ide_scsi_devset_get(name, field) \ | 351 | #define ide_scsi_devset_get(name, field) \ |
347 | static int get_##name(ide_drive_t *drive) \ | 352 | static int get_##name(ide_drive_t *drive) \ |
348 | { \ | 353 | { \ |
@@ -378,6 +383,16 @@ static const struct ide_proc_devset idescsi_settings[] = { | |||
378 | IDE_PROC_DEVSET(transform, 0, 3), | 383 | IDE_PROC_DEVSET(transform, 0, 3), |
379 | { 0 }, | 384 | { 0 }, |
380 | }; | 385 | }; |
386 | |||
387 | static ide_proc_entry_t *ide_scsi_proc_entries(ide_drive_t *drive) | ||
388 | { | ||
389 | return idescsi_proc; | ||
390 | } | ||
391 | |||
392 | static const struct ide_proc_devset *ide_scsi_proc_devsets(ide_drive_t *drive) | ||
393 | { | ||
394 | return idescsi_settings; | ||
395 | } | ||
381 | #endif | 396 | #endif |
382 | 397 | ||
383 | /* | 398 | /* |
@@ -419,13 +434,6 @@ static void ide_scsi_remove(ide_drive_t *drive) | |||
419 | 434 | ||
420 | static int ide_scsi_probe(ide_drive_t *); | 435 | static int ide_scsi_probe(ide_drive_t *); |
421 | 436 | ||
422 | #ifdef CONFIG_IDE_PROC_FS | ||
423 | static ide_proc_entry_t idescsi_proc[] = { | ||
424 | { "capacity", S_IFREG|S_IRUGO, proc_ide_read_capacity, NULL }, | ||
425 | { NULL, 0, NULL, NULL } | ||
426 | }; | ||
427 | #endif | ||
428 | |||
429 | static ide_driver_t idescsi_driver = { | 437 | static ide_driver_t idescsi_driver = { |
430 | .gen_driver = { | 438 | .gen_driver = { |
431 | .owner = THIS_MODULE, | 439 | .owner = THIS_MODULE, |
@@ -439,45 +447,39 @@ static ide_driver_t idescsi_driver = { | |||
439 | .end_request = idescsi_end_request, | 447 | .end_request = idescsi_end_request, |
440 | .error = idescsi_atapi_error, | 448 | .error = idescsi_atapi_error, |
441 | #ifdef CONFIG_IDE_PROC_FS | 449 | #ifdef CONFIG_IDE_PROC_FS |
442 | .proc = idescsi_proc, | 450 | .proc_entries = ide_scsi_proc_entries, |
443 | .settings = idescsi_settings, | 451 | .proc_devsets = ide_scsi_proc_devsets, |
444 | #endif | 452 | #endif |
445 | }; | 453 | }; |
446 | 454 | ||
447 | static int idescsi_ide_open(struct inode *inode, struct file *filp) | 455 | static int idescsi_ide_open(struct block_device *bdev, fmode_t mode) |
448 | { | 456 | { |
449 | struct gendisk *disk = inode->i_bdev->bd_disk; | 457 | struct ide_scsi_obj *scsi = ide_scsi_get(bdev->bd_disk); |
450 | struct ide_scsi_obj *scsi; | ||
451 | 458 | ||
452 | if (!(scsi = ide_scsi_get(disk))) | 459 | if (!scsi) |
453 | return -ENXIO; | 460 | return -ENXIO; |
454 | 461 | ||
455 | return 0; | 462 | return 0; |
456 | } | 463 | } |
457 | 464 | ||
458 | static int idescsi_ide_release(struct inode *inode, struct file *filp) | 465 | static int idescsi_ide_release(struct gendisk *disk, fmode_t mode) |
459 | { | 466 | { |
460 | struct gendisk *disk = inode->i_bdev->bd_disk; | 467 | ide_scsi_put(ide_scsi_g(disk)); |
461 | struct ide_scsi_obj *scsi = ide_scsi_g(disk); | ||
462 | |||
463 | ide_scsi_put(scsi); | ||
464 | |||
465 | return 0; | 468 | return 0; |
466 | } | 469 | } |
467 | 470 | ||
468 | static int idescsi_ide_ioctl(struct inode *inode, struct file *file, | 471 | static int idescsi_ide_ioctl(struct block_device *bdev, fmode_t mode, |
469 | unsigned int cmd, unsigned long arg) | 472 | unsigned int cmd, unsigned long arg) |
470 | { | 473 | { |
471 | struct block_device *bdev = inode->i_bdev; | ||
472 | struct ide_scsi_obj *scsi = ide_scsi_g(bdev->bd_disk); | 474 | struct ide_scsi_obj *scsi = ide_scsi_g(bdev->bd_disk); |
473 | return generic_ide_ioctl(scsi->drive, file, bdev, cmd, arg); | 475 | return generic_ide_ioctl(scsi->drive, bdev, cmd, arg); |
474 | } | 476 | } |
475 | 477 | ||
476 | static struct block_device_operations idescsi_ops = { | 478 | static struct block_device_operations idescsi_ops = { |
477 | .owner = THIS_MODULE, | 479 | .owner = THIS_MODULE, |
478 | .open = idescsi_ide_open, | 480 | .open = idescsi_ide_open, |
479 | .release = idescsi_ide_release, | 481 | .release = idescsi_ide_release, |
480 | .ioctl = idescsi_ide_ioctl, | 482 | .locked_ioctl = idescsi_ide_ioctl, |
481 | }; | 483 | }; |
482 | 484 | ||
483 | static int idescsi_slave_configure(struct scsi_device * sdp) | 485 | static int idescsi_slave_configure(struct scsi_device * sdp) |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index de62f4dfeb0e..ded854a6dd35 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -7853,7 +7853,6 @@ static struct pci_driver ipr_driver = { | |||
7853 | .remove = ipr_remove, | 7853 | .remove = ipr_remove, |
7854 | .shutdown = ipr_shutdown, | 7854 | .shutdown = ipr_shutdown, |
7855 | .err_handler = &ipr_err_handler, | 7855 | .err_handler = &ipr_err_handler, |
7856 | .dynids.use_driver_data = 1 | ||
7857 | }; | 7856 | }; |
7858 | 7857 | ||
7859 | /** | 7858 | /** |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 83c819216771..f25f41a499e5 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h | |||
@@ -2108,7 +2108,7 @@ struct scsi_qla_host; | |||
2108 | 2108 | ||
2109 | struct qla_msix_entry { | 2109 | struct qla_msix_entry { |
2110 | int have_irq; | 2110 | int have_irq; |
2111 | uint16_t msix_vector; | 2111 | uint32_t msix_vector; |
2112 | uint16_t msix_entry; | 2112 | uint16_t msix_entry; |
2113 | }; | 2113 | }; |
2114 | 2114 | ||
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 2aed4721c0d0..21dd182ad512 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -1566,9 +1566,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
1566 | goto probe_out; | 1566 | goto probe_out; |
1567 | } | 1567 | } |
1568 | 1568 | ||
1569 | if (pci_find_aer_capability(pdev)) | 1569 | /* This may fail but that's ok */ |
1570 | if (pci_enable_pcie_error_reporting(pdev)) | 1570 | pci_enable_pcie_error_reporting(pdev); |
1571 | goto probe_out; | ||
1572 | 1571 | ||
1573 | host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t)); | 1572 | host = scsi_host_alloc(sht, sizeof(scsi_qla_host_t)); |
1574 | if (host == NULL) { | 1573 | if (host == NULL) { |
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 28b19ef26309..dc1cfb2fd76b 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c | |||
@@ -237,7 +237,7 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg) | |||
237 | case SCSI_IOCTL_SEND_COMMAND: | 237 | case SCSI_IOCTL_SEND_COMMAND: |
238 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) | 238 | if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) |
239 | return -EACCES; | 239 | return -EACCES; |
240 | return sg_scsi_ioctl(NULL, sdev->request_queue, NULL, arg); | 240 | return sg_scsi_ioctl(sdev->request_queue, NULL, 0, arg); |
241 | case SCSI_IOCTL_DOORLOCK: | 241 | case SCSI_IOCTL_DOORLOCK: |
242 | return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); | 242 | return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); |
243 | case SCSI_IOCTL_DOORUNLOCK: | 243 | case SCSI_IOCTL_DOORUNLOCK: |
@@ -277,14 +277,14 @@ EXPORT_SYMBOL(scsi_ioctl); | |||
277 | * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag. | 277 | * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag. |
278 | */ | 278 | */ |
279 | int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, | 279 | int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, |
280 | void __user *arg, struct file *filp) | 280 | void __user *arg, int ndelay) |
281 | { | 281 | { |
282 | int val, result; | 282 | int val, result; |
283 | 283 | ||
284 | /* The first set of iocts may be executed even if we're doing | 284 | /* The first set of iocts may be executed even if we're doing |
285 | * error processing, as long as the device was opened | 285 | * error processing, as long as the device was opened |
286 | * non-blocking */ | 286 | * non-blocking */ |
287 | if (filp && (filp->f_flags & O_NONBLOCK)) { | 287 | if (ndelay) { |
288 | if (scsi_host_in_recovery(sdev->host)) | 288 | if (scsi_host_in_recovery(sdev->host)) |
289 | return -ENODEV; | 289 | return -ENODEV; |
290 | } else if (!scsi_block_when_processing_errors(sdev)) | 290 | } else if (!scsi_block_when_processing_errors(sdev)) |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 7ba70bef8b5d..c9e1242eaf25 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -609,17 +609,15 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq) | |||
609 | * In the latter case @inode and @filp carry an abridged amount | 609 | * In the latter case @inode and @filp carry an abridged amount |
610 | * of information as noted above. | 610 | * of information as noted above. |
611 | **/ | 611 | **/ |
612 | static int sd_open(struct inode *inode, struct file *filp) | 612 | static int sd_open(struct block_device *bdev, fmode_t mode) |
613 | { | 613 | { |
614 | struct gendisk *disk = inode->i_bdev->bd_disk; | 614 | struct scsi_disk *sdkp = scsi_disk_get(bdev->bd_disk); |
615 | struct scsi_disk *sdkp; | ||
616 | struct scsi_device *sdev; | 615 | struct scsi_device *sdev; |
617 | int retval; | 616 | int retval; |
618 | 617 | ||
619 | if (!(sdkp = scsi_disk_get(disk))) | 618 | if (!sdkp) |
620 | return -ENXIO; | 619 | return -ENXIO; |
621 | 620 | ||
622 | |||
623 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); | 621 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); |
624 | 622 | ||
625 | sdev = sdkp->device; | 623 | sdev = sdkp->device; |
@@ -633,14 +631,13 @@ static int sd_open(struct inode *inode, struct file *filp) | |||
633 | goto error_out; | 631 | goto error_out; |
634 | 632 | ||
635 | if (sdev->removable || sdkp->write_prot) | 633 | if (sdev->removable || sdkp->write_prot) |
636 | check_disk_change(inode->i_bdev); | 634 | check_disk_change(bdev); |
637 | 635 | ||
638 | /* | 636 | /* |
639 | * If the drive is empty, just let the open fail. | 637 | * If the drive is empty, just let the open fail. |
640 | */ | 638 | */ |
641 | retval = -ENOMEDIUM; | 639 | retval = -ENOMEDIUM; |
642 | if (sdev->removable && !sdkp->media_present && | 640 | if (sdev->removable && !sdkp->media_present && !(mode & FMODE_NDELAY)) |
643 | !(filp->f_flags & O_NDELAY)) | ||
644 | goto error_out; | 641 | goto error_out; |
645 | 642 | ||
646 | /* | 643 | /* |
@@ -648,7 +645,7 @@ static int sd_open(struct inode *inode, struct file *filp) | |||
648 | * if the user expects to be able to write to the thing. | 645 | * if the user expects to be able to write to the thing. |
649 | */ | 646 | */ |
650 | retval = -EROFS; | 647 | retval = -EROFS; |
651 | if (sdkp->write_prot && (filp->f_mode & FMODE_WRITE)) | 648 | if (sdkp->write_prot && (mode & FMODE_WRITE)) |
652 | goto error_out; | 649 | goto error_out; |
653 | 650 | ||
654 | /* | 651 | /* |
@@ -684,9 +681,8 @@ error_out: | |||
684 | * Note: may block (uninterruptible) if error recovery is underway | 681 | * Note: may block (uninterruptible) if error recovery is underway |
685 | * on this disk. | 682 | * on this disk. |
686 | **/ | 683 | **/ |
687 | static int sd_release(struct inode *inode, struct file *filp) | 684 | static int sd_release(struct gendisk *disk, fmode_t mode) |
688 | { | 685 | { |
689 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
690 | struct scsi_disk *sdkp = scsi_disk(disk); | 686 | struct scsi_disk *sdkp = scsi_disk(disk); |
691 | struct scsi_device *sdev = sdkp->device; | 687 | struct scsi_device *sdev = sdkp->device; |
692 | 688 | ||
@@ -743,10 +739,9 @@ static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
743 | * Note: most ioctls are forward onto the block subsystem or further | 739 | * Note: most ioctls are forward onto the block subsystem or further |
744 | * down in the scsi subsystem. | 740 | * down in the scsi subsystem. |
745 | **/ | 741 | **/ |
746 | static int sd_ioctl(struct inode * inode, struct file * filp, | 742 | static int sd_ioctl(struct block_device *bdev, fmode_t mode, |
747 | unsigned int cmd, unsigned long arg) | 743 | unsigned int cmd, unsigned long arg) |
748 | { | 744 | { |
749 | struct block_device *bdev = inode->i_bdev; | ||
750 | struct gendisk *disk = bdev->bd_disk; | 745 | struct gendisk *disk = bdev->bd_disk; |
751 | struct scsi_device *sdp = scsi_disk(disk)->device; | 746 | struct scsi_device *sdp = scsi_disk(disk)->device; |
752 | void __user *p = (void __user *)arg; | 747 | void __user *p = (void __user *)arg; |
@@ -761,7 +756,8 @@ static int sd_ioctl(struct inode * inode, struct file * filp, | |||
761 | * may try and take the device offline, in which case all further | 756 | * may try and take the device offline, in which case all further |
762 | * access to the device is prohibited. | 757 | * access to the device is prohibited. |
763 | */ | 758 | */ |
764 | error = scsi_nonblockable_ioctl(sdp, cmd, p, filp); | 759 | error = scsi_nonblockable_ioctl(sdp, cmd, p, |
760 | (mode & FMODE_NDELAY_NOW) != 0); | ||
765 | if (!scsi_block_when_processing_errors(sdp) || !error) | 761 | if (!scsi_block_when_processing_errors(sdp) || !error) |
766 | return error; | 762 | return error; |
767 | 763 | ||
@@ -775,7 +771,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp, | |||
775 | case SCSI_IOCTL_GET_BUS_NUMBER: | 771 | case SCSI_IOCTL_GET_BUS_NUMBER: |
776 | return scsi_ioctl(sdp, cmd, p); | 772 | return scsi_ioctl(sdp, cmd, p); |
777 | default: | 773 | default: |
778 | error = scsi_cmd_ioctl(filp, disk->queue, disk, cmd, p); | 774 | error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p); |
779 | if (error != -ENOTTY) | 775 | if (error != -ENOTTY) |
780 | return error; | 776 | return error; |
781 | } | 777 | } |
@@ -928,11 +924,10 @@ static void sd_rescan(struct device *dev) | |||
928 | * This gets directly called from VFS. When the ioctl | 924 | * This gets directly called from VFS. When the ioctl |
929 | * is not recognized we go back to the other translation paths. | 925 | * is not recognized we go back to the other translation paths. |
930 | */ | 926 | */ |
931 | static long sd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 927 | static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, |
928 | unsigned int cmd, unsigned long arg) | ||
932 | { | 929 | { |
933 | struct block_device *bdev = file->f_path.dentry->d_inode->i_bdev; | 930 | struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; |
934 | struct gendisk *disk = bdev->bd_disk; | ||
935 | struct scsi_device *sdev = scsi_disk(disk)->device; | ||
936 | 931 | ||
937 | /* | 932 | /* |
938 | * If we are in the middle of error recovery, don't let anyone | 933 | * If we are in the middle of error recovery, don't let anyone |
@@ -962,7 +957,7 @@ static struct block_device_operations sd_fops = { | |||
962 | .owner = THIS_MODULE, | 957 | .owner = THIS_MODULE, |
963 | .open = sd_open, | 958 | .open = sd_open, |
964 | .release = sd_release, | 959 | .release = sd_release, |
965 | .ioctl = sd_ioctl, | 960 | .locked_ioctl = sd_ioctl, |
966 | .getgeo = sd_getgeo, | 961 | .getgeo = sd_getgeo, |
967 | #ifdef CONFIG_COMPAT | 962 | #ifdef CONFIG_COMPAT |
968 | .compat_ioctl = sd_compat_ioctl, | 963 | .compat_ioctl = sd_compat_ioctl, |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 93bd59a1ed79..9adf35bd8b56 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1059,7 +1059,7 @@ sg_ioctl(struct inode *inode, struct file *filp, | |||
1059 | if (sg_allow_access(filp, &opcode)) | 1059 | if (sg_allow_access(filp, &opcode)) |
1060 | return -EPERM; | 1060 | return -EPERM; |
1061 | } | 1061 | } |
1062 | return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p); | 1062 | return sg_scsi_ioctl(sdp->device->request_queue, NULL, filp->f_mode, p); |
1063 | case SG_SET_DEBUG: | 1063 | case SG_SET_DEBUG: |
1064 | result = get_user(val, ip); | 1064 | result = get_user(val, ip); |
1065 | if (result) | 1065 | if (result) |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 0f17009c99d2..62b6633e3a97 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -471,38 +471,31 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
471 | return scsi_prep_return(q, rq, ret); | 471 | return scsi_prep_return(q, rq, ret); |
472 | } | 472 | } |
473 | 473 | ||
474 | static int sr_block_open(struct inode *inode, struct file *file) | 474 | static int sr_block_open(struct block_device *bdev, fmode_t mode) |
475 | { | 475 | { |
476 | struct gendisk *disk = inode->i_bdev->bd_disk; | 476 | struct scsi_cd *cd = scsi_cd_get(bdev->bd_disk); |
477 | struct scsi_cd *cd; | 477 | int ret = -ENXIO; |
478 | int ret = 0; | ||
479 | |||
480 | if(!(cd = scsi_cd_get(disk))) | ||
481 | return -ENXIO; | ||
482 | |||
483 | if((ret = cdrom_open(&cd->cdi, inode, file)) != 0) | ||
484 | scsi_cd_put(cd); | ||
485 | 478 | ||
479 | if (cd) { | ||
480 | ret = cdrom_open(&cd->cdi, bdev, mode); | ||
481 | if (ret) | ||
482 | scsi_cd_put(cd); | ||
483 | } | ||
486 | return ret; | 484 | return ret; |
487 | } | 485 | } |
488 | 486 | ||
489 | static int sr_block_release(struct inode *inode, struct file *file) | 487 | static int sr_block_release(struct gendisk *disk, fmode_t mode) |
490 | { | 488 | { |
491 | int ret; | 489 | struct scsi_cd *cd = scsi_cd(disk); |
492 | struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); | 490 | cdrom_release(&cd->cdi, mode); |
493 | ret = cdrom_release(&cd->cdi, file); | ||
494 | if(ret) | ||
495 | return ret; | ||
496 | |||
497 | scsi_cd_put(cd); | 491 | scsi_cd_put(cd); |
498 | |||
499 | return 0; | 492 | return 0; |
500 | } | 493 | } |
501 | 494 | ||
502 | static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, | 495 | static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, |
503 | unsigned long arg) | 496 | unsigned long arg) |
504 | { | 497 | { |
505 | struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); | 498 | struct scsi_cd *cd = scsi_cd(bdev->bd_disk); |
506 | struct scsi_device *sdev = cd->device; | 499 | struct scsi_device *sdev = cd->device; |
507 | void __user *argp = (void __user *)arg; | 500 | void __user *argp = (void __user *)arg; |
508 | int ret; | 501 | int ret; |
@@ -517,7 +510,7 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, | |||
517 | return scsi_ioctl(sdev, cmd, argp); | 510 | return scsi_ioctl(sdev, cmd, argp); |
518 | } | 511 | } |
519 | 512 | ||
520 | ret = cdrom_ioctl(file, &cd->cdi, inode, cmd, arg); | 513 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); |
521 | if (ret != -ENOSYS) | 514 | if (ret != -ENOSYS) |
522 | return ret; | 515 | return ret; |
523 | 516 | ||
@@ -527,7 +520,8 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, | |||
527 | * case fall through to scsi_ioctl, which will return ENDOEV again | 520 | * case fall through to scsi_ioctl, which will return ENDOEV again |
528 | * if it doesn't recognise the ioctl | 521 | * if it doesn't recognise the ioctl |
529 | */ | 522 | */ |
530 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, NULL); | 523 | ret = scsi_nonblockable_ioctl(sdev, cmd, argp, |
524 | (mode & FMODE_NDELAY_NOW) != 0); | ||
531 | if (ret != -ENODEV) | 525 | if (ret != -ENODEV) |
532 | return ret; | 526 | return ret; |
533 | return scsi_ioctl(sdev, cmd, argp); | 527 | return scsi_ioctl(sdev, cmd, argp); |
@@ -544,7 +538,7 @@ static struct block_device_operations sr_bdops = | |||
544 | .owner = THIS_MODULE, | 538 | .owner = THIS_MODULE, |
545 | .open = sr_block_open, | 539 | .open = sr_block_open, |
546 | .release = sr_block_release, | 540 | .release = sr_block_release, |
547 | .ioctl = sr_block_ioctl, | 541 | .locked_ioctl = sr_block_ioctl, |
548 | .media_changed = sr_block_media_changed, | 542 | .media_changed = sr_block_media_changed, |
549 | /* | 543 | /* |
550 | * No compat_ioctl for now because sr_block_ioctl never | 544 | * No compat_ioctl for now because sr_block_ioctl never |
diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c index 4eb3da996b36..4ad3e017213f 100644 --- a/drivers/scsi/sr_vendor.c +++ b/drivers/scsi/sr_vendor.c | |||
@@ -223,9 +223,9 @@ int sr_cd_check(struct cdrom_device_info *cdi) | |||
223 | no_multi = 1; | 223 | no_multi = 1; |
224 | break; | 224 | break; |
225 | } | 225 | } |
226 | min = BCD2BIN(buffer[15]); | 226 | min = bcd2bin(buffer[15]); |
227 | sec = BCD2BIN(buffer[16]); | 227 | sec = bcd2bin(buffer[16]); |
228 | frame = BCD2BIN(buffer[17]); | 228 | frame = bcd2bin(buffer[17]); |
229 | sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame; | 229 | sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame; |
230 | break; | 230 | break; |
231 | } | 231 | } |
@@ -252,9 +252,9 @@ int sr_cd_check(struct cdrom_device_info *cdi) | |||
252 | } | 252 | } |
253 | if (rc != 0) | 253 | if (rc != 0) |
254 | break; | 254 | break; |
255 | min = BCD2BIN(buffer[1]); | 255 | min = bcd2bin(buffer[1]); |
256 | sec = BCD2BIN(buffer[2]); | 256 | sec = bcd2bin(buffer[2]); |
257 | frame = BCD2BIN(buffer[3]); | 257 | frame = bcd2bin(buffer[3]); |
258 | sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame; | 258 | sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame; |
259 | if (sector) | 259 | if (sector) |
260 | sector -= CD_MSF_OFFSET; | 260 | sector -= CD_MSF_OFFSET; |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 5c28d08f18f4..c959bdc55f4f 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3263,7 +3263,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) | |||
3263 | * may try and take the device offline, in which case all further | 3263 | * may try and take the device offline, in which case all further |
3264 | * access to the device is prohibited. | 3264 | * access to the device is prohibited. |
3265 | */ | 3265 | */ |
3266 | retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p, file); | 3266 | retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p, |
3267 | file->f_flags & O_NDELAY); | ||
3267 | if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV) | 3268 | if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV) |
3268 | goto out; | 3269 | goto out; |
3269 | retval = 0; | 3270 | retval = 0; |
@@ -3567,8 +3568,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) | |||
3567 | !capable(CAP_SYS_RAWIO)) | 3568 | !capable(CAP_SYS_RAWIO)) |
3568 | i = -EPERM; | 3569 | i = -EPERM; |
3569 | else | 3570 | else |
3570 | i = scsi_cmd_ioctl(file, STp->disk->queue, | 3571 | i = scsi_cmd_ioctl(STp->disk->queue, STp->disk, |
3571 | STp->disk, cmd_in, p); | 3572 | file->f_mode, cmd_in, p); |
3572 | if (i != -ENOTTY) | 3573 | if (i != -ENOTTY) |
3573 | return i; | 3574 | return i; |
3574 | break; | 3575 | break; |