diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:44 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-13 15:39:44 -0400 |
commit | 5bb1536a07cca0b66f2bb41dfdf84140939b8f1f (patch) | |
tree | aebf71b8c9c782cfbb0044baea7d39b6090239d6 /drivers/ide/ide-floppy.c | |
parent | 14d83b12c931b03dbe6b3dc79122db02521c890b (diff) |
ide-floppy: move all ioctl handling to ide-floppy_ioctl.c (take 2)
While at it:
- idefloppy_ioctl() -> ide_floppy_ioctl()
v2:
Fix for idefloppy_ioctl name change from Stephen Rothwell.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 52 |
1 files changed, 1 insertions, 51 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 9f2c6b2af98f..169d4d93a6a9 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -765,56 +765,6 @@ static int idefloppy_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
765 | return 0; | 765 | return 0; |
766 | } | 766 | } |
767 | 767 | ||
768 | static int ide_floppy_lockdoor(ide_drive_t *drive, struct ide_atapi_pc *pc, | ||
769 | unsigned long arg, unsigned int cmd) | ||
770 | { | ||
771 | idefloppy_floppy_t *floppy = drive->driver_data; | ||
772 | struct gendisk *disk = floppy->disk; | ||
773 | int prevent = (arg && cmd != CDROMEJECT) ? 1 : 0; | ||
774 | |||
775 | if (floppy->openers > 1) | ||
776 | return -EBUSY; | ||
777 | |||
778 | ide_set_media_lock(drive, disk, prevent); | ||
779 | |||
780 | if (cmd == CDROMEJECT) | ||
781 | ide_do_start_stop(drive, disk, 2); | ||
782 | |||
783 | return 0; | ||
784 | } | ||
785 | |||
786 | static int idefloppy_ioctl(struct inode *inode, struct file *file, | ||
787 | unsigned int cmd, unsigned long arg) | ||
788 | { | ||
789 | struct block_device *bdev = inode->i_bdev; | ||
790 | struct ide_floppy_obj *floppy = ide_drv_g(bdev->bd_disk, | ||
791 | ide_floppy_obj); | ||
792 | ide_drive_t *drive = floppy->drive; | ||
793 | struct ide_atapi_pc pc; | ||
794 | void __user *argp = (void __user *)arg; | ||
795 | int err; | ||
796 | |||
797 | if (cmd == CDROMEJECT || cmd == CDROM_LOCKDOOR) | ||
798 | return ide_floppy_lockdoor(drive, &pc, arg, cmd); | ||
799 | |||
800 | err = ide_floppy_format_ioctl(drive, file, cmd, argp); | ||
801 | if (err != -ENOTTY) | ||
802 | return err; | ||
803 | |||
804 | /* | ||
805 | * skip SCSI_IOCTL_SEND_COMMAND (deprecated) | ||
806 | * and CDROM_SEND_PACKET (legacy) ioctls | ||
807 | */ | ||
808 | if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) | ||
809 | err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, | ||
810 | bdev->bd_disk, cmd, argp); | ||
811 | |||
812 | if (err == -ENOTTY) | ||
813 | err = generic_ide_ioctl(drive, file, bdev, cmd, arg); | ||
814 | |||
815 | return err; | ||
816 | } | ||
817 | |||
818 | static int idefloppy_media_changed(struct gendisk *disk) | 768 | static int idefloppy_media_changed(struct gendisk *disk) |
819 | { | 769 | { |
820 | struct ide_floppy_obj *floppy = ide_drv_g(disk, ide_floppy_obj); | 770 | struct ide_floppy_obj *floppy = ide_drv_g(disk, ide_floppy_obj); |
@@ -842,7 +792,7 @@ static struct block_device_operations idefloppy_ops = { | |||
842 | .owner = THIS_MODULE, | 792 | .owner = THIS_MODULE, |
843 | .open = idefloppy_open, | 793 | .open = idefloppy_open, |
844 | .release = idefloppy_release, | 794 | .release = idefloppy_release, |
845 | .ioctl = idefloppy_ioctl, | 795 | .ioctl = ide_floppy_ioctl, |
846 | .getgeo = idefloppy_getgeo, | 796 | .getgeo = idefloppy_getgeo, |
847 | .media_changed = idefloppy_media_changed, | 797 | .media_changed = idefloppy_media_changed, |
848 | .revalidate_disk = idefloppy_revalidate_disk | 798 | .revalidate_disk = idefloppy_revalidate_disk |