]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/block/floppy.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / block / floppy.c
index 3951020e494ac803001083b186a5b7614eb6d42f..77fc76f8aea91b79be3f8cfc6c640e3e23748de0 100644 (file)
@@ -597,6 +597,11 @@ static unsigned char fsector_t;    /* sector in track */
 static unsigned char in_sector_offset; /* offset within physical sector,
                                         * expressed in units of 512 bytes */
 
+static inline bool drive_no_geom(int drive)
+{
+       return !current_type[drive] && !ITYPE(UDRS->fd_device);
+}
+
 #ifndef fd_eject
 static inline int fd_eject(int drive)
 {
@@ -3276,7 +3281,7 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g,
                        struct block_device *bdev = opened_bdev[cnt];
                        if (!bdev || ITYPE(drive_state[cnt].fd_device) != type)
                                continue;
-                       __invalidate_device(bdev);
+                       __invalidate_device(bdev, true);
                }
                mutex_unlock(&open_lock);
        } else {
@@ -3782,7 +3787,7 @@ static int check_floppy_change(struct gendisk *disk)
        if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
            test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
            test_bit(drive, &fake_change) ||
-           (!ITYPE(UDRS->fd_device) && !current_type[drive]))
+           drive_no_geom(drive))
                return 1;
        return 0;
 }
@@ -3848,13 +3853,13 @@ static int __floppy_read_block_0(struct block_device *bdev)
 static int floppy_revalidate(struct gendisk *disk)
 {
        int drive = (long)disk->private_data;
-#define NO_GEOM (!current_type[drive] && !ITYPE(UDRS->fd_device))
        int cf;
        int res = 0;
 
        if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
            test_bit(FD_VERIFY_BIT, &UDRS->flags) ||
-           test_bit(drive, &fake_change) || NO_GEOM) {
+           test_bit(drive, &fake_change) ||
+           drive_no_geom(drive)) {
                if (WARN(atomic_read(&usage_count) == 0,
                         "VFS: revalidate called on non-open device.\n"))
                        return -EFAULT;
@@ -3862,7 +3867,7 @@ static int floppy_revalidate(struct gendisk *disk)
                lock_fdc(drive, false);
                cf = (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags) ||
                      test_bit(FD_VERIFY_BIT, &UDRS->flags));
-               if (!(cf || test_bit(drive, &fake_change) || NO_GEOM)) {
+               if (!(cf || test_bit(drive, &fake_change) || drive_no_geom(drive))) {
                        process_fd_request();   /*already done by another thread */
                        return 0;
                }
@@ -3874,7 +3879,7 @@ static int floppy_revalidate(struct gendisk *disk)
                clear_bit(FD_DISK_CHANGED_BIT, &UDRS->flags);
                if (cf)
                        UDRS->generation++;
-               if (NO_GEOM) {
+               if (drive_no_geom(drive)) {
                        /* auto-sensing */
                        res = __floppy_read_block_0(opened_bdev[drive]);
                } else {
@@ -4352,7 +4357,7 @@ static int __init floppy_init(void)
 out_unreg_platform_dev:
        platform_device_unregister(&floppy_device[drive]);
 out_flush_work:
-       flush_scheduled_work();
+       flush_work_sync(&floppy_work);
        if (atomic_read(&usage_count))
                floppy_release_irq_and_dma();
 out_unreg_region:
@@ -4422,7 +4427,7 @@ static int floppy_grab_irq_and_dma(void)
         * We might have scheduled a free_irq(), wait it to
         * drain first:
         */
-       flush_scheduled_work();
+       flush_work_sync(&floppy_work);
 
        if (fd_request_irq()) {
                DPRINT("Unable to grab IRQ%d for the floppy driver\n",