diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-04 20:49:29 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-11-14 22:10:35 -0500 |
commit | b1bf42105aad7c976907665923bc53ce2244e494 (patch) | |
tree | 6d8902d88f504e15a7d3375790e2838acf7925d0 | |
parent | 37cb8e1f8e10c6e9bd2a1b95cdda0620a21b0551 (diff) |
block/floppy: Convert callback to pass timer_list
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to passing in the timer pointer explicitly.
Calculate the drive from the offset of the timer in the timer list.
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ming Lei <tom.leiming@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Geliang Tang <geliangtang@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/floppy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index a54183935aa1..eae484acfbbc 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -903,10 +903,14 @@ static void unlock_fdc(void) | |||
903 | } | 903 | } |
904 | 904 | ||
905 | /* switches the motor off after a given timeout */ | 905 | /* switches the motor off after a given timeout */ |
906 | static void motor_off_callback(unsigned long nr) | 906 | static void motor_off_callback(struct timer_list *t) |
907 | { | 907 | { |
908 | unsigned long nr = t - motor_off_timer; | ||
908 | unsigned char mask = ~(0x10 << UNIT(nr)); | 909 | unsigned char mask = ~(0x10 << UNIT(nr)); |
909 | 910 | ||
911 | if (WARN_ON_ONCE(nr >= N_DRIVE)) | ||
912 | return; | ||
913 | |||
910 | set_dor(FDC(nr), mask, 0); | 914 | set_dor(FDC(nr), mask, 0); |
911 | } | 915 | } |
912 | 916 | ||
@@ -3047,7 +3051,7 @@ static void raw_cmd_done(int flag) | |||
3047 | else | 3051 | else |
3048 | raw_cmd->flags &= ~FD_RAW_DISK_CHANGE; | 3052 | raw_cmd->flags &= ~FD_RAW_DISK_CHANGE; |
3049 | if (raw_cmd->flags & FD_RAW_NO_MOTOR_AFTER) | 3053 | if (raw_cmd->flags & FD_RAW_NO_MOTOR_AFTER) |
3050 | motor_off_callback(current_drive); | 3054 | motor_off_callback(&motor_off_timer[current_drive]); |
3051 | 3055 | ||
3052 | if (raw_cmd->next && | 3056 | if (raw_cmd->next && |
3053 | (!(raw_cmd->flags & FD_RAW_FAILURE) || | 3057 | (!(raw_cmd->flags & FD_RAW_FAILURE) || |
@@ -4542,7 +4546,7 @@ static int __init do_floppy_init(void) | |||
4542 | disks[drive]->fops = &floppy_fops; | 4546 | disks[drive]->fops = &floppy_fops; |
4543 | sprintf(disks[drive]->disk_name, "fd%d", drive); | 4547 | sprintf(disks[drive]->disk_name, "fd%d", drive); |
4544 | 4548 | ||
4545 | setup_timer(&motor_off_timer[drive], motor_off_callback, drive); | 4549 | timer_setup(&motor_off_timer[drive], motor_off_callback, 0); |
4546 | } | 4550 | } |
4547 | 4551 | ||
4548 | err = register_blkdev(FLOPPY_MAJOR, "fd"); | 4552 | err = register_blkdev(FLOPPY_MAJOR, "fd"); |