Commit f34d8d50 authored by Kees Cook's avatar Kees Cook

crypto: 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: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Lars Persson <lars.persson@axis.com>
Cc: Niklas Cassel <niklas.cassel@axis.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jamie Iles <jamie@jamieiles.com>
Cc: linux-arm-kernel@axis.com
Cc: linux-crypto@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Acked-by: default avatarJamie Iles <jamie@jamieiles.com>
Acked-by: Lars Persson <lars.persson@axis.com> # for axis
parent 439dc05f
...@@ -2074,9 +2074,9 @@ static void artpec6_crypto_process_queue(struct artpec6_crypto *ac) ...@@ -2074,9 +2074,9 @@ static void artpec6_crypto_process_queue(struct artpec6_crypto *ac)
del_timer(&ac->timer); del_timer(&ac->timer);
} }
static void artpec6_crypto_timeout(unsigned long data) static void artpec6_crypto_timeout(struct timer_list *t)
{ {
struct artpec6_crypto *ac = (struct artpec6_crypto *) data; struct artpec6_crypto *ac = from_timer(ac, t, timer);
dev_info_ratelimited(artpec6_crypto_dev, "timeout\n"); dev_info_ratelimited(artpec6_crypto_dev, "timeout\n");
...@@ -3063,7 +3063,7 @@ static int artpec6_crypto_probe(struct platform_device *pdev) ...@@ -3063,7 +3063,7 @@ static int artpec6_crypto_probe(struct platform_device *pdev)
spin_lock_init(&ac->queue_lock); spin_lock_init(&ac->queue_lock);
INIT_LIST_HEAD(&ac->queue); INIT_LIST_HEAD(&ac->queue);
INIT_LIST_HEAD(&ac->pending); INIT_LIST_HEAD(&ac->pending);
setup_timer(&ac->timer, artpec6_crypto_timeout, (unsigned long) ac); timer_setup(&ac->timer, artpec6_crypto_timeout, 0);
ac->base = base; ac->base = base;
......
...@@ -149,7 +149,7 @@ struct mv_req_hash_ctx { ...@@ -149,7 +149,7 @@ struct mv_req_hash_ctx {
int count_add; int count_add;
}; };
static void mv_completion_timer_callback(unsigned long unused) static void mv_completion_timer_callback(struct timer_list *unused)
{ {
int active = readl(cpg->reg + SEC_ACCEL_CMD) & SEC_CMD_EN_SEC_ACCL0; int active = readl(cpg->reg + SEC_ACCEL_CMD) & SEC_CMD_EN_SEC_ACCL0;
...@@ -167,7 +167,7 @@ static void mv_completion_timer_callback(unsigned long unused) ...@@ -167,7 +167,7 @@ static void mv_completion_timer_callback(unsigned long unused)
static void mv_setup_timer(void) static void mv_setup_timer(void)
{ {
setup_timer(&cpg->completion_timer, &mv_completion_timer_callback, 0); timer_setup(&cpg->completion_timer, mv_completion_timer_callback, 0);
mod_timer(&cpg->completion_timer, mod_timer(&cpg->completion_timer,
jiffies + msecs_to_jiffies(MV_CESA_EXPIRE)); jiffies + msecs_to_jiffies(MV_CESA_EXPIRE));
} }
......
...@@ -1125,9 +1125,9 @@ static irqreturn_t spacc_spacc_irq(int irq, void *dev) ...@@ -1125,9 +1125,9 @@ static irqreturn_t spacc_spacc_irq(int irq, void *dev)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void spacc_packet_timeout(unsigned long data) static void spacc_packet_timeout(struct timer_list *t)
{ {
struct spacc_engine *engine = (struct spacc_engine *)data; struct spacc_engine *engine = from_timer(engine, t, packet_timeout);
spacc_process_done(engine); spacc_process_done(engine);
} }
...@@ -1714,8 +1714,7 @@ static int spacc_probe(struct platform_device *pdev) ...@@ -1714,8 +1714,7 @@ static int spacc_probe(struct platform_device *pdev)
writel(SPA_IRQ_EN_STAT_EN | SPA_IRQ_EN_GLBL_EN, writel(SPA_IRQ_EN_STAT_EN | SPA_IRQ_EN_GLBL_EN,
engine->regs + SPA_IRQ_EN_REG_OFFSET); engine->regs + SPA_IRQ_EN_REG_OFFSET);
setup_timer(&engine->packet_timeout, spacc_packet_timeout, timer_setup(&engine->packet_timeout, spacc_packet_timeout, 0);
(unsigned long)engine);
INIT_LIST_HEAD(&engine->pending); INIT_LIST_HEAD(&engine->pending);
INIT_LIST_HEAD(&engine->completed); INIT_LIST_HEAD(&engine->completed);
......
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