From: Kees Cook <keescook@chromium.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: Kees Cook <keescook@chromium.org>,
Kalle Valo <kvalo@codeaurora.org>,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: [PATCH 08/58] net/wireless/ray_cs: Convert timers to use timer_setup()
Date: Mon, 16 Oct 2017 17:28:52 -0700 [thread overview]
Message-ID: <1508200182-104605-9-git-send-email-keescook@chromium.org> (raw)
In-Reply-To: <1508200182-104605-1-git-send-email-keescook@chromium.org>
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: Kees Cook <keescook@chromium.org>
---
drivers/net/wireless/ray_cs.c | 53 ++++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 29 deletions(-)
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 170cd504e8ff..d8afcdfca1ed 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -92,7 +92,7 @@ static const struct iw_handler_def ray_handler_def;
/***** Prototypes for raylink functions **************************************/
static void authenticate(ray_dev_t *local);
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_tx_ccs(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);
static int interrupt_ecf(ray_dev_t *local, int ccs);
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 verify_dl_startup(u_long);
+static void verify_dl_startup(struct timer_list *t);
/* Prototypes for interrpt time functions **********************************/
static irqreturn_t ray_interrupt(int reg, void *dev_id);
@@ -120,9 +120,8 @@ static void associate(ray_dev_t *local);
/* Card command functions */
static int dl_startup_params(struct net_device *dev);
-static void join_net(u_long local);
-static void start_net(u_long local);
-/* void start_net(ray_dev_t *local); */
+static void join_net(struct timer_list *t);
+static void start_net(struct timer_list *t);
/*===========================================================================*/
/* Parameters that can be set with 'insmod' */
@@ -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");
netif_stop_queue(dev);
- init_timer(&local->timer);
+ timer_setup(&local->timer, NULL, 0);
this_device = p_dev;
return ray_config(p_dev);
@@ -570,8 +569,7 @@ static int dl_startup_params(struct net_device *dev)
local->card_status = CARD_DL_PARAM;
/* Start kernel timer to wait for dl startup to complete. */
local->timer.expires = jiffies + HZ / 2;
- local->timer.data = (long)local;
- local->timer.function = verify_dl_startup;
+ local->timer.function = (TIMER_FUNC_TYPE)verify_dl_startup;
add_timer(&local->timer);
dev_dbg(&link->dev,
"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)
} /* 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;
UCHAR status;
struct pcmcia_device *link = local->finder;
@@ -676,16 +674,16 @@ static void verify_dl_startup(u_long data)
return;
}
if (local->sparm.b4.a_network_type == ADHOC)
- start_net((u_long) local);
+ start_net(&local->timer);
else
- join_net((u_long) local);
+ join_net(&local->timer);
} /* end verify_dl_startup */
/*===========================================================================*/
/* 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;
int ccsindex;
struct pcmcia_device *link = local->finder;
@@ -710,9 +708,9 @@ static void start_net(u_long data)
/*===========================================================================*/
/* 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;
int ccsindex;
@@ -1639,13 +1637,13 @@ static int get_free_ccs(ray_dev_t *local)
} /* 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);
printk(KERN_INFO "ray_cs Authentication with access point failed"
" - 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)
del_timer(&local->timer);
local->timer.expires = jiffies + HZ * 5;
- local->timer.data = (long)local;
if (status == CCS_START_NETWORK) {
dev_dbg(&link->dev,
"ray_cs interrupt network \"%s\" start failed\n",
memtmp);
- local->timer.function = start_net;
+ local->timer.function = (TIMER_FUNC_TYPE)start_net;
} else {
dev_dbg(&link->dev,
"ray_cs interrupt network \"%s\" join failed\n",
memtmp);
- local->timer.function = join_net;
+ local->timer.function = (TIMER_FUNC_TYPE)join_net;
}
add_timer(&local->timer);
}
@@ -1967,7 +1964,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
} else {
dev_dbg(&link->dev, "ray_cs association failed,\n");
local->card_status = CARD_ASSOC_FAILED;
- join_net((u_long) local);
+ join_net(&local->timer);
}
break;
case CCS_TX_REQUEST:
@@ -2420,12 +2417,11 @@ static void authenticate(ray_dev_t *local)
del_timer(&local->timer);
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 {
- local->timer.function = authenticate_timeout;
+ local->timer.function = (TIMER_FUNC_TYPE)authenticate_timeout;
}
local->timer.expires = jiffies + HZ * 2;
- local->timer.data = (long)local;
add_timer(&local->timer);
local->authentication_state = AWAITING_RESPONSE;
} /* end authenticate */
@@ -2468,7 +2464,7 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs,
} else {
pr_debug("Authentication refused\n");
local->card_status = CARD_AUTH_REFUSED;
- join_net((u_long) local);
+ join_net(&local->timer);
local->authentication_state =
UNAUTHENTICATED;
}
@@ -2506,8 +2502,7 @@ static void associate(ray_dev_t *local)
del_timer(&local->timer);
local->timer.expires = jiffies + HZ * 2;
- local->timer.data = (long)local;
- local->timer.function = join_net;
+ local->timer.function = (TIMER_FUNC_TYPE)join_net;
add_timer(&local->timer);
local->card_status = CARD_ASSOC_FAILED;
return;
--
2.7.4
next prev parent reply other threads:[~2017-10-17 0:30 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 0:28 [PATCH 00/58] networking: " Kees Cook
2017-10-17 0:28 ` [PATCH 01/58] net/decnet: " Kees Cook
2017-10-17 0:28 ` [PATCH 02/58] net/lapb: " Kees Cook
2017-10-17 0:28 ` [PATCH 03/58] net/rose: " Kees Cook
2017-10-17 0:28 ` [PATCH 04/58] net/irda-usb: " Kees Cook
2017-10-17 0:28 ` [PATCH 05/58] net/irda/bfin_sir: " Kees Cook
2017-10-17 0:28 ` [PATCH 06/58] net/ti/tlan: " Kees Cook
2017-10-17 0:28 ` [PATCH 07/58] net/usb/usbnet: " Kees Cook
2017-10-17 10:30 ` Oliver Neukum
2017-10-17 0:28 ` Kees Cook [this message]
2017-10-27 7:31 ` [08/58] net/wireless/ray_cs: " Kalle Valo
2017-10-17 0:28 ` [PATCH 09/58] net/irda: " Kees Cook
2018-03-02 21:29 ` Marcelo Ricardo Leitner
2018-03-02 22:30 ` Kees Cook
2018-03-02 23:08 ` Marcelo Ricardo Leitner
2017-10-17 0:28 ` [PATCH 10/58] isdn/hisax: " Kees Cook
2017-10-17 0:28 ` [PATCH 11/58] net/hamradio/6pack: " Kees Cook
2017-10-17 0:28 ` [PATCH 12/58] xfrm: " Kees Cook
2017-10-17 0:28 ` [PATCH 13/58] ethernet/broadcom: " Kees Cook
2017-10-17 0:28 ` [PATCH 14/58] net: tulip: de2104x: " Kees Cook
2017-10-17 0:28 ` [PATCH 15/58] pcmcia/electra_cf: " Kees Cook
2017-10-17 0:29 ` [PATCH 16/58] net: ethernet: stmmac: " Kees Cook
2017-10-17 0:29 ` [PATCH 17/58] net/cw1200: " Kees Cook
2017-10-17 0:29 ` [PATCH 18/58] net: vxge: " Kees Cook
2017-10-17 0:29 ` [PATCH 19/58] drivers/atm/suni: " Kees Cook
2017-10-17 0:29 ` [PATCH 20/58] atm: idt77252: " Kees Cook
2017-10-17 0:29 ` [PATCH 21/58] net: tulip: " Kees Cook
2017-10-17 0:29 ` [PATCH 22/58] net: can: " Kees Cook
2017-10-17 0:29 ` [PATCH 23/58] drivers/net/3com: " Kees Cook
2017-10-17 0:29 ` [PATCH 24/58] chelsio: " Kees Cook
2017-10-17 0:29 ` [PATCH 25/58] net: amd8111e: " Kees Cook
2017-10-17 0:29 ` [PATCH 26/58] bna: " Kees Cook
2017-10-17 0:29 ` [PATCH 27/58] net: dl2k: " Kees Cook
2017-10-17 0:29 ` [PATCH 28/58] net: ksz884x: " Kees Cook
2017-10-17 0:29 ` [PATCH 29/58] forcedeth: " Kees Cook
2017-10-17 0:29 ` [PATCH 30/58] mISDN: " Kees Cook
2017-10-17 0:29 ` [PATCH 31/58] isdn/gigaset: Use kzalloc instead of open-coded field zeroing Kees Cook
2017-10-19 20:46 ` Paul Bolle
2017-10-17 0:29 ` [PATCH 32/58] isdn/gigaset: Convert timers to use timer_setup() Kees Cook
2017-10-19 21:03 ` Paul Bolle
2017-10-19 21:20 ` Paul Bolle
2017-10-19 21:31 ` Thomas Gleixner
2017-10-19 21:51 ` Paul Bolle
2017-10-19 22:28 ` Thomas Gleixner
2017-10-19 23:31 ` Paul Bolle
2017-10-19 21:31 ` Kees Cook
2017-10-19 22:16 ` Paul Bolle
2017-10-17 0:29 ` [PATCH 33/58] net: sched: " Kees Cook
2017-10-17 0:29 ` [PATCH 34/58] netfilter: ipset: " Kees Cook
2017-10-17 0:29 ` [PATCH 35/58] inet/connection_sock: " Kees Cook
2017-10-17 0:29 ` [PATCH 36/58] inet: frags: " Kees Cook
2017-10-17 0:29 ` [PATCH 37/58] net/core: Collapse redundant sk_timer callback data assignments Kees Cook
2017-10-17 0:29 ` [PATCH 38/58] hdlc: Convert timers to use timer_setup() Kees Cook
2017-10-17 0:29 ` [PATCH 39/58] appletalk: Remove unneeded synchronization Kees Cook
2017-10-17 0:29 ` [PATCH 40/58] drivers/net/appletalk: Convert timers to use timer_setup() Kees Cook
2017-10-17 0:29 ` [PATCH 41/58] net/atm/mpc: Stop using open-coded timer .data field Kees Cook
2017-10-17 0:29 ` [PATCH 42/58] isdnloop: Convert timers to use timer_setup() Kees Cook
2017-10-17 0:29 ` [PATCH 43/58] net: ethernet: apple: " Kees Cook
2017-10-17 0:29 ` [PATCH 44/58] net: ethernet: sun: " Kees Cook
2017-10-17 16:27 ` Shannon Nelson
2017-10-17 0:29 ` [PATCH 45/58] net: seeq: " Kees Cook
2017-10-17 0:29 ` [PATCH 46/58] hamradio/scc: " Kees Cook
2017-10-17 0:29 ` [PATCH 47/58] net/ethernet/sgi: " Kees Cook
2017-10-17 0:29 ` [PATCH 48/58] net: usb: " Kees Cook
2017-10-17 0:29 ` [PATCH 49/58] net: neterion: " Kees Cook
2017-10-17 0:29 ` [PATCH 50/58] net: hns: " Kees Cook
2017-10-17 0:29 ` [PATCH 51/58] ethernet/intel: " Kees Cook
2017-10-17 0:29 ` [PATCH 52/58] net/core: Convert sk_timer users " Kees Cook
2017-10-17 0:29 ` [PATCH 53/58] net: atm: Convert timers " Kees Cook
2017-10-17 0:29 ` [PATCH 54/58] net/xen-netback: " Kees Cook
2017-10-20 16:16 ` Wei Liu
2017-10-17 0:29 ` [PATCH 55/58] net: fs_enet: Remove unused timer Kees Cook
2017-10-17 0:29 ` [PATCH 56/58] um: net: Convert timers to use timer_setup() Kees Cook
2017-10-17 0:29 ` [PATCH 57/58] ipv4: timewait: " Kees Cook
2017-10-17 0:29 ` [PATCH 58/58] sunrpc: " Kees Cook
2017-10-17 14:18 ` [PATCH 00/58] networking: " Kalle Valo
2017-10-17 19:47 ` Kees Cook
2017-10-18 5:44 ` Kalle Valo
2017-10-18 19:45 ` Kees Cook
2017-10-18 11:42 ` David Miller
2017-10-18 19:42 ` Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1508200182-104605-9-git-send-email-keescook@chromium.org \
--to=keescook@chromium.org \
--cc=davem@davemloft.net \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®