Commit 6243d38f authored by Kees Cook's avatar Kees Cook

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: default avatarKees Cook <keescook@chromium.org>
parent 0788f285
...@@ -59,6 +59,7 @@ struct jmb38x_ms_host { ...@@ -59,6 +59,7 @@ struct jmb38x_ms_host {
unsigned int block_pos; unsigned int block_pos;
unsigned long timeout_jiffies; unsigned long timeout_jiffies;
struct timer_list timer; struct timer_list timer;
struct memstick_host *msh;
struct memstick_request *req; struct memstick_request *req;
unsigned char cmd_flags; unsigned char cmd_flags;
unsigned char io_pos; unsigned char io_pos;
...@@ -592,10 +593,10 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id) ...@@ -592,10 +593,10 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void jmb38x_ms_abort(unsigned long data) static void jmb38x_ms_abort(struct timer_list *t)
{ {
struct memstick_host *msh = (struct memstick_host *)data; struct jmb38x_ms_host *host = from_timer(host, t, timer);
struct jmb38x_ms_host *host = memstick_priv(msh); struct memstick_host *msh = host->msh;
unsigned long flags; unsigned long flags;
dev_dbg(&host->chip->pdev->dev, "abort\n"); 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,6 +879,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
return NULL; return NULL;
host = memstick_priv(msh); host = memstick_priv(msh);
host->msh = msh;
host->chip = jm; host->chip = jm;
host->addr = ioremap(pci_resource_start(jm->pdev, cnt), host->addr = ioremap(pci_resource_start(jm->pdev, cnt),
pci_resource_len(jm->pdev, cnt)); 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,7 +899,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8; msh->caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8;
setup_timer(&host->timer, jmb38x_ms_abort, (unsigned long)msh); timer_setup(&host->timer, jmb38x_ms_abort, 0);
if (!request_irq(host->irq, jmb38x_ms_isr, IRQF_SHARED, host->host_id, if (!request_irq(host->irq, jmb38x_ms_isr, IRQF_SHARED, host->host_id,
msh)) msh))
......
...@@ -616,9 +616,9 @@ static void r592_update_card_detect(struct r592_device *dev) ...@@ -616,9 +616,9 @@ static void r592_update_card_detect(struct r592_device *dev)
} }
/* Timer routine that fires 1 second after last card detection event, */ /* Timer routine that fires 1 second after last card detection event, */
static void r592_detect_timer(long unsigned int data) static void r592_detect_timer(struct timer_list *t)
{ {
struct r592_device *dev = (struct r592_device *)data; struct r592_device *dev = from_timer(dev, t, detect_timer);
r592_update_card_detect(dev); r592_update_card_detect(dev);
memstick_detect_change(dev->host); memstick_detect_change(dev->host);
} }
...@@ -770,8 +770,7 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -770,8 +770,7 @@ static int r592_probe(struct pci_dev *pdev, const struct pci_device_id *id)
spin_lock_init(&dev->io_thread_lock); spin_lock_init(&dev->io_thread_lock);
init_completion(&dev->dma_done); init_completion(&dev->dma_done);
INIT_KFIFO(dev->pio_fifo); INIT_KFIFO(dev->pio_fifo);
setup_timer(&dev->detect_timer, timer_setup(&dev->detect_timer, r592_detect_timer, 0);
r592_detect_timer, (long unsigned int)dev);
/* Host initialization */ /* Host initialization */
host->caps = MEMSTICK_CAP_PAR4; host->caps = MEMSTICK_CAP_PAR4;
......
...@@ -538,9 +538,9 @@ static int tifm_ms_set_param(struct memstick_host *msh, ...@@ -538,9 +538,9 @@ static int tifm_ms_set_param(struct memstick_host *msh,
return 0; return 0;
} }
static void tifm_ms_abort(unsigned long data) static void tifm_ms_abort(struct timer_list *t)
{ {
struct tifm_ms *host = (struct tifm_ms *)data; struct tifm_ms *host = from_timer(host, t, timer);
dev_dbg(&host->dev->dev, "status %x\n", dev_dbg(&host->dev->dev, "status %x\n",
readl(host->dev->addr + SOCK_MS_STATUS)); readl(host->dev->addr + SOCK_MS_STATUS));
...@@ -575,7 +575,7 @@ static int tifm_ms_probe(struct tifm_dev *sock) ...@@ -575,7 +575,7 @@ static int tifm_ms_probe(struct tifm_dev *sock)
host->dev = sock; host->dev = sock;
host->timeout_jiffies = msecs_to_jiffies(1000); host->timeout_jiffies = msecs_to_jiffies(1000);
setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host); timer_setup(&host->timer, tifm_ms_abort, 0);
tasklet_init(&host->notify, tifm_ms_req_tasklet, (unsigned long)msh); tasklet_init(&host->notify, tifm_ms_req_tasklet, (unsigned long)msh);
msh->request = tifm_ms_submit_req; msh->request = tifm_ms_submit_req;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment