Commit 78ce6a90 authored by Kees Cook's avatar Kees Cook Committed by Kalle Valo

libertas: 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: Kalle Valo <kvalo@codeaurora.org>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andrew Zaborowski <andrew.zaborowski@intel.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 08c2eb8e
...@@ -161,9 +161,9 @@ static void if_usb_setup_firmware(struct lbs_private *priv) ...@@ -161,9 +161,9 @@ static void if_usb_setup_firmware(struct lbs_private *priv)
} }
} }
static void if_usb_fw_timeo(unsigned long priv) static void if_usb_fw_timeo(struct timer_list *t)
{ {
struct if_usb_card *cardp = (void *)priv; struct if_usb_card *cardp = from_timer(cardp, t, fw_timeout);
if (cardp->fwdnldover) { if (cardp->fwdnldover) {
lbs_deb_usb("Download complete, no event. Assuming success\n"); lbs_deb_usb("Download complete, no event. Assuming success\n");
...@@ -205,7 +205,7 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -205,7 +205,7 @@ static int if_usb_probe(struct usb_interface *intf,
if (!cardp) if (!cardp)
goto error; goto error;
setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); timer_setup(&cardp->fw_timeout, if_usb_fw_timeo, 0);
init_waitqueue_head(&cardp->fw_wq); init_waitqueue_head(&cardp->fw_wq);
cardp->udev = udev; cardp->udev = udev;
......
...@@ -722,9 +722,9 @@ EXPORT_SYMBOL_GPL(lbs_resume); ...@@ -722,9 +722,9 @@ EXPORT_SYMBOL_GPL(lbs_resume);
* *
* @data: &struct lbs_private pointer * @data: &struct lbs_private pointer
*/ */
static void lbs_cmd_timeout_handler(unsigned long data) static void lbs_cmd_timeout_handler(struct timer_list *t)
{ {
struct lbs_private *priv = (struct lbs_private *)data; struct lbs_private *priv = from_timer(priv, t, command_timer);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->driver_lock, flags); spin_lock_irqsave(&priv->driver_lock, flags);
...@@ -756,9 +756,9 @@ static void lbs_cmd_timeout_handler(unsigned long data) ...@@ -756,9 +756,9 @@ static void lbs_cmd_timeout_handler(unsigned long data)
* *
* @data: &struct lbs_private pointer * @data: &struct lbs_private pointer
*/ */
static void lbs_tx_lockup_handler(unsigned long data) static void lbs_tx_lockup_handler(struct timer_list *t)
{ {
struct lbs_private *priv = (struct lbs_private *)data; struct lbs_private *priv = from_timer(priv, t, tx_lockup_timer);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->driver_lock, flags); spin_lock_irqsave(&priv->driver_lock, flags);
...@@ -779,9 +779,9 @@ static void lbs_tx_lockup_handler(unsigned long data) ...@@ -779,9 +779,9 @@ static void lbs_tx_lockup_handler(unsigned long data)
* @data: &struct lbs_private pointer * @data: &struct lbs_private pointer
* returns: N/A * returns: N/A
*/ */
static void auto_deepsleep_timer_fn(unsigned long data) static void auto_deepsleep_timer_fn(struct timer_list *t)
{ {
struct lbs_private *priv = (struct lbs_private *)data; struct lbs_private *priv = from_timer(priv, t, auto_deepsleep_timer);
if (priv->is_activity_detected) { if (priv->is_activity_detected) {
priv->is_activity_detected = 0; priv->is_activity_detected = 0;
...@@ -847,12 +847,9 @@ static int lbs_init_adapter(struct lbs_private *priv) ...@@ -847,12 +847,9 @@ static int lbs_init_adapter(struct lbs_private *priv)
init_waitqueue_head(&priv->fw_waitq); init_waitqueue_head(&priv->fw_waitq);
mutex_init(&priv->lock); mutex_init(&priv->lock);
setup_timer(&priv->command_timer, lbs_cmd_timeout_handler, timer_setup(&priv->command_timer, lbs_cmd_timeout_handler, 0);
(unsigned long)priv); timer_setup(&priv->tx_lockup_timer, lbs_tx_lockup_handler, 0);
setup_timer(&priv->tx_lockup_timer, lbs_tx_lockup_handler, timer_setup(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn, 0);
(unsigned long)priv);
setup_timer(&priv->auto_deepsleep_timer, auto_deepsleep_timer_fn,
(unsigned long)priv);
INIT_LIST_HEAD(&priv->cmdfreeq); INIT_LIST_HEAD(&priv->cmdfreeq);
INIT_LIST_HEAD(&priv->cmdpendingq); INIT_LIST_HEAD(&priv->cmdpendingq);
......
...@@ -115,9 +115,9 @@ static void if_usb_setup_firmware(struct lbtf_private *priv) ...@@ -115,9 +115,9 @@ static void if_usb_setup_firmware(struct lbtf_private *priv)
lbtf_deb_leave(LBTF_DEB_USB); lbtf_deb_leave(LBTF_DEB_USB);
} }
static void if_usb_fw_timeo(unsigned long priv) static void if_usb_fw_timeo(struct timer_list *t)
{ {
struct if_usb_card *cardp = (void *)priv; struct if_usb_card *cardp = from_timer(cardp, t, fw_timeout);
lbtf_deb_enter(LBTF_DEB_USB); lbtf_deb_enter(LBTF_DEB_USB);
if (!cardp->fwdnldover) { if (!cardp->fwdnldover) {
...@@ -156,7 +156,7 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -156,7 +156,7 @@ static int if_usb_probe(struct usb_interface *intf,
if (!cardp) if (!cardp)
goto error; goto error;
setup_timer(&cardp->fw_timeout, if_usb_fw_timeo, (unsigned long)cardp); timer_setup(&cardp->fw_timeout, if_usb_fw_timeo, 0);
init_waitqueue_head(&cardp->fw_wq); init_waitqueue_head(&cardp->fw_wq);
cardp->udev = udev; cardp->udev = udev;
......
...@@ -165,9 +165,9 @@ static int lbtf_setup_firmware(struct lbtf_private *priv) ...@@ -165,9 +165,9 @@ static int lbtf_setup_firmware(struct lbtf_private *priv)
* This function handles the timeout of command sending. * This function handles the timeout of command sending.
* It will re-send the same command again. * It will re-send the same command again.
*/ */
static void command_timer_fn(unsigned long data) static void command_timer_fn(struct timer_list *t)
{ {
struct lbtf_private *priv = (struct lbtf_private *)data; struct lbtf_private *priv = from_timer(priv, t, command_timer);
unsigned long flags; unsigned long flags;
lbtf_deb_enter(LBTF_DEB_CMD); lbtf_deb_enter(LBTF_DEB_CMD);
...@@ -196,8 +196,7 @@ static int lbtf_init_adapter(struct lbtf_private *priv) ...@@ -196,8 +196,7 @@ static int lbtf_init_adapter(struct lbtf_private *priv)
mutex_init(&priv->lock); mutex_init(&priv->lock);
priv->vif = NULL; priv->vif = NULL;
setup_timer(&priv->command_timer, command_timer_fn, timer_setup(&priv->command_timer, command_timer_fn, 0);
(unsigned long)priv);
INIT_LIST_HEAD(&priv->cmdfreeq); INIT_LIST_HEAD(&priv->cmdfreeq);
INIT_LIST_HEAD(&priv->cmdpendingq); INIT_LIST_HEAD(&priv->cmdpendingq);
......
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