Commit b3fe565b authored by Thomas Gleixner's avatar Thomas Gleixner

Merge tag 'timers-conversion-next5' of...

Merge tag 'timers-conversion-next5' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into timers/core

Pull the 5th batch of timer conversions from Kees Cook

 - qla2xxx patches have passed testing
 - ipvs patches have been Acked
 - prepare for more tree-wide DEFINE_TIMER() changes
parents 1c10bbee 3653bc95
...@@ -206,8 +206,8 @@ int qla24xx_async_abort_cmd(srb_t *); ...@@ -206,8 +206,8 @@ int qla24xx_async_abort_cmd(srb_t *);
*/ */
extern struct scsi_host_template qla2xxx_driver_template; extern struct scsi_host_template qla2xxx_driver_template;
extern struct scsi_transport_template *qla2xxx_transport_vport_template; extern struct scsi_transport_template *qla2xxx_transport_vport_template;
extern void qla2x00_timer(scsi_qla_host_t *); extern void qla2x00_timer(struct timer_list *);
extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long); extern void qla2x00_start_timer(scsi_qla_host_t *, unsigned long);
extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *); extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *);
extern int qla24xx_disable_vp (scsi_qla_host_t *); extern int qla24xx_disable_vp (scsi_qla_host_t *);
extern int qla24xx_enable_vp (scsi_qla_host_t *); extern int qla24xx_enable_vp (scsi_qla_host_t *);
...@@ -753,7 +753,7 @@ extern int qla82xx_restart_isp(scsi_qla_host_t *); ...@@ -753,7 +753,7 @@ extern int qla82xx_restart_isp(scsi_qla_host_t *);
/* IOCB related functions */ /* IOCB related functions */
extern int qla82xx_start_scsi(srb_t *); extern int qla82xx_start_scsi(srb_t *);
extern void qla2x00_sp_free(void *); extern void qla2x00_sp_free(void *);
extern void qla2x00_sp_timeout(unsigned long); extern void qla2x00_sp_timeout(struct timer_list *);
extern void qla2x00_bsg_job_done(void *, int); extern void qla2x00_bsg_job_done(void *, int);
extern void qla2x00_bsg_sp_free(void *); extern void qla2x00_bsg_sp_free(void *);
extern void qla2x00_start_iocbs(struct scsi_qla_host *, struct req_que *); extern void qla2x00_start_iocbs(struct scsi_qla_host *, struct req_que *);
......
...@@ -45,9 +45,9 @@ static void qla24xx_handle_prli_done_event(struct scsi_qla_host *, ...@@ -45,9 +45,9 @@ static void qla24xx_handle_prli_done_event(struct scsi_qla_host *,
/* SRB Extensions ---------------------------------------------------------- */ /* SRB Extensions ---------------------------------------------------------- */
void void
qla2x00_sp_timeout(unsigned long __data) qla2x00_sp_timeout(struct timer_list *t)
{ {
srb_t *sp = (srb_t *)__data; srb_t *sp = from_timer(sp, t, u.iocb_cmd.timer);
struct srb_iocb *iocb; struct srb_iocb *iocb;
scsi_qla_host_t *vha = sp->vha; scsi_qla_host_t *vha = sp->vha;
struct req_que *req; struct req_que *req;
......
...@@ -269,10 +269,8 @@ qla2x00_rel_sp(srb_t *sp) ...@@ -269,10 +269,8 @@ qla2x00_rel_sp(srb_t *sp)
static inline void static inline void
qla2x00_init_timer(srb_t *sp, unsigned long tmo) qla2x00_init_timer(srb_t *sp, unsigned long tmo)
{ {
init_timer(&sp->u.iocb_cmd.timer); timer_setup(&sp->u.iocb_cmd.timer, qla2x00_sp_timeout, 0);
sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ; sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
sp->u.iocb_cmd.timer.data = (unsigned long)sp;
sp->u.iocb_cmd.timer.function = qla2x00_sp_timeout;
add_timer(&sp->u.iocb_cmd.timer); add_timer(&sp->u.iocb_cmd.timer);
sp->free = qla2x00_sp_free; sp->free = qla2x00_sp_free;
if (IS_QLAFX00(sp->vha->hw) && (sp->type == SRB_FXIOCB_DCMD)) if (IS_QLAFX00(sp->vha->hw) && (sp->type == SRB_FXIOCB_DCMD))
......
...@@ -487,7 +487,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport) ...@@ -487,7 +487,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
atomic_set(&vha->loop_state, LOOP_DOWN); atomic_set(&vha->loop_state, LOOP_DOWN);
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL); qla2x00_start_timer(vha, WATCH_INTERVAL);
vha->req = base_vha->req; vha->req = base_vha->req;
host->can_queue = base_vha->req->length + 128; host->can_queue = base_vha->req->length + 128;
......
...@@ -330,12 +330,10 @@ struct scsi_transport_template *qla2xxx_transport_vport_template = NULL; ...@@ -330,12 +330,10 @@ struct scsi_transport_template *qla2xxx_transport_vport_template = NULL;
*/ */
__inline__ void __inline__ void
qla2x00_start_timer(scsi_qla_host_t *vha, void *func, unsigned long interval) qla2x00_start_timer(scsi_qla_host_t *vha, unsigned long interval)
{ {
init_timer(&vha->timer); timer_setup(&vha->timer, qla2x00_timer, 0);
vha->timer.expires = jiffies + interval * HZ; vha->timer.expires = jiffies + interval * HZ;
vha->timer.data = (unsigned long)vha;
vha->timer.function = (void (*)(unsigned long))func;
add_timer(&vha->timer); add_timer(&vha->timer);
vha->timer_active = 1; vha->timer_active = 1;
} }
...@@ -3245,7 +3243,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3245,7 +3243,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
base_vha->host->irq = ha->pdev->irq; base_vha->host->irq = ha->pdev->irq;
/* Initialized the timer */ /* Initialized the timer */
qla2x00_start_timer(base_vha, qla2x00_timer, WATCH_INTERVAL); qla2x00_start_timer(base_vha, WATCH_INTERVAL);
ql_dbg(ql_dbg_init, base_vha, 0x00ef, ql_dbg(ql_dbg_init, base_vha, 0x00ef,
"Started qla2x00_timer with " "Started qla2x00_timer with "
"interval=%d.\n", WATCH_INTERVAL); "interval=%d.\n", WATCH_INTERVAL);
...@@ -5994,8 +5992,9 @@ qla2x00_rst_aen(scsi_qla_host_t *vha) ...@@ -5994,8 +5992,9 @@ qla2x00_rst_aen(scsi_qla_host_t *vha)
* Context: Interrupt * Context: Interrupt
***************************************************************************/ ***************************************************************************/
void void
qla2x00_timer(scsi_qla_host_t *vha) qla2x00_timer(struct timer_list *t)
{ {
scsi_qla_host_t *vha = from_timer(vha, t, timer);
unsigned long cpu_flags = 0; unsigned long cpu_flags = 0;
int start_dpc = 0; int start_dpc = 0;
int index; int index;
......
...@@ -63,6 +63,9 @@ struct timer_list { ...@@ -63,6 +63,9 @@ struct timer_list {
#define TIMER_TRACE_FLAGMASK (TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE) #define TIMER_TRACE_FLAGMASK (TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
#define TIMER_DATA_TYPE unsigned long
#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
#define __TIMER_INITIALIZER(_function, _data, _flags) { \ #define __TIMER_INITIALIZER(_function, _data, _flags) { \
.entry = { .next = TIMER_ENTRY_STATIC }, \ .entry = { .next = TIMER_ENTRY_STATIC }, \
.function = (_function), \ .function = (_function), \
...@@ -74,7 +77,7 @@ struct timer_list { ...@@ -74,7 +77,7 @@ struct timer_list {
#define DEFINE_TIMER(_name, _function) \ #define DEFINE_TIMER(_name, _function) \
struct timer_list _name = \ struct timer_list _name = \
__TIMER_INITIALIZER(_function, 0, 0) __TIMER_INITIALIZER((TIMER_FUNC_TYPE)_function, 0, 0)
void init_timer_key(struct timer_list *timer, unsigned int flags, void init_timer_key(struct timer_list *timer, unsigned int flags,
const char *name, struct lock_class_key *key); const char *name, struct lock_class_key *key);
...@@ -147,9 +150,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer, ...@@ -147,9 +150,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
#define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \ #define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \
__setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED) __setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED)
#define TIMER_DATA_TYPE unsigned long
#define TIMER_FUNC_TYPE void (*)(TIMER_DATA_TYPE)
#ifndef CONFIG_LOCKDEP #ifndef CONFIG_LOCKDEP
static inline void timer_setup(struct timer_list *timer, static inline void timer_setup(struct timer_list *timer,
void (*callback)(struct timer_list *), void (*callback)(struct timer_list *),
......
...@@ -104,7 +104,7 @@ static inline void ct_write_unlock_bh(unsigned int key) ...@@ -104,7 +104,7 @@ static inline void ct_write_unlock_bh(unsigned int key)
spin_unlock_bh(&__ip_vs_conntbl_lock_array[key&CT_LOCKARRAY_MASK].l); spin_unlock_bh(&__ip_vs_conntbl_lock_array[key&CT_LOCKARRAY_MASK].l);
} }
static void ip_vs_conn_expire(unsigned long data); static void ip_vs_conn_expire(struct timer_list *t);
/* /*
* Returns hash value for IPVS connection entry * Returns hash value for IPVS connection entry
...@@ -457,7 +457,7 @@ EXPORT_SYMBOL_GPL(ip_vs_conn_out_get_proto); ...@@ -457,7 +457,7 @@ EXPORT_SYMBOL_GPL(ip_vs_conn_out_get_proto);
static void __ip_vs_conn_put_notimer(struct ip_vs_conn *cp) static void __ip_vs_conn_put_notimer(struct ip_vs_conn *cp)
{ {
__ip_vs_conn_put(cp); __ip_vs_conn_put(cp);
ip_vs_conn_expire((unsigned long)cp); ip_vs_conn_expire(&cp->timer);
} }
/* /*
...@@ -817,9 +817,9 @@ static void ip_vs_conn_rcu_free(struct rcu_head *head) ...@@ -817,9 +817,9 @@ static void ip_vs_conn_rcu_free(struct rcu_head *head)
kmem_cache_free(ip_vs_conn_cachep, cp); kmem_cache_free(ip_vs_conn_cachep, cp);
} }
static void ip_vs_conn_expire(unsigned long data) static void ip_vs_conn_expire(struct timer_list *t)
{ {
struct ip_vs_conn *cp = (struct ip_vs_conn *)data; struct ip_vs_conn *cp = from_timer(cp, t, timer);
struct netns_ipvs *ipvs = cp->ipvs; struct netns_ipvs *ipvs = cp->ipvs;
/* /*
...@@ -909,7 +909,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af, ...@@ -909,7 +909,7 @@ ip_vs_conn_new(const struct ip_vs_conn_param *p, int dest_af,
} }
INIT_HLIST_NODE(&cp->c_list); INIT_HLIST_NODE(&cp->c_list);
setup_timer(&cp->timer, ip_vs_conn_expire, (unsigned long)cp); timer_setup(&cp->timer, ip_vs_conn_expire, 0);
cp->ipvs = ipvs; cp->ipvs = ipvs;
cp->af = p->af; cp->af = p->af;
cp->daf = dest_af; cp->daf = dest_af;
......
...@@ -1146,9 +1146,9 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest) ...@@ -1146,9 +1146,9 @@ ip_vs_del_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest)
return 0; return 0;
} }
static void ip_vs_dest_trash_expire(unsigned long data) static void ip_vs_dest_trash_expire(struct timer_list *t)
{ {
struct netns_ipvs *ipvs = (struct netns_ipvs *)data; struct netns_ipvs *ipvs = from_timer(ipvs, t, dest_trash_timer);
struct ip_vs_dest *dest, *next; struct ip_vs_dest *dest, *next;
unsigned long now = jiffies; unsigned long now = jiffies;
...@@ -4019,8 +4019,7 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs) ...@@ -4019,8 +4019,7 @@ int __net_init ip_vs_control_net_init(struct netns_ipvs *ipvs)
INIT_LIST_HEAD(&ipvs->dest_trash); INIT_LIST_HEAD(&ipvs->dest_trash);
spin_lock_init(&ipvs->dest_trash_lock); spin_lock_init(&ipvs->dest_trash_lock);
setup_timer(&ipvs->dest_trash_timer, ip_vs_dest_trash_expire, timer_setup(&ipvs->dest_trash_timer, ip_vs_dest_trash_expire, 0);
(unsigned long) ipvs);
atomic_set(&ipvs->ftpsvc_counter, 0); atomic_set(&ipvs->ftpsvc_counter, 0);
atomic_set(&ipvs->nullsvc_counter, 0); atomic_set(&ipvs->nullsvc_counter, 0);
atomic_set(&ipvs->conn_out_counter, 0); atomic_set(&ipvs->conn_out_counter, 0);
......
...@@ -97,12 +97,12 @@ static void ip_vs_read_cpu_stats(struct ip_vs_kstats *sum, ...@@ -97,12 +97,12 @@ static void ip_vs_read_cpu_stats(struct ip_vs_kstats *sum,
} }
static void estimation_timer(unsigned long arg) static void estimation_timer(struct timer_list *t)
{ {
struct ip_vs_estimator *e; struct ip_vs_estimator *e;
struct ip_vs_stats *s; struct ip_vs_stats *s;
u64 rate; u64 rate;
struct netns_ipvs *ipvs = (struct netns_ipvs *)arg; struct netns_ipvs *ipvs = from_timer(ipvs, t, est_timer);
spin_lock(&ipvs->est_lock); spin_lock(&ipvs->est_lock);
list_for_each_entry(e, &ipvs->est_list, list) { list_for_each_entry(e, &ipvs->est_list, list) {
...@@ -192,7 +192,7 @@ int __net_init ip_vs_estimator_net_init(struct netns_ipvs *ipvs) ...@@ -192,7 +192,7 @@ int __net_init ip_vs_estimator_net_init(struct netns_ipvs *ipvs)
{ {
INIT_LIST_HEAD(&ipvs->est_list); INIT_LIST_HEAD(&ipvs->est_list);
spin_lock_init(&ipvs->est_lock); spin_lock_init(&ipvs->est_lock);
setup_timer(&ipvs->est_timer, estimation_timer, (unsigned long)ipvs); timer_setup(&ipvs->est_timer, estimation_timer, 0);
mod_timer(&ipvs->est_timer, jiffies + 2 * HZ); mod_timer(&ipvs->est_timer, jiffies + 2 * HZ);
return 0; return 0;
} }
......
...@@ -106,6 +106,7 @@ struct ip_vs_lblc_table { ...@@ -106,6 +106,7 @@ struct ip_vs_lblc_table {
struct rcu_head rcu_head; struct rcu_head rcu_head;
struct hlist_head bucket[IP_VS_LBLC_TAB_SIZE]; /* hash bucket */ struct hlist_head bucket[IP_VS_LBLC_TAB_SIZE]; /* hash bucket */
struct timer_list periodic_timer; /* collect stale entries */ struct timer_list periodic_timer; /* collect stale entries */
struct ip_vs_service *svc; /* pointer back to service */
atomic_t entries; /* number of entries */ atomic_t entries; /* number of entries */
int max_size; /* maximum size of entries */ int max_size; /* maximum size of entries */
int rover; /* rover for expire check */ int rover; /* rover for expire check */
...@@ -294,10 +295,10 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_service *svc) ...@@ -294,10 +295,10 @@ static inline void ip_vs_lblc_full_check(struct ip_vs_service *svc)
* of the table. * of the table.
* The full expiration check is for this purpose now. * The full expiration check is for this purpose now.
*/ */
static void ip_vs_lblc_check_expire(unsigned long data) static void ip_vs_lblc_check_expire(struct timer_list *t)
{ {
struct ip_vs_service *svc = (struct ip_vs_service *) data; struct ip_vs_lblc_table *tbl = from_timer(tbl, t, periodic_timer);
struct ip_vs_lblc_table *tbl = svc->sched_data; struct ip_vs_service *svc = tbl->svc;
unsigned long now = jiffies; unsigned long now = jiffies;
int goal; int goal;
int i, j; int i, j;
...@@ -369,12 +370,12 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc) ...@@ -369,12 +370,12 @@ static int ip_vs_lblc_init_svc(struct ip_vs_service *svc)
tbl->rover = 0; tbl->rover = 0;
tbl->counter = 1; tbl->counter = 1;
tbl->dead = 0; tbl->dead = 0;
tbl->svc = svc;
/* /*
* Hook periodic timer for garbage collection * Hook periodic timer for garbage collection
*/ */
setup_timer(&tbl->periodic_timer, ip_vs_lblc_check_expire, timer_setup(&tbl->periodic_timer, ip_vs_lblc_check_expire, 0);
(unsigned long)svc);
mod_timer(&tbl->periodic_timer, jiffies + CHECK_EXPIRE_INTERVAL); mod_timer(&tbl->periodic_timer, jiffies + CHECK_EXPIRE_INTERVAL);
return 0; return 0;
......
...@@ -278,6 +278,7 @@ struct ip_vs_lblcr_table { ...@@ -278,6 +278,7 @@ struct ip_vs_lblcr_table {
atomic_t entries; /* number of entries */ atomic_t entries; /* number of entries */
int max_size; /* maximum size of entries */ int max_size; /* maximum size of entries */
struct timer_list periodic_timer; /* collect stale entries */ struct timer_list periodic_timer; /* collect stale entries */
struct ip_vs_service *svc; /* pointer back to service */
int rover; /* rover for expire check */ int rover; /* rover for expire check */
int counter; /* counter for no expire */ int counter; /* counter for no expire */
bool dead; bool dead;
...@@ -458,10 +459,10 @@ static inline void ip_vs_lblcr_full_check(struct ip_vs_service *svc) ...@@ -458,10 +459,10 @@ static inline void ip_vs_lblcr_full_check(struct ip_vs_service *svc)
* of the table. * of the table.
* The full expiration check is for this purpose now. * The full expiration check is for this purpose now.
*/ */
static void ip_vs_lblcr_check_expire(unsigned long data) static void ip_vs_lblcr_check_expire(struct timer_list *t)
{ {
struct ip_vs_service *svc = (struct ip_vs_service *) data; struct ip_vs_lblcr_table *tbl = from_timer(tbl, t, periodic_timer);
struct ip_vs_lblcr_table *tbl = svc->sched_data; struct ip_vs_service *svc = tbl->svc;
unsigned long now = jiffies; unsigned long now = jiffies;
int goal; int goal;
int i, j; int i, j;
...@@ -532,12 +533,12 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc) ...@@ -532,12 +533,12 @@ static int ip_vs_lblcr_init_svc(struct ip_vs_service *svc)
tbl->rover = 0; tbl->rover = 0;
tbl->counter = 1; tbl->counter = 1;
tbl->dead = 0; tbl->dead = 0;
tbl->svc = svc;
/* /*
* Hook periodic timer for garbage collection * Hook periodic timer for garbage collection
*/ */
setup_timer(&tbl->periodic_timer, ip_vs_lblcr_check_expire, timer_setup(&tbl->periodic_timer, ip_vs_lblcr_check_expire, 0);
(unsigned long)svc);
mod_timer(&tbl->periodic_timer, jiffies + CHECK_EXPIRE_INTERVAL); mod_timer(&tbl->periodic_timer, jiffies + CHECK_EXPIRE_INTERVAL);
return 0; return 0;
......
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