diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-22 17:43:33 -0400 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2017-11-02 18:50:50 -0400 |
commit | 6243d38fc0775e9dc1a38835aef55efb273ac4d5 (patch) | |
tree | ae5611bfdced41d58938485505753f21abdeeaea | |
parent | 0788f28575801dadbddbfbe11e0bcc8174fffee3 (diff) |
drivers/memstick: 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: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
-rw-r--r-- | drivers/memstick/host/jmb38x_ms.c | 10 | ||||
-rw-r--r-- | drivers/memstick/host/r592.c | 7 | ||||
-rw-r--r-- | drivers/memstick/host/tifm_ms.c | 6 |
3 files changed, 12 insertions, 11 deletions
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c index 48db922075e2..bcdca9fbef51 100644 --- a/drivers/memstick/host/jmb38x_ms.c +++ b/drivers/memstick/host/jmb38x_ms.c | |||
@@ -59,6 +59,7 @@ struct jmb38x_ms_host { | |||
59 | unsigned int block_pos; | 59 | unsigned int block_pos; |
60 | unsigned long timeout_jiffies; | 60 | unsigned long timeout_jiffies; |
61 | struct timer_list timer; | 61 | struct timer_list timer; |
62 | struct memstick_host *msh; | ||
62 | struct memstick_request *req; | 63 | struct memstick_request *req; |
63 | unsigned char cmd_flags; | 64 | unsigned char cmd_flags; |
64 | unsigned char io_pos; | 65 | unsigned char io_pos; |
@@ -592,10 +593,10 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id) | |||
592 | return IRQ_HANDLED; | 593 | return IRQ_HANDLED; |
593 | } | 594 | } |
594 | 595 | ||
595 | static void jmb38x_ms_abort(unsigned long data) | 596 | static void jmb38x_ms_abort(struct timer_list *t) |
596 | { | 597 | { |
597 | struct memstick_host *msh = (struct memstick_host *)data; | 598 | struct jmb38x_ms_host *host = from_timer(host, t, timer); |
598 | struct jmb38x_ms_host *host = memstick_priv(msh); | 599 | struct memstick_host *msh = host->msh; |
599 | unsigned long flags; | 600 | unsigned long flags; |
600 | 601 | ||
601 | dev_dbg(&host->chip->pdev->dev, "abort\n"); | 602 | dev_dbg(&host->chip->pdev->dev, "abort\n"); |
@@ -878,6 +879,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | |||
878 | return NULL; | 879 | return NULL; |
879 | 880 | ||
880 | host = memstick_priv(msh); | 881 | host = memstick_priv(msh); |
882 | host->msh = msh; | ||
881 | host->chip = jm; | 883 | host->chip = jm; |
882 | host->addr = ioremap(pci_resource_start(jm->pdev, cnt), | 884 | host->addr = ioremap(pci_resource_start(jm->pdev, cnt), |
883 | pci_resource_len(jm->pdev, cnt)); | 885 | pci_resource_len(jm->pdev, cnt)); |
@@ -897,7 +899,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt) | |||
897 | 899 | ||
898 | msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; | 900 | msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; |
899 | 901 | ||
900 | setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); | 902 | timer_setup(&host->timer, jmb38x_ms_abort, 0); |
901 | 903 | ||
902 | if (!request_irq(host->irq, jmb38x_ms_isr, IRQF_SHARED, host->host_id, | 904 | if (!request_irq(host->irq, jmb38x_ms_isr, IRQF_SHARED, host->host_id, |
903 | msh)) | 905 | msh)) |
diff --git a/drivers/memstick/host/r592.c b/drivers/memstick/host/r592.c index d5cfb503b9d6..627d6e62fe31 100644 --- a/drivers/memstick/host/r592.c +++ b/drivers/memstick/host/r592.c | |||
@@ -616,9 +616,9 @@ static void r592_update_card_detect(struct r592_device *dev) | |||
616 | } | 616 | } |
617 | 617 | ||
618 | /* Timer routine that fires 1 second after last card detection event, */ | 618 | /* Timer routine that fires 1 second after last card detection event, */ |
619 | static void r592_detect_timer(long unsigned int data) | 619 | static void r592_detect_timer(struct timer_list *t) |
620 | { | 620 | { |
621 | struct r592_device *dev = (struct r592_device *)data; | 621 | struct r592_device *dev = from_timer(dev, t, detect_timer); |
622 | r592_update_card_detect(dev); | 622 | r592_update_card_detect(dev); |
623 | memstick_detect_change(dev->host); | 623 | memstick_detect_change(dev->host); |
624 | } | 624 | } |
@@ -770,8 +770,7 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
770 | spin_lock_init(&dev->io_thread_lock); | 770 | spin_lock_init(&dev->io_thread_lock); |
771 | init_completion(&dev->dma_done); | 771 | init_completion(&dev->dma_done); |
772 | INIT_KFIFO(dev->pio_fifo); | 772 | INIT_KFIFO(dev->pio_fifo); |
773 | setup_timer(&dev->detect_timer, | 773 | timer_setup(&dev->detect_timer, r592_detect_timer, 0); |
774 | r592_detect_timer, (long unsigned int)dev); | ||
775 | 774 | ||
776 | /* Host initialization */ | 775 | /* Host initialization */ |
777 | host->caps = MEMSTICK_CAP_PAR4; | 776 | host->caps = MEMSTICK_CAP_PAR4; |
diff --git a/drivers/memstick/host/tifm_ms.c b/drivers/memstick/host/tifm_ms.c index 7bafa72f8f57..bed205849d02 100644 --- a/drivers/memstick/host/tifm_ms.c +++ b/drivers/memstick/host/tifm_ms.c | |||
@@ -538,9 +538,9 @@ static int tifm_ms_set_param(struct memstick_host *msh, | |||
538 | return 0; | 538 | return 0; |
539 | } | 539 | } |
540 | 540 | ||
541 | static void tifm_ms_abort(unsigned long data) | 541 | static void tifm_ms_abort(struct timer_list *t) |
542 | { | 542 | { |
543 | struct tifm_ms *host = (struct tifm_ms *)data; | 543 | struct tifm_ms *host = from_timer(host, t, timer); |
544 | 544 | ||
545 | dev_dbg(&host->dev->dev, "status %x\n", | 545 | dev_dbg(&host->dev->dev, "status %x\n", |
546 | readl(host->dev->addr + SOCK_MS_STATUS)); | 546 | readl(host->dev->addr + SOCK_MS_STATUS)); |
@@ -575,7 +575,7 @@ static int tifm_ms_probe(struct tifm_dev *sock) | |||
575 | host->dev = sock; | 575 | host->dev = sock; |
576 | host->timeout_jiffies = msecs_to_jiffies(1000); | 576 | host->timeout_jiffies = msecs_to_jiffies(1000); |
577 | 577 | ||
578 | setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host); | 578 | timer_setup(&host->timer, tifm_ms_abort, 0); |
579 | tasklet_init(&host->notify, tifm_ms_req_tasklet, (unsigned long)msh); | 579 | tasklet_init(&host->notify, tifm_ms_req_tasklet, (unsigned long)msh); |
580 | 580 | ||
581 | msh->request = tifm_ms_submit_req; | 581 | msh->request = tifm_ms_submit_req; |