Commit 846d0c6f authored by Kees Cook's avatar Kees Cook Committed by Heiko Carstens

s390/cio: 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: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent cb9f780a
...@@ -142,7 +142,7 @@ static void io_subchannel_shutdown(struct subchannel *); ...@@ -142,7 +142,7 @@ static void io_subchannel_shutdown(struct subchannel *);
static int io_subchannel_sch_event(struct subchannel *, int); static int io_subchannel_sch_event(struct subchannel *, int);
static int io_subchannel_chp_event(struct subchannel *, struct chp_link *, static int io_subchannel_chp_event(struct subchannel *, struct chp_link *,
int); int);
static void recovery_func(unsigned long data); static void recovery_func(struct timer_list *unused);
static struct css_device_id io_subchannel_ids[] = { static struct css_device_id io_subchannel_ids[] = {
{ .match_flags = 0x1, .type = SUBCHANNEL_TYPE_IO, }, { .match_flags = 0x1, .type = SUBCHANNEL_TYPE_IO, },
...@@ -194,7 +194,7 @@ int __init io_subchannel_init(void) ...@@ -194,7 +194,7 @@ int __init io_subchannel_init(void)
{ {
int ret; int ret;
setup_timer(&recovery_timer, recovery_func, 0); timer_setup(&recovery_timer, recovery_func, 0);
ret = bus_register(&ccw_bus_type); ret = bus_register(&ccw_bus_type);
if (ret) if (ret)
return ret; return ret;
...@@ -726,7 +726,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch, ...@@ -726,7 +726,7 @@ static int io_subchannel_initialize_dev(struct subchannel *sch,
INIT_WORK(&priv->todo_work, ccw_device_todo); INIT_WORK(&priv->todo_work, ccw_device_todo);
INIT_LIST_HEAD(&priv->cmb_list); INIT_LIST_HEAD(&priv->cmb_list);
init_waitqueue_head(&priv->wait_q); init_waitqueue_head(&priv->wait_q);
init_timer(&priv->timer); timer_setup(&priv->timer, ccw_device_timeout, 0);
atomic_set(&priv->onoff, 0); atomic_set(&priv->onoff, 0);
cdev->ccwlock = sch->lock; cdev->ccwlock = sch->lock;
...@@ -1271,7 +1271,7 @@ static void recovery_work_func(struct work_struct *unused) ...@@ -1271,7 +1271,7 @@ static void recovery_work_func(struct work_struct *unused)
static DECLARE_WORK(recovery_work, recovery_work_func); static DECLARE_WORK(recovery_work, recovery_work_func);
static void recovery_func(unsigned long data) static void recovery_func(struct timer_list *unused)
{ {
/* /*
* We can't do our recovery in softirq context and it's not * We can't do our recovery in softirq context and it's not
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/timer.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/kernel_stat.h> #include <linux/kernel_stat.h>
...@@ -134,6 +135,7 @@ int ccw_device_notify(struct ccw_device *, int); ...@@ -134,6 +135,7 @@ int ccw_device_notify(struct ccw_device *, int);
void ccw_device_set_disconnected(struct ccw_device *cdev); void ccw_device_set_disconnected(struct ccw_device *cdev);
void ccw_device_set_notoper(struct ccw_device *cdev); void ccw_device_set_notoper(struct ccw_device *cdev);
void ccw_device_timeout(struct timer_list *t);
void ccw_device_set_timeout(struct ccw_device *, int); void ccw_device_set_timeout(struct ccw_device *, int);
void ccw_device_schedule_recovery(void); void ccw_device_schedule_recovery(void);
......
...@@ -91,12 +91,12 @@ static void ccw_timeout_log(struct ccw_device *cdev) ...@@ -91,12 +91,12 @@ static void ccw_timeout_log(struct ccw_device *cdev)
/* /*
* Timeout function. It just triggers a DEV_EVENT_TIMEOUT. * Timeout function. It just triggers a DEV_EVENT_TIMEOUT.
*/ */
static void void
ccw_device_timeout(unsigned long data) ccw_device_timeout(struct timer_list *t)
{ {
struct ccw_device *cdev; struct ccw_device_private *priv = from_timer(priv, t, timer);
struct ccw_device *cdev = priv->cdev;
cdev = (struct ccw_device *) data;
spin_lock_irq(cdev->ccwlock); spin_lock_irq(cdev->ccwlock);
if (timeout_log_enabled) if (timeout_log_enabled)
ccw_timeout_log(cdev); ccw_timeout_log(cdev);
...@@ -118,8 +118,6 @@ ccw_device_set_timeout(struct ccw_device *cdev, int expires) ...@@ -118,8 +118,6 @@ ccw_device_set_timeout(struct ccw_device *cdev, int expires)
if (mod_timer(&cdev->private->timer, jiffies + expires)) if (mod_timer(&cdev->private->timer, jiffies + expires))
return; return;
} }
cdev->private->timer.function = ccw_device_timeout;
cdev->private->timer.data = (unsigned long) cdev;
cdev->private->timer.expires = jiffies + expires; cdev->private->timer.expires = jiffies + expires;
add_timer(&cdev->private->timer); add_timer(&cdev->private->timer);
} }
......
...@@ -94,9 +94,10 @@ static int eadm_subchannel_clear(struct subchannel *sch) ...@@ -94,9 +94,10 @@ static int eadm_subchannel_clear(struct subchannel *sch)
return 0; return 0;
} }
static void eadm_subchannel_timeout(unsigned long data) static void eadm_subchannel_timeout(struct timer_list *t)
{ {
struct subchannel *sch = (struct subchannel *) data; struct eadm_private *private = from_timer(private, t, timer);
struct subchannel *sch = private->sch;
spin_lock_irq(sch->lock); spin_lock_irq(sch->lock);
EADM_LOG(1, "timeout"); EADM_LOG(1, "timeout");
...@@ -118,8 +119,6 @@ static void eadm_subchannel_set_timeout(struct subchannel *sch, int expires) ...@@ -118,8 +119,6 @@ static void eadm_subchannel_set_timeout(struct subchannel *sch, int expires)
if (mod_timer(&private->timer, jiffies + expires)) if (mod_timer(&private->timer, jiffies + expires))
return; return;
} }
private->timer.function = eadm_subchannel_timeout;
private->timer.data = (unsigned long) sch;
private->timer.expires = jiffies + expires; private->timer.expires = jiffies + expires;
add_timer(&private->timer); add_timer(&private->timer);
} }
...@@ -224,7 +223,7 @@ static int eadm_subchannel_probe(struct subchannel *sch) ...@@ -224,7 +223,7 @@ static int eadm_subchannel_probe(struct subchannel *sch)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&private->head); INIT_LIST_HEAD(&private->head);
init_timer(&private->timer); timer_setup(&private->timer, eadm_subchannel_timeout, 0);
spin_lock_irq(sch->lock); spin_lock_irq(sch->lock);
set_eadm_private(sch, private); set_eadm_private(sch, private);
......
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