Skip to content

Commit

Permalink
net/xen-netback: 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: Wei Liu <[email protected]>
Cc: Paul Durrant <[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 ba42179 commit cac6a8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/net/xen-netback/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif)
return to_xenbus_device(vif->dev->dev.parent);
}

void xenvif_tx_credit_callback(unsigned long data);
void xenvif_tx_credit_callback(struct timer_list *t);

struct xenvif *xenvif_alloc(struct device *parent,
domid_t domid,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/xen-netback/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ int xenvif_init_queue(struct xenvif_queue *queue)

queue->credit_bytes = queue->remaining_credit = ~0UL;
queue->credit_usec = 0UL;
setup_timer(&queue->credit_timeout, xenvif_tx_credit_callback, 0UL);
timer_setup(&queue->credit_timeout, xenvif_tx_credit_callback, 0);
queue->credit_window_start = get_jiffies_64();

queue->rx_queue_max = XENVIF_RX_QUEUE_BYTES;
Expand Down
6 changes: 2 additions & 4 deletions drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ static void tx_add_credit(struct xenvif_queue *queue)
queue->rate_limited = false;
}

void xenvif_tx_credit_callback(unsigned long data)
void xenvif_tx_credit_callback(struct timer_list *t)
{
struct xenvif_queue *queue = (struct xenvif_queue *)data;
struct xenvif_queue *queue = from_timer(queue, t, credit_timeout);
tx_add_credit(queue);
xenvif_napi_schedule_or_enable_events(queue);
}
Expand Down Expand Up @@ -700,8 +700,6 @@ static bool tx_credit_exceeded(struct xenvif_queue *queue, unsigned size)

/* Still too big to send right now? Set a callback. */
if (size > queue->remaining_credit) {
queue->credit_timeout.data =
(unsigned long)queue;
mod_timer(&queue->credit_timeout,
next_credit);
queue->credit_window_start = next_credit;
Expand Down

0 comments on commit cac6a8f

Please sign in to comment.