Commit d8eb7e26 authored by Kees Cook's avatar Kees Cook Committed by David S. Miller

net/wireless/ray_cs: 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: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2183c1a6
...@@ -92,7 +92,7 @@ static const struct iw_handler_def ray_handler_def; ...@@ -92,7 +92,7 @@ static const struct iw_handler_def ray_handler_def;
/***** Prototypes for raylink functions **************************************/ /***** Prototypes for raylink functions **************************************/
static void authenticate(ray_dev_t *local); static void authenticate(ray_dev_t *local);
static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type); static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type);
static void authenticate_timeout(u_long); static void authenticate_timeout(struct timer_list *t);
static int get_free_ccs(ray_dev_t *local); static int get_free_ccs(ray_dev_t *local);
static int get_free_tx_ccs(ray_dev_t *local); static int get_free_tx_ccs(ray_dev_t *local);
static void init_startup_params(ray_dev_t *local); static void init_startup_params(ray_dev_t *local);
...@@ -102,7 +102,7 @@ static int ray_init(struct net_device *dev); ...@@ -102,7 +102,7 @@ static int ray_init(struct net_device *dev);
static int interrupt_ecf(ray_dev_t *local, int ccs); static int interrupt_ecf(ray_dev_t *local, int ccs);
static void ray_reset(struct net_device *dev); static void ray_reset(struct net_device *dev);
static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len); static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, int len);
static void verify_dl_startup(u_long); static void verify_dl_startup(struct timer_list *t);
/* Prototypes for interrpt time functions **********************************/ /* Prototypes for interrpt time functions **********************************/
static irqreturn_t ray_interrupt(int reg, void *dev_id); static irqreturn_t ray_interrupt(int reg, void *dev_id);
...@@ -120,9 +120,8 @@ static void associate(ray_dev_t *local); ...@@ -120,9 +120,8 @@ static void associate(ray_dev_t *local);
/* Card command functions */ /* Card command functions */
static int dl_startup_params(struct net_device *dev); static int dl_startup_params(struct net_device *dev);
static void join_net(u_long local); static void join_net(struct timer_list *t);
static void start_net(u_long local); static void start_net(struct timer_list *t);
/* void start_net(ray_dev_t *local); */
/*===========================================================================*/ /*===========================================================================*/
/* Parameters that can be set with 'insmod' */ /* Parameters that can be set with 'insmod' */
...@@ -323,7 +322,7 @@ static int ray_probe(struct pcmcia_device *p_dev) ...@@ -323,7 +322,7 @@ static int ray_probe(struct pcmcia_device *p_dev)
dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n");
netif_stop_queue(dev); netif_stop_queue(dev);
init_timer(&local->timer); timer_setup(&local->timer, NULL, 0);
this_device = p_dev; this_device = p_dev;
return ray_config(p_dev); return ray_config(p_dev);
...@@ -570,8 +569,7 @@ static int dl_startup_params(struct net_device *dev) ...@@ -570,8 +569,7 @@ static int dl_startup_params(struct net_device *dev)
local->card_status = CARD_DL_PARAM; local->card_status = CARD_DL_PARAM;
/* Start kernel timer to wait for dl startup to complete. */ /* Start kernel timer to wait for dl startup to complete. */
local->timer.expires = jiffies + HZ / 2; local->timer.expires = jiffies + HZ / 2;
local->timer.data = (long)local; local->timer.function = (TIMER_FUNC_TYPE)verify_dl_startup;
local->timer.function = verify_dl_startup;
add_timer(&local->timer); add_timer(&local->timer);
dev_dbg(&link->dev, dev_dbg(&link->dev,
"ray_cs dl_startup_params started timer for verify_dl_startup\n"); "ray_cs dl_startup_params started timer for verify_dl_startup\n");
...@@ -641,9 +639,9 @@ static void init_startup_params(ray_dev_t *local) ...@@ -641,9 +639,9 @@ static void init_startup_params(ray_dev_t *local)
} /* init_startup_params */ } /* init_startup_params */
/*===========================================================================*/ /*===========================================================================*/
static void verify_dl_startup(u_long data) static void verify_dl_startup(struct timer_list *t)
{ {
ray_dev_t *local = (ray_dev_t *) data; ray_dev_t *local = from_timer(local, t, timer);
struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs; struct ccs __iomem *pccs = ccs_base(local) + local->dl_param_ccs;
UCHAR status; UCHAR status;
struct pcmcia_device *link = local->finder; struct pcmcia_device *link = local->finder;
...@@ -676,16 +674,16 @@ static void verify_dl_startup(u_long data) ...@@ -676,16 +674,16 @@ static void verify_dl_startup(u_long data)
return; return;
} }
if (local->sparm.b4.a_network_type == ADHOC) if (local->sparm.b4.a_network_type == ADHOC)
start_net((u_long) local); start_net(&local->timer);
else else
join_net((u_long) local); join_net(&local->timer);
} /* end verify_dl_startup */ } /* end verify_dl_startup */
/*===========================================================================*/ /*===========================================================================*/
/* Command card to start a network */ /* Command card to start a network */
static void start_net(u_long data) static void start_net(struct timer_list *t)
{ {
ray_dev_t *local = (ray_dev_t *) data; ray_dev_t *local = from_timer(local, t, timer);
struct ccs __iomem *pccs; struct ccs __iomem *pccs;
int ccsindex; int ccsindex;
struct pcmcia_device *link = local->finder; struct pcmcia_device *link = local->finder;
...@@ -710,9 +708,9 @@ static void start_net(u_long data) ...@@ -710,9 +708,9 @@ static void start_net(u_long data)
/*===========================================================================*/ /*===========================================================================*/
/* Command card to join a network */ /* Command card to join a network */
static void join_net(u_long data) static void join_net(struct timer_list *t)
{ {
ray_dev_t *local = (ray_dev_t *) data; ray_dev_t *local = from_timer(local, t, timer);
struct ccs __iomem *pccs; struct ccs __iomem *pccs;
int ccsindex; int ccsindex;
...@@ -1639,13 +1637,13 @@ static int get_free_ccs(ray_dev_t *local) ...@@ -1639,13 +1637,13 @@ static int get_free_ccs(ray_dev_t *local)
} /* get_free_ccs */ } /* get_free_ccs */
/*===========================================================================*/ /*===========================================================================*/
static void authenticate_timeout(u_long data) static void authenticate_timeout(struct timer_list *t)
{ {
ray_dev_t *local = (ray_dev_t *) data; ray_dev_t *local = from_timer(local, t, timer);
del_timer(&local->timer); del_timer(&local->timer);
printk(KERN_INFO "ray_cs Authentication with access point failed" printk(KERN_INFO "ray_cs Authentication with access point failed"
" - timeout\n"); " - timeout\n");
join_net((u_long) local); join_net(&local->timer);
} }
/*===========================================================================*/ /*===========================================================================*/
...@@ -1945,17 +1943,16 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) ...@@ -1945,17 +1943,16 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
del_timer(&local->timer); del_timer(&local->timer);
local->timer.expires = jiffies + HZ * 5; local->timer.expires = jiffies + HZ * 5;
local->timer.data = (long)local;
if (status == CCS_START_NETWORK) { if (status == CCS_START_NETWORK) {
dev_dbg(&link->dev, dev_dbg(&link->dev,
"ray_cs interrupt network \"%s\" start failed\n", "ray_cs interrupt network \"%s\" start failed\n",
memtmp); memtmp);
local->timer.function = start_net; local->timer.function = (TIMER_FUNC_TYPE)start_net;
} else { } else {
dev_dbg(&link->dev, dev_dbg(&link->dev,
"ray_cs interrupt network \"%s\" join failed\n", "ray_cs interrupt network \"%s\" join failed\n",
memtmp); memtmp);
local->timer.function = join_net; local->timer.function = (TIMER_FUNC_TYPE)join_net;
} }
add_timer(&local->timer); add_timer(&local->timer);
} }
...@@ -1967,7 +1964,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) ...@@ -1967,7 +1964,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
} else { } else {
dev_dbg(&link->dev, "ray_cs association failed,\n"); dev_dbg(&link->dev, "ray_cs association failed,\n");
local->card_status = CARD_ASSOC_FAILED; local->card_status = CARD_ASSOC_FAILED;
join_net((u_long) local); join_net(&local->timer);
} }
break; break;
case CCS_TX_REQUEST: case CCS_TX_REQUEST:
...@@ -2420,12 +2417,11 @@ static void authenticate(ray_dev_t *local) ...@@ -2420,12 +2417,11 @@ static void authenticate(ray_dev_t *local)
del_timer(&local->timer); del_timer(&local->timer);
if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) { if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) {
local->timer.function = join_net; local->timer.function = (TIMER_FUNC_TYPE)join_net;
} else { } else {
local->timer.function = authenticate_timeout; local->timer.function = (TIMER_FUNC_TYPE)authenticate_timeout;
} }
local->timer.expires = jiffies + HZ * 2; local->timer.expires = jiffies + HZ * 2;
local->timer.data = (long)local;
add_timer(&local->timer); add_timer(&local->timer);
local->authentication_state = AWAITING_RESPONSE; local->authentication_state = AWAITING_RESPONSE;
} /* end authenticate */ } /* end authenticate */
...@@ -2468,7 +2464,7 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, ...@@ -2468,7 +2464,7 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
} else { } else {
pr_debug("Authentication refused\n"); pr_debug("Authentication refused\n");
local->card_status = CARD_AUTH_REFUSED; local->card_status = CARD_AUTH_REFUSED;
join_net((u_long) local); join_net(&local->timer);
local->authentication_state = local->authentication_state =
UNAUTHENTICATED; UNAUTHENTICATED;
} }
...@@ -2506,8 +2502,7 @@ static void associate(ray_dev_t *local) ...@@ -2506,8 +2502,7 @@ static void associate(ray_dev_t *local)
del_timer(&local->timer); del_timer(&local->timer);
local->timer.expires = jiffies + HZ * 2; local->timer.expires = jiffies + HZ * 2;
local->timer.data = (long)local; local->timer.function = (TIMER_FUNC_TYPE)join_net;
local->timer.function = join_net;
add_timer(&local->timer); add_timer(&local->timer);
local->card_status = CARD_ASSOC_FAILED; local->card_status = CARD_ASSOC_FAILED;
return; return;
......
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