RDMA/i40iw: 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: Faisal Latif <faisal.latif@intel.com>
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Kees Cook 2017-10-04 17:45:41 -07:00 committed by Doug Ledford
parent 4037c92f0a
commit 605cbb2c44
3 changed files with 7 additions and 5 deletions

View File

@ -4873,6 +4873,7 @@ enum i40iw_status_code i40iw_vsi_stats_init(struct i40iw_sc_vsi *vsi, struct i40
vsi->pestat = info->pestat; vsi->pestat = info->pestat;
vsi->pestat->hw = vsi->dev->hw; vsi->pestat->hw = vsi->dev->hw;
vsi->pestat->vsi = vsi;
if (info->stats_initialize) { if (info->stats_initialize) {
i40iw_hw_stats_init(vsi->pestat, fcn_id, true); i40iw_hw_stats_init(vsi->pestat, fcn_id, true);

View File

@ -250,6 +250,7 @@ struct i40iw_vsi_pestat {
struct i40iw_dev_hw_stats last_read_hw_stats; struct i40iw_dev_hw_stats last_read_hw_stats;
struct i40iw_dev_hw_stats_offsets hw_stats_offsets; struct i40iw_dev_hw_stats_offsets hw_stats_offsets;
struct timer_list stats_timer; struct timer_list stats_timer;
struct i40iw_sc_vsi *vsi;
spinlock_t lock; /* rdma stats lock */ spinlock_t lock; /* rdma stats lock */
}; };

View File

@ -1445,11 +1445,12 @@ enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_in
* i40iw_hw_stats_timeout - Stats timer-handler which updates all HW stats * i40iw_hw_stats_timeout - Stats timer-handler which updates all HW stats
* @vsi: pointer to the vsi structure * @vsi: pointer to the vsi structure
*/ */
static void i40iw_hw_stats_timeout(unsigned long vsi) static void i40iw_hw_stats_timeout(struct timer_list *t)
{ {
struct i40iw_sc_vsi *sc_vsi = (struct i40iw_sc_vsi *)vsi; struct i40iw_vsi_pestat *pf_devstat = from_timer(pf_devstat, t,
stats_timer);
struct i40iw_sc_vsi *sc_vsi = pf_devstat->vsi;
struct i40iw_sc_dev *pf_dev = sc_vsi->dev; struct i40iw_sc_dev *pf_dev = sc_vsi->dev;
struct i40iw_vsi_pestat *pf_devstat = sc_vsi->pestat;
struct i40iw_vsi_pestat *vf_devstat = NULL; struct i40iw_vsi_pestat *vf_devstat = NULL;
u16 iw_vf_idx; u16 iw_vf_idx;
unsigned long flags; unsigned long flags;
@ -1480,8 +1481,7 @@ void i40iw_hw_stats_start_timer(struct i40iw_sc_vsi *vsi)
{ {
struct i40iw_vsi_pestat *devstat = vsi->pestat; struct i40iw_vsi_pestat *devstat = vsi->pestat;
setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout, timer_setup(&devstat->stats_timer, i40iw_hw_stats_timeout, 0);
(unsigned long)vsi);
mod_timer(&devstat->stats_timer, mod_timer(&devstat->stats_timer,
jiffies + msecs_to_jiffies(STATS_TIMER_DELAY)); jiffies + msecs_to_jiffies(STATS_TIMER_DELAY));
} }