Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4037c92f authored by Kees Cook's avatar Kees Cook Committed by Doug Ledford
Browse files

IB/qib: 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()
helper to pass the timer pointer explicitly.

Cc: Mike Marciniszyn <infinipath@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: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent f0309de9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1188,7 +1188,7 @@ int qib_set_lid(struct qib_pportdata *, u32, u8);
void qib_hol_down(struct qib_pportdata *);
void qib_hol_init(struct qib_pportdata *);
void qib_hol_up(struct qib_pportdata *);
void qib_hol_event(unsigned long);
void qib_hol_event(struct timer_list *);
void qib_disable_after_error(struct qib_devdata *);
int qib_set_uevent_bits(struct qib_pportdata *, const int);

@@ -1302,7 +1302,7 @@ void qib_get_eeprom_info(struct qib_devdata *);
#define qib_inc_eeprom_err(dd, eidx, incr)
void qib_dump_lookup_output_queue(struct qib_devdata *);
void qib_force_pio_avail_update(struct qib_devdata *);
void qib_clear_symerror_on_linkup(unsigned long opaque);
void qib_clear_symerror_on_linkup(struct timer_list *t);

/*
 * Set LED override, only the two LSBs have "public" meaning, but
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ struct qib_chip_specific {
	char bitsmsgbuf[64];
	struct timer_list relock_timer;
	unsigned int relock_interval; /* in jiffies */
	struct qib_devdata *dd;
};

