diff options
-rw-r--r-- | drivers/block/ataflop.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 30166774327d..69e1df7dfa14 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -361,13 +361,13 @@ static void finish_fdc( void ); | |||
361 | static void finish_fdc_done( int dummy ); | 361 | static void finish_fdc_done( int dummy ); |
362 | static void setup_req_params( int drive ); | 362 | static void setup_req_params( int drive ); |
363 | static void redo_fd_request( void); | 363 | static void redo_fd_request( void); |
364 | static int fd_ioctl( struct inode *inode, struct file *filp, unsigned int | 364 | static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int |
365 | cmd, unsigned long param); | 365 | cmd, unsigned long param); |
366 | static void fd_probe( int drive ); | 366 | static void fd_probe( int drive ); |
367 | static int fd_test_drive_present( int drive ); | 367 | static int fd_test_drive_present( int drive ); |
368 | static void config_types( void ); | 368 | static void config_types( void ); |
369 | static int floppy_open( struct inode *inode, struct file *filp ); | 369 | static int floppy_open(struct block_device *bdev, fmode_t mode); |
370 | static int floppy_release( struct inode * inode, struct file * filp ); | 370 | static int floppy_release(struct gendisk *disk, fmode_t mode); |
371 | 371 | ||
372 | /************************* End of Prototypes **************************/ | 372 | /************************* End of Prototypes **************************/ |
373 | 373 | ||
@@ -1483,10 +1483,10 @@ void do_fd_request(struct request_queue * q) | |||
1483 | atari_enable_irq( IRQ_MFP_FDC ); | 1483 | atari_enable_irq( IRQ_MFP_FDC ); |
1484 | } | 1484 | } |
1485 | 1485 | ||
1486 | static int fd_ioctl(struct inode *inode, struct file *filp, | 1486 | static int fd_ioctl(struct block_device *bdev, fmode_t mode, |
1487 | unsigned int cmd, unsigned long param) | 1487 | unsigned int cmd, unsigned long param) |
1488 | { | 1488 | { |
1489 | struct gendisk *disk = inode->i_bdev->bd_disk; | 1489 | struct gendisk *disk = bdev->bd_disk; |
1490 | struct atari_floppy_struct *floppy = disk->private_data; | 1490 | struct atari_floppy_struct *floppy = disk->private_data; |
1491 | int drive = floppy - unit; | 1491 | int drive = floppy - unit; |
1492 | int type = floppy->type; | 1492 | int type = floppy->type; |
@@ -1661,7 +1661,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, | |||
1661 | /* invalidate the buffer track to force a reread */ | 1661 | /* invalidate the buffer track to force a reread */ |
1662 | BufferDrive = -1; | 1662 | BufferDrive = -1; |
1663 | set_bit(drive, &fake_change); | 1663 | set_bit(drive, &fake_change); |
1664 | check_disk_change(inode->i_bdev); | 1664 | check_disk_change(bdev); |
1665 | return 0; | 1665 | return 0; |
1666 | default: | 1666 | default: |
1667 | return -EINVAL; | 1667 | return -EINVAL; |
@@ -1804,37 +1804,36 @@ static void __init config_types( void ) | |||
1804 | * drive with different device numbers. | 1804 | * drive with different device numbers. |
1805 | */ | 1805 | */ |
1806 | 1806 | ||
1807 | static int floppy_open( struct inode *inode, struct file *filp ) | 1807 | static int floppy_open(struct block_device *bdev, fmode_t mode) |
1808 | { | 1808 | { |
1809 | struct atari_floppy_struct *p = inode->i_bdev->bd_disk->private_data; | 1809 | struct atari_floppy_struct *p = bdev->bd_disk->private_data; |
1810 | int type = iminor(inode) >> 2; | 1810 | int type = MINOR(bdev->bd_dev) >> 2; |
1811 | 1811 | ||
1812 | DPRINT(("fd_open: type=%d\n",type)); | 1812 | DPRINT(("fd_open: type=%d\n",type)); |
1813 | if (p->ref && p->type != type) | 1813 | if (p->ref && p->type != type) |
1814 | return -EBUSY; | 1814 | return -EBUSY; |
1815 | 1815 | ||
1816 | if (p->ref == -1 || (p->ref && filp->f_mode & FMODE_EXCL)) | 1816 | if (p->ref == -1 || (p->ref && mode & FMODE_EXCL)) |
1817 | return -EBUSY; | 1817 | return -EBUSY; |
1818 | 1818 | ||
1819 | if (filp->f_mode & FMODE_EXCL) | 1819 | if (mode & FMODE_EXCL) |
1820 | p->ref = -1; | 1820 | p->ref = -1; |
1821 | else | 1821 | else |
1822 | p->ref++; | 1822 | p->ref++; |
1823 | 1823 | ||
1824 | p->type = type; | 1824 | p->type = type; |
1825 | 1825 | ||
1826 | if (filp->f_mode & FMODE_NDELAY) | 1826 | if (mode & FMODE_NDELAY) |
1827 | return 0; | 1827 | return 0; |
1828 | 1828 | ||
1829 | if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) { | 1829 | if (mode & (FMODE_READ|FMODE_WRITE)) { |
1830 | check_disk_change(inode->i_bdev); | 1830 | check_disk_change(bdev); |
1831 | if (filp->f_mode & FMODE_WRITE) { | 1831 | if (mode & FMODE_WRITE) { |
1832 | if (p->wpstat) { | 1832 | if (p->wpstat) { |
1833 | if (p->ref < 0) | 1833 | if (p->ref < 0) |
1834 | p->ref = 0; | 1834 | p->ref = 0; |
1835 | else | 1835 | else |
1836 | p->ref--; | 1836 | p->ref--; |
1837 | floppy_release(inode, filp); | ||
1838 | return -EROFS; | 1837 | return -EROFS; |
1839 | } | 1838 | } |
1840 | } | 1839 | } |
@@ -1843,9 +1842,9 @@ static int floppy_open( struct inode *inode, struct file *filp ) | |||
1843 | } | 1842 | } |
1844 | 1843 | ||
1845 | 1844 | ||
1846 | static int floppy_release( struct inode * inode, struct file * filp ) | 1845 | static int floppy_release(struct gendisk *disk, fmode_t mode) |
1847 | { | 1846 | { |
1848 | struct atari_floppy_struct *p = inode->i_bdev->bd_disk->private_data; | 1847 | struct atari_floppy_struct *p = disk->private_data; |
1849 | if (p->ref < 0) | 1848 | if (p->ref < 0) |
1850 | p->ref = 0; | 1849 | p->ref = 0; |
1851 | else if (!p->ref--) { | 1850 | else if (!p->ref--) { |
@@ -1857,9 +1856,9 @@ static int floppy_release( struct inode * inode, struct file * filp ) | |||
1857 | 1856 | ||
1858 | static struct block_device_operations floppy_fops = { | 1857 | static struct block_device_operations floppy_fops = { |
1859 | .owner = THIS_MODULE, | 1858 | .owner = THIS_MODULE, |
1860 | .__open = floppy_open, | 1859 | .open = floppy_open, |
1861 | .__release = floppy_release, | 1860 | .release = floppy_release, |
1862 | .__ioctl = fd_ioctl, | 1861 | .locked_ioctl = fd_ioctl, |
1863 | .media_changed = check_floppy_change, | 1862 | .media_changed = check_floppy_change, |
1864 | .revalidate_disk= floppy_revalidate, | 1863 | .revalidate_disk= floppy_revalidate, |
1865 | }; | 1864 | }; |