diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:03:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-22 20:03:12 -0400 |
commit | 8abfc6e7a45eb74e51904bbae676fae008b11366 (patch) | |
tree | 57d0a24558c0693e3a52e8e756616f6c72def1e9 /drivers/block/ataflop.c | |
parent | e9dd2b6837e26fe202708cce5ea4bb4ee3e3482e (diff) | |
parent | 6362beea8914cbd4630ccde3617d944aeca2d48f (diff) |
Merge branch 'for-2.6.37/drivers' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.37/drivers' of git://git.kernel.dk/linux-2.6-block: (95 commits)
cciss: fix PCI IDs for new Smart Array controllers
drbd: add race-breaker to drbd_go_diskless
drbd: use dynamic_dev_dbg to optionally log uuid changes
dynamic_debug.h: Fix dynamic_dev_dbg() macro if CONFIG_DYNAMIC_DEBUG not set
drbd: cleanup: change "<= 0" to "== 0"
drbd: relax the grace period of the md_sync timer again
drbd: add some more explicit drbd_md_sync
drbd: drop wrong debug asserts, fix recently introduced race
drbd: cleanup useless leftover warn/error printk's
drbd: add explicit drbd_md_sync to drbd_resync_finished
drbd: Do not log an ASSERT for P_OV_REQUEST packets while C_CONNECTED
drbd: fix for possible deadlock on IO error during resync
drbd: fix unlikely access after free and list corruption
drbd: fix for spurious fullsync (uuids rotated too fast)
drbd: allow for explicit resync-finished notifications
drbd: preparation commit, using full state in receive_state()
drbd: drbd_send_ack_dp must not rely on header information
drbd: Fix regression in recv_bm_rle_bits (compressed bitmap)
drbd: Fixed a stupid copy and paste error
drbd: Allow larger values for c-fill-target.
...
Fix up trivial conflict in drivers/block/ataflop.c due to BKL removal
Diffstat (limited to 'drivers/block/ataflop.c')
-rw-r--r-- | drivers/block/ataflop.c | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 8c021bb7a991..4e4cc6c828cb 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -80,8 +80,8 @@ | |||
80 | #undef DEBUG | 80 | #undef DEBUG |
81 | 81 | ||
82 | static DEFINE_MUTEX(ataflop_mutex); | 82 | static DEFINE_MUTEX(ataflop_mutex); |
83 | static struct request_queue *floppy_queue; | ||
84 | static struct request *fd_request; | 83 | static struct request *fd_request; |
84 | static int fdc_queue; | ||
85 | 85 | ||
86 | /* Disk types: DD, HD, ED */ | 86 | /* Disk types: DD, HD, ED */ |
87 | static struct atari_disk_type { | 87 | static struct atari_disk_type { |
@@ -1392,6 +1392,29 @@ static void setup_req_params( int drive ) | |||
1392 | ReqTrack, ReqSector, (unsigned long)ReqData )); | 1392 | ReqTrack, ReqSector, (unsigned long)ReqData )); |
1393 | } | 1393 | } |
1394 | 1394 | ||
1395 | /* | ||
1396 | * Round-robin between our available drives, doing one request from each | ||
1397 | */ | ||
1398 | static struct request *set_next_request(void) | ||
1399 | { | ||
1400 | struct request_queue *q; | ||
1401 | int old_pos = fdc_queue; | ||
1402 | struct request *rq; | ||
1403 | |||
1404 | do { | ||
1405 | q = unit[fdc_queue].disk->queue; | ||
1406 | if (++fdc_queue == FD_MAX_UNITS) | ||
1407 | fdc_queue = 0; | ||
1408 | if (q) { | ||
1409 | rq = blk_fetch_request(q); | ||
1410 | if (rq) | ||
1411 | break; | ||
1412 | } | ||
1413 | } while (fdc_queue != old_pos); | ||
1414 | |||
1415 | return rq; | ||
1416 | } | ||
1417 | |||
1395 | 1418 | ||
1396 | static void redo_fd_request(void) | 1419 | static void redo_fd_request(void) |
1397 | { | 1420 | { |
@@ -1406,7 +1429,7 @@ static void redo_fd_request(void) | |||
1406 | 1429 | ||
1407 | repeat: | 1430 | repeat: |
1408 | if (!fd_request) { | 1431 | if (!fd_request) { |
1409 | fd_request = blk_fetch_request(floppy_queue); | 1432 | fd_request = set_next_request(); |
1410 | if (!fd_request) | 1433 | if (!fd_request) |
1411 | goto the_end; | 1434 | goto the_end; |
1412 | } | 1435 | } |
@@ -1933,10 +1956,6 @@ static int __init atari_floppy_init (void) | |||
1933 | PhysTrackBuffer = virt_to_phys(TrackBuffer); | 1956 | PhysTrackBuffer = virt_to_phys(TrackBuffer); |
1934 | BufferDrive = BufferSide = BufferTrack = -1; | 1957 | BufferDrive = BufferSide = BufferTrack = -1; |
1935 | 1958 | ||
1936 | floppy_queue = blk_init_queue(do_fd_request, &ataflop_lock); | ||
1937 | if (!floppy_queue) | ||
1938 | goto Enomem; | ||
1939 | |||
1940 | for (i = 0; i < FD_MAX_UNITS; i++) { | 1959 | for (i = 0; i < FD_MAX_UNITS; i++) { |
1941 | unit[i].track = -1; | 1960 | unit[i].track = -1; |
1942 | unit[i].flags = 0; | 1961 | unit[i].flags = 0; |
@@ -1945,7 +1964,10 @@ static int __init atari_floppy_init (void) | |||
1945 | sprintf(unit[i].disk->disk_name, "fd%d", i); | 1964 | sprintf(unit[i].disk->disk_name, "fd%d", i); |
1946 | unit[i].disk->fops = &floppy_fops; | 1965 | unit[i].disk->fops = &floppy_fops; |
1947 | unit[i].disk->private_data = &unit[i]; | 1966 | unit[i].disk->private_data = &unit[i]; |
1948 | unit[i].disk->queue = floppy_queue; | 1967 | unit[i].disk->queue = blk_init_queue(do_fd_request, |
1968 | &ataflop_lock); | ||
1969 | if (!unit[i].disk->queue) | ||
1970 | goto Enomem; | ||
1949 | set_capacity(unit[i].disk, MAX_DISK_SIZE * 2); | 1971 | set_capacity(unit[i].disk, MAX_DISK_SIZE * 2); |
1950 | add_disk(unit[i].disk); | 1972 | add_disk(unit[i].disk); |
1951 | } | 1973 | } |
@@ -1960,10 +1982,14 @@ static int __init atari_floppy_init (void) | |||
1960 | 1982 | ||
1961 | return 0; | 1983 | return 0; |
1962 | Enomem: | 1984 | Enomem: |
1963 | while (i--) | 1985 | while (i--) { |
1986 | struct request_queue *q = unit[i].disk->queue; | ||
1987 | |||
1964 | put_disk(unit[i].disk); | 1988 | put_disk(unit[i].disk); |
1965 | if (floppy_queue) | 1989 | if (q) |
1966 | blk_cleanup_queue(floppy_queue); | 1990 | blk_cleanup_queue(q); |
1991 | } | ||
1992 | |||
1967 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 1993 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
1968 | return -ENOMEM; | 1994 | return -ENOMEM; |
1969 | } | 1995 | } |
@@ -2012,12 +2038,14 @@ static void __exit atari_floppy_exit(void) | |||
2012 | int i; | 2038 | int i; |
2013 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 2039 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
2014 | for (i = 0; i < FD_MAX_UNITS; i++) { | 2040 | for (i = 0; i < FD_MAX_UNITS; i++) { |
2041 | struct request_queue *q = unit[i].disk->queue; | ||
2042 | |||
2015 | del_gendisk(unit[i].disk); | 2043 | del_gendisk(unit[i].disk); |
2016 | put_disk(unit[i].disk); | 2044 | put_disk(unit[i].disk); |
2045 | blk_cleanup_queue(q); | ||
2017 | } | 2046 | } |
2018 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 2047 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
2019 | 2048 | ||
2020 | blk_cleanup_queue(floppy_queue); | ||
2021 | del_timer_sync(&fd_timer); | 2049 | del_timer_sync(&fd_timer); |
2022 | atari_stram_free( DMABuffer ); | 2050 | atari_stram_free( DMABuffer ); |
2023 | } | 2051 | } |