struct qib_chippport_specific {
+4 −5
Original line number Diff line number Diff line
@@ -682,9 +682,10 @@ int qib_set_lid(struct qib_pportdata *ppd, u32 lid, u8 lmc)
/* Below is "non-zero" to force override, but both actual LEDs are off */
#define LED_OVER_BOTH_OFF (8)

static void qib_run_led_override(unsigned long opaque)
static void qib_run_led_override(struct timer_list *t)
{
	struct qib_pportdata *ppd = (struct qib_pportdata *)opaque;
	struct qib_pportdata *ppd = from_timer(ppd, t,
						    led_override_timer);
	struct qib_devdata *dd = ppd->dd;
	int timeoff;
	int ph_idx;
@@ -735,9 +736,7 @@ void qib_set_led_override(struct qib_pportdata *ppd, unsigned int val)
	 */
	if (atomic_inc_return(&ppd->led_override_timer_active) == 1) {
		/* Need to start timer */
		init_timer(&ppd->led_override_timer);
		ppd->led_override_timer.function = qib_run_led_override;
		ppd->led_override_timer.data = (unsigned long) ppd;
		timer_setup(&ppd->led_override_timer, qib_run_led_override, 0);
		ppd->led_override_timer.expires = jiffies + 1;
		add_timer(&ppd->led_override_timer);
	} else {
+9 −10
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ struct qib_chip_specific {
	u64 rpkts; /* total packets received (sample result) */
	u64 xmit_wait; /* # of ticks no data sent (sample result) */
	struct timer_list pma_timer;
	struct qib_pportdata *ppd;
	char emsgbuf[128];
	char bitsmsgbuf[64];
	u8 pma_sample_status;
@@ -2647,9 +2648,9 @@ static void qib_chk_6120_errormask(struct qib_devdata *dd)
 * need traffic_wds done the way it is
 * called from add_timer
 */
static void qib_get_6120_faststats(unsigned long opaque)
static void qib_get_6120_faststats(struct timer_list *t)
{
	struct qib_devdata *dd = (struct qib_devdata *) opaque;
	struct qib_devdata *dd = from_timer(dd, t, stats_timer);
	struct qib_pportdata *ppd = dd->pport;
	unsigned long flags;
	u64 traffic_wds;
@@ -2937,10 +2938,10 @@ static int qib_6120_set_loopback(struct qib_pportdata *ppd, const char *what)
	return ret;
}

static void pma_6120_timer(unsigned long data)
static void pma_6120_timer(struct timer_list *t)
{
	struct qib_pportdata *ppd = (struct qib_pportdata *)data;
	struct qib_chip_specific *cs = ppd->dd->cspec;
	struct qib_chip_specific *cs = from_timer(cs, t, pma_timer);
	struct qib_pportdata *ppd = cs->ppd;
	struct qib_ibport *ibp = &ppd->ibport_data;
	unsigned long flags;

@@ -3205,6 +3206,7 @@ static int init_6120_variables(struct qib_devdata *dd)
	dd->num_pports = 1;

	dd->cspec = (struct qib_chip_specific *)(ppd + dd->num_pports);
	dd->cspec->ppd = ppd;
	ppd->cpspec = NULL; /* not used in this chip */

	spin_lock_init(&dd->cspec->kernel_tid_lock);
@@ -3289,11 +3291,8 @@ static int init_6120_variables(struct qib_devdata *dd)
	dd->rhdrhead_intr_off = 1ULL << 32;

	/* setup the stats timer; the add_timer is done at end of init */
	setup_timer(&dd->stats_timer, qib_get_6120_faststats,
		    (unsigned long)dd);

	setup_timer(&dd->cspec->pma_timer, pma_6120_timer,
		    (unsigned long)ppd);
	timer_setup(&dd->stats_timer, qib_get_6120_faststats, 0);
	timer_setup(&dd->cspec->pma_timer, pma_6120_timer, 0);

	dd->ureg_align = qib_read_kreg32(dd, kr_palign);

+10 −10
Original line number Diff line number Diff line
@@ -1042,9 +1042,11 @@ static int qib_decode_7220_err(struct qib_devdata *dd, char *buf, size_t blen,
	return iserr;
}

static void reenable_7220_chase(unsigned long opaque)
static void reenable_7220_chase(struct timer_list *t)
{
	struct qib_pportdata *ppd = (struct qib_pportdata *)opaque;
	struct qib_chippport_specific *cpspec = from_timer(cpspec, t,
							 chase_timer);
	struct qib_pportdata *ppd = &cpspec->pportdata;

	ppd->cpspec->chase_timer.expires = 0;
	qib_set_ib_7220_lstate(ppd, QLOGIC_IB_IBCC_LINKCMD_DOWN,
@@ -1663,7 +1665,7 @@ static void qib_7220_quiet_serdes(struct qib_pportdata *ppd)
		       dd->control | QLOGIC_IB_C_FREEZEMODE);

	ppd->cpspec->chase_end = 0;
	if (ppd->cpspec->chase_timer.data) /* if initted */
	if (ppd->cpspec->chase_timer.function) /* if initted */
		del_timer_sync(&ppd->cpspec->chase_timer);

	if (ppd->cpspec->ibsymdelta || ppd->cpspec->iblnkerrdelta ||
@@ -3263,9 +3265,9 @@ static u32 qib_read_7220portcntrs(struct qib_devdata *dd, loff_t pos, u32 port,
 * need traffic_wds done the way it is
 * called from add_timer
 */
static void qib_get_7220_faststats(unsigned long opaque)
static void qib_get_7220_faststats(struct timer_list *t)
{
	struct qib_devdata *dd = (struct qib_devdata *) opaque;
	struct qib_devdata *dd = from_timer(dd, t, stats_timer);
	struct qib_pportdata *ppd = dd->pport;
	unsigned long flags;
	u64 traffic_wds;
@@ -3997,6 +3999,7 @@ static int qib_init_7220_variables(struct qib_devdata *dd)
	dd->num_pports = 1;

	dd->cspec = (struct qib_chip_specific *)(cpspec + dd->num_pports);
	dd->cspec->dd = dd;
	ppd->cpspec = cpspec;

	spin_lock_init(&dd->cspec->sdepb_lock);
@@ -4069,8 +4072,7 @@ static int qib_init_7220_variables(struct qib_devdata *dd)
	if (!qib_mini_init)
		qib_write_kreg(dd, kr_rcvbthqp, QIB_KD_QP);

	setup_timer(&ppd->cpspec->chase_timer, reenable_7220_chase,
		    (unsigned long)ppd);
	timer_setup(&ppd->cpspec->chase_timer, reenable_7220_chase, 0);

	qib_num_cfg_vls = 1; /* if any 7220's, only one VL */

@@ -4095,9 +4097,7 @@ static int qib_init_7220_variables(struct qib_devdata *dd)
	dd->rhdrhead_intr_off = 1ULL << 32;

	/* setup the stats timer; the add_timer is done at end of init */
	init_timer(&dd->stats_timer);
	dd->stats_timer.function = qib_get_7220_faststats;
	dd->stats_timer.data = (unsigned long) dd;
	timer_setup(&dd->stats_timer, qib_get_7220_faststats, 0);
	dd->stats_timer.expires = jiffies + ACTIVITY_TIMER * HZ;

	/*
Loading