Skip to content

Commit

Permalink
net/decnet: Convert timers to use timer_setup()
Browse files Browse the repository at this point in the history
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: "David S. Miller" <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: David Ahern <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
kees authored and davem330 committed Oct 18, 2017
1 parent 1bbc728 commit eb4ddaf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 30 deletions.
7 changes: 0 additions & 7 deletions include/net/dn.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,6 @@ struct dn_scp /* Session Control Port */
unsigned long keepalive;
void (*keepalive_fxn)(struct sock *sk);

/*
* This stuff is for the fast timer for delayed acks
*/
struct timer_list delack_timer;
int delack_pending;
void (*delack_fxn)(struct sock *sk);

};

static inline struct dn_scp *DN_SK(struct sock *sk)
Expand Down
1 change: 0 additions & 1 deletion include/net/dn_nsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

void dn_nsp_send_data_ack(struct sock *sk);
void dn_nsp_send_oth_ack(struct sock *sk);
void dn_nsp_delayed_ack(struct sock *sk);
void dn_send_conn_ack(struct sock *sk);
void dn_send_conn_conf(struct sock *sk, gfp_t gfp);
void dn_nsp_send_disc(struct sock *sk, unsigned char type,
Expand Down
4 changes: 0 additions & 4 deletions net/decnet/af_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,6 @@ static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gf
scp->keepalive = 10 * HZ;
scp->keepalive_fxn = dn_keepalive;

init_timer(&scp->delack_timer);
scp->delack_pending = 0;
scp->delack_fxn = dn_nsp_delayed_ack;

dn_start_slow_timer(sk);
out:
return sk;
Expand Down
12 changes: 5 additions & 7 deletions net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,14 +1038,14 @@ static void dn_eth_down(struct net_device *dev)

static void dn_dev_set_timer(struct net_device *dev);

static void dn_dev_timer_func(unsigned long arg)
static void dn_dev_timer_func(struct timer_list *t)
{
struct net_device *dev = (struct net_device *)arg;
struct dn_dev *dn_db;
struct dn_dev *dn_db = from_timer(dn_db, t, timer);
struct net_device *dev;
struct dn_ifaddr *ifa;

rcu_read_lock();
dn_db = rcu_dereference(dev->dn_ptr);
dev = dn_db->dev;
if (dn_db->t3 <= dn_db->parms.t2) {
if (dn_db->parms.timer3) {
for (ifa = rcu_dereference(dn_db->ifa_list);
Expand All @@ -1070,8 +1070,6 @@ static void dn_dev_set_timer(struct net_device *dev)
if (dn_db->parms.t2 > dn_db->parms.t3)
dn_db->parms.t2 = dn_db->parms.t3;

dn_db->timer.data = (unsigned long)dev;
dn_db->timer.function = dn_dev_timer_func;
dn_db->timer.expires = jiffies + (dn_db->parms.t2 * HZ);

add_timer(&dn_db->timer);
Expand Down Expand Up @@ -1100,7 +1098,7 @@ static struct dn_dev *dn_dev_create(struct net_device *dev, int *err)

rcu_assign_pointer(dev->dn_ptr, dn_db);
dn_db->dev = dev;
init_timer(&dn_db->timer);
timer_setup(&dn_db->timer, dn_dev_timer_func, 0);

dn_db->uptime = jiffies;

Expand Down
11 changes: 0 additions & 11 deletions net/decnet/dn_nsp_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,17 +491,6 @@ void dn_send_conn_ack (struct sock *sk)
dn_nsp_send(skb);
}

void dn_nsp_delayed_ack(struct sock *sk)
{
struct dn_scp *scp = DN_SK(sk);

if (scp->ackxmt_oth != scp->numoth_rcv)
dn_nsp_send_oth_ack(sk);

if (scp->ackxmt_dat != scp->numdat_rcv)
dn_nsp_send_data_ack(sk);
}

static int dn_nsp_retrans_conn_conf(struct sock *sk)
{
struct dn_scp *scp = DN_SK(sk);
Expand Down

0 comments on commit eb4ddaf

Please sign in to comment.