]> www.infradead.org Git - users/hch/block.git/commitdiff
floppy: use blk_cleanup_disk
authorChristoph Hellwig <hch@lst.de>
Tue, 15 Jun 2021 09:00:15 +0000 (11:00 +0200)
committerChristoph Hellwig <hch@lst.de>
Sun, 8 Aug 2021 07:28:11 +0000 (09:28 +0200)
Use blk_cleanup_disk instead of open coding it and cleanup the
strange exist ordering and clearing of pointers that is not required.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/block/floppy.c

index 87460e0e5c72f5712e0c1962e7c2f19feba2efe6..6077f29423c47a14d04fd2dfc95bea2a389a7123 100644 (file)
@@ -4948,28 +4948,13 @@ static void __exit floppy_module_exit(void)
                        }
                        platform_device_unregister(&floppy_device[drive]);
                }
-               for (i = 0; i < ARRAY_SIZE(floppy_type); i++) {
-                       if (disks[drive][i])
-                               blk_cleanup_queue(disks[drive][i]->queue);
-               }
-               blk_mq_free_tag_set(&tag_sets[drive]);
-
-               /*
-                * These disks have not called add_disk().  Don't put down
-                * queue reference in put_disk().
-                */
-               if (!(allowed_drive_mask & (1 << drive)) ||
-                   fdc_state[FDC(drive)].version == FDC_NONE) {
-                       for (i = 0; i < ARRAY_SIZE(floppy_type); i++) {
-                               if (disks[drive][i])
-                                       disks[drive][i]->queue = NULL;
-                       }
-               }
 
                for (i = 0; i < ARRAY_SIZE(floppy_type); i++) {
                        if (disks[drive][i])
-                               put_disk(disks[drive][i]);
+                               blk_cleanup_disk(disks[drive][i]);
                }
+
+               blk_mq_free_tag_set(&tag_sets[drive]);
        }
 
        cancel_delayed_work_sync(&fd_timeout);