diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-17 18:32:27 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-11-14 22:11:57 -0500 |
commit | b5775a6ba373f1a6e41723ab54c8a4b0fb6f0f00 (patch) | |
tree | 4884c43b94990c26b69d7a31e5e8df15a997f7f7 | |
parent | 0e0cc9df86bc56e5d55a72e0adf530d6f7fe8628 (diff) |
block: swim3: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/swim3.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index 9f931f8f6b4c..e620e423102b 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -239,10 +239,10 @@ static unsigned short write_postamble[] = { | |||
239 | static void seek_track(struct floppy_state *fs, int n); | 239 | static void seek_track(struct floppy_state *fs, int n); |
240 | static void init_dma(struct dbdma_cmd *cp, int cmd, void *buf, int count); | 240 | static void init_dma(struct dbdma_cmd *cp, int cmd, void *buf, int count); |
241 | static void act(struct floppy_state *fs); | 241 | static void act(struct floppy_state *fs); |
242 | static void scan_timeout(unsigned long data); | 242 | static void scan_timeout(struct timer_list *t); |
243 | static void seek_timeout(unsigned long data); | 243 | static void seek_timeout(struct timer_list *t); |
244 | static void settle_timeout(unsigned long data); | 244 | static void settle_timeout(struct timer_list *t); |
245 | static void xfer_timeout(unsigned long data); | 245 | static void xfer_timeout(struct timer_list *t); |
246 | static irqreturn_t swim3_interrupt(int irq, void *dev_id); | 246 | static irqreturn_t swim3_interrupt(int irq, void *dev_id); |
247 | /*static void fd_dma_interrupt(int irq, void *dev_id);*/ | 247 | /*static void fd_dma_interrupt(int irq, void *dev_id);*/ |
248 | static int grab_drive(struct floppy_state *fs, enum swim_state state, | 248 | static int grab_drive(struct floppy_state *fs, enum swim_state state, |
@@ -392,13 +392,12 @@ static void do_fd_request(struct request_queue * q) | |||
392 | } | 392 | } |
393 | 393 | ||
394 | static void set_timeout(struct floppy_state *fs, int nticks, | 394 | static void set_timeout(struct floppy_state *fs, int nticks, |
395 | void (*proc)(unsigned long)) | 395 | void (*proc)(struct timer_list *t)) |
396 | { | 396 | { |
397 | if (fs->timeout_pending) | 397 | if (fs->timeout_pending) |
398 | del_timer(&fs->timeout); | 398 | del_timer(&fs->timeout); |
399 | fs->timeout.expires = jiffies + nticks; | 399 | fs->timeout.expires = jiffies + nticks; |
400 | fs->timeout.function = proc; | 400 | fs->timeout.function = (TIMER_FUNC_TYPE)proc; |
401 | fs->timeout.data = (unsigned long) fs; | ||
402 | add_timer(&fs->timeout); | 401 | add_timer(&fs->timeout); |
403 | fs->timeout_pending = 1; | 402 | fs->timeout_pending = 1; |
404 | } | 403 | } |
@@ -569,9 +568,9 @@ static void act(struct floppy_state *fs) | |||
569 | } | 568 | } |
570 | } | 569 | } |
571 | 570 | ||
572 | static void scan_timeout(unsigned long data) | 571 | static void scan_timeout(struct timer_list *t) |
573 | { | 572 | { |
574 | struct floppy_state *fs = (struct floppy_state *) data; | 573 | struct floppy_state *fs = from_timer(fs, t, timeout); |
575 | struct swim3 __iomem *sw = fs->swim3; | 574 | struct swim3 __iomem *sw = fs->swim3; |
576 | unsigned long flags; | 575 | unsigned long flags; |
577 | 576 | ||
@@ -594,9 +593,9 @@ static void scan_timeout(unsigned long data) | |||
594 | spin_unlock_irqrestore(&swim3_lock, flags); | 593 | spin_unlock_irqrestore(&swim3_lock, flags); |
595 | } | 594 | } |
596 | 595 | ||
597 | static void seek_timeout(unsigned long data) | 596 | static void seek_timeout(struct timer_list *t) |
598 | { | 597 | { |
599 | struct floppy_state *fs = (struct floppy_state *) data; | 598 | struct floppy_state *fs = from_timer(fs, t, timeout); |
600 | struct swim3 __iomem *sw = fs->swim3; | 599 | struct swim3 __iomem *sw = fs->swim3; |
601 | unsigned long flags; | 600 | unsigned long flags; |
602 | 601 | ||
@@ -614,9 +613,9 @@ static void seek_timeout(unsigned long data) | |||
614 | spin_unlock_irqrestore(&swim3_lock, flags); | 613 | spin_unlock_irqrestore(&swim3_lock, flags); |
615 | } | 614 | } |
616 | 615 | ||
617 | static void settle_timeout(unsigned long data) | 616 | static void settle_timeout(struct timer_list *t) |
618 | { | 617 | { |
619 | struct floppy_state *fs = (struct floppy_state *) data; | 618 | struct floppy_state *fs = from_timer(fs, t, timeout); |
620 | struct swim3 __iomem *sw = fs->swim3; | 619 | struct swim3 __iomem *sw = fs->swim3; |
621 | unsigned long flags; | 620 | unsigned long flags; |
622 | 621 | ||
@@ -644,9 +643,9 @@ static void settle_timeout(unsigned long data) | |||
644 | spin_unlock_irqrestore(&swim3_lock, flags); | 643 | spin_unlock_irqrestore(&swim3_lock, flags); |
645 | } | 644 | } |
646 | 645 | ||
647 | static void xfer_timeout(unsigned long data) | 646 | static void xfer_timeout(struct timer_list *t) |
648 | { | 647 | { |
649 | struct floppy_state *fs = (struct floppy_state *) data; | 648 | struct floppy_state *fs = from_timer(fs, t, timeout); |
650 | struct swim3 __iomem *sw = fs->swim3; | 649 | struct swim3 __iomem *sw = fs->swim3; |
651 | struct dbdma_regs __iomem *dr = fs->dma; | 650 | struct dbdma_regs __iomem *dr = fs->dma; |
652 | unsigned long flags; | 651 | unsigned long flags; |
@@ -1182,7 +1181,7 @@ static int swim3_add_device(struct macio_dev *mdev, int index) | |||
1182 | return -EBUSY; | 1181 | return -EBUSY; |
1183 | } | 1182 | } |
1184 | 1183 | ||
1185 | init_timer(&fs->timeout); | 1184 | timer_setup(&fs->timeout, NULL, 0); |
1186 | 1185 | ||
1187 | swim3_info("SWIM3 floppy controller %s\n", | 1186 | swim3_info("SWIM3 floppy controller %s\n", |
1188 | mdev->media_bay ? "in media bay" : ""); | 1187 | mdev->media_bay ? "in media bay" : ""); |