Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2af55f46 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'networking-Convert-timers-to-use-timer_setup'



Kees Cook says:

====================
networking: Convert timers to use timer_setup()

This is the current set of outstanding networking patches to perform
conversions to the new timer interface (rebased to -next). This is not
all expected conversions, but it contains everything needed in networking
to eliminate init_timer(), and all the non-standard setup_*_timer() uses.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1bbc7289 ff861c4d
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ static int uml_net_open(struct net_device *dev)
		goto out_close;
	}

	lp->tl.data = (unsigned long) &lp->user;
	netif_start_queue(dev);

	/* clear buffer - it can happen that the host side of the interface
@@ -278,10 +277,11 @@ static const struct ethtool_ops uml_net_ethtool_ops = {
	.get_ts_info	= ethtool_op_get_ts_info,
};

static void uml_net_user_timer_expire(unsigned long _conn)
static void uml_net_user_timer_expire(struct timer_list *t)
{
#ifdef undef
	struct connection *conn = (struct connection *)_conn;
	struct uml_net_private *lp = from_timer(lp, t, tl);
	struct connection *conn = &lp->user;

	dprintk(KERN_INFO "uml_net_user_timer_expire [%p]\n", conn);
	do_connect(conn);
@@ -458,9 +458,8 @@ static void eth_configure(int n, void *init, char *mac,
		  .add_address 		= transport->user->add_address,
		  .delete_address  	= transport->user->delete_address });

	init_timer(&lp->tl);
	timer_setup(&lp->tl, uml_net_user_timer_expire, 0);
	spin_lock_init(&lp->lock);
	lp->tl.function = uml_net_user_timer_expire;
	memcpy(lp->mac, dev->dev_addr, sizeof(lp->mac));

	if ((transport->user->init != NULL) &&
+12 −9
Original line number Diff line number Diff line
@@ -2073,21 +2073,19 @@ idt77252_rate_logindex(struct idt77252_dev *card, int pcr)
}

static void
idt77252_est_timer(unsigned long data)
idt77252_est_timer(struct timer_list *t)
{
	struct vc_map *vc = (struct vc_map *)data;
	struct rate_estimator *est = from_timer(est, t, timer);
	struct vc_map *vc = est->vc;
	struct idt77252_dev *card = vc->card;
	struct rate_estimator *est;
	unsigned long flags;
	u32 rate, cps;
	u64 ncells;
	u8 lacr;

	spin_lock_irqsave(&vc->lock, flags);
	est = vc->estimator;
	if (!est)
	if (!vc->estimator)
		goto out;

	ncells = est->cells;

	rate = ((u32)(ncells - est->last_cells)) << (7 - est->interval);
@@ -2126,10 +2124,11 @@ idt77252_init_est(struct vc_map *vc, int pcr)
	est->maxcps = pcr < 0 ? -pcr : pcr;
	est->cps = est->maxcps;
	est->avcps = est->cps << 5;
	est->vc = vc;

	est->interval = 2;		/* XXX: make this configurable */
	est->ewma_log = 2;		/* XXX: make this configurable */
	setup_timer(&est->timer, idt77252_est_timer, (unsigned long)vc);
	timer_setup(&est->timer, idt77252_est_timer, 0);
	mod_timer(&est->timer, jiffies + ((HZ / 4) << est->interval));

	return est;
@@ -2209,16 +2208,20 @@ static int
idt77252_init_ubr(struct idt77252_dev *card, struct vc_map *vc,
		  struct atm_vcc *vcc, struct atm_qos *qos)
{
	struct rate_estimator *est = NULL;
	unsigned long flags;
	int tcr;

	spin_lock_irqsave(&vc->lock, flags);
	if (vc->estimator) {
		del_timer(&vc->estimator->timer);
		kfree(vc->estimator);
		est = vc->estimator;
		vc->estimator = NULL;
	}
	spin_unlock_irqrestore(&vc->lock, flags);
	if (est) {
		del_timer_sync(&est->timer);
		kfree(est);
	}

	tcr = atm_pcr_goal(&qos->txtp);
	if (tcr == 0)
+3 −0
Original line number Diff line number Diff line
@@ -184,6 +184,8 @@ struct aal1 {
	unsigned char		sequence;
};

struct vc_map;

struct rate_estimator {
	struct timer_list	timer;
	unsigned int		interval;
@@ -193,6 +195,7 @@ struct rate_estimator {
	long			avcps;
	u32			cps;
	u32			maxcps;
	struct vc_map		*vc;
};

struct vc_map {
+4 −6
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ static DEFINE_SPINLOCK(sunis_lock);
    if (atomic_read(&stats->s) < 0) atomic_set(&stats->s,INT_MAX);


static void suni_hz(unsigned long from_timer)
static void suni_hz(struct timer_list *timer)
{
	struct suni_priv *walk;
	struct atm_dev *dev;
@@ -85,7 +85,7 @@ static void suni_hz(unsigned long from_timer)
		    ((GET(TACP_TCC) & 0xff) << 8) |
		    ((GET(TACP_TCCM) & 7) << 16));
	}
	if (from_timer) mod_timer(&poll_timer,jiffies+HZ);
	if (timer) mod_timer(&poll_timer,jiffies+HZ);
}


@@ -322,13 +322,11 @@ static int suni_start(struct atm_dev *dev)
		printk(KERN_WARNING "%s(itf %d): no signal\n",dev->type,
		    dev->number);
	PRIV(dev)->loop_mode = ATM_LM_NONE;
	suni_hz(0); /* clear SUNI counters */
	suni_hz(NULL); /* clear SUNI counters */
	(void) fetch_stats(dev,NULL,1); /* clear kernel counters */
	if (first) {
		init_timer(&poll_timer);
		timer_setup(&poll_timer, suni_hz, 0);
		poll_timer.expires = jiffies+HZ;
		poll_timer.function = suni_hz;
		poll_timer.data = 1;
#if 0
printk(KERN_DEBUG "[u] p=0x%lx,n=0x%lx\n",(unsigned long) poll_timer.list.prev,
    (unsigned long) poll_timer.list.next);
+21 −25
Original line number Diff line number Diff line
@@ -433,10 +433,11 @@ static void check_pending(struct bas_cardstate *ucs)
 * argument:
 *	controller state structure
 */
static void cmd_in_timeout(unsigned long data)
static void cmd_in_timeout(struct timer_list *t)
{
	struct cardstate *cs = (struct cardstate *) data;
	struct bas_cardstate *ucs = cs->hw.bas;
	struct bas_cardstate *ucs = from_timer(ucs, t, timer_cmd_in);
	struct urb *urb = ucs->urb_int_in;
	struct cardstate *cs = urb->context;
	int rc;

	if (!ucs->rcvbuf_size) {
@@ -639,10 +640,11 @@ static void int_in_work(struct work_struct *work)
 * argument:
 *	controller state structure
 */
static void int_in_resubmit(unsigned long data)
static void int_in_resubmit(struct timer_list *t)
{
	struct cardstate *cs = (struct cardstate *) data;
	struct bas_cardstate *ucs = cs->hw.bas;
	struct bas_cardstate *ucs = from_timer(ucs, t, timer_int_in);
	struct urb *urb = ucs->urb_int_in;
	struct cardstate *cs = urb->context;
	int rc;

	if (ucs->retry_int_in++ >= BAS_RETRY) {
@@ -1441,10 +1443,11 @@ static void read_iso_tasklet(unsigned long data)
 * argument:
 *	controller state structure
 */
static void req_timeout(unsigned long data)
static void req_timeout(struct timer_list *t)
{
	struct cardstate *cs = (struct cardstate *) data;
	struct bas_cardstate *ucs = cs->hw.bas;
	struct bas_cardstate *ucs = from_timer(ucs, t, timer_ctrl);
	struct urb *urb = ucs->urb_int_in;
	struct cardstate *cs = urb->context;
	int pending;
	unsigned long flags;

@@ -1837,10 +1840,11 @@ static void write_command_callback(struct urb *urb)
 * argument:
 *	controller state structure
 */
static void atrdy_timeout(unsigned long data)
static void atrdy_timeout(struct timer_list *t)
{
	struct cardstate *cs = (struct cardstate *) data;
	struct bas_cardstate *ucs = cs->hw.bas;
	struct bas_cardstate *ucs = from_timer(ucs, t, timer_atrdy);
	struct urb *urb = ucs->urb_int_in;
	struct cardstate *cs = urb->context;

	dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n");

@@ -2200,7 +2204,7 @@ static int gigaset_initcshw(struct cardstate *cs)
{
	struct bas_cardstate *ucs;

	cs->hw.bas = ucs = kmalloc(sizeof *ucs, GFP_KERNEL);
	cs->hw.bas = ucs = kzalloc(sizeof(*ucs), GFP_KERNEL);
	if (!ucs) {
		pr_err("out of memory\n");
		return -ENOMEM;
@@ -2212,19 +2216,11 @@ static int gigaset_initcshw(struct cardstate *cs)
		return -ENOMEM;
	}

	ucs->urb_cmd_in = NULL;
	ucs->urb_cmd_out = NULL;
	ucs->rcvbuf = NULL;
	ucs->rcvbuf_size = 0;

	spin_lock_init(&ucs->lock);
	ucs->pending = 0;

	ucs->basstate = 0;
	setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);
	setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);
	setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);
	setup_timer(&ucs->timer_int_in, int_in_resubmit, (unsigned long) cs);
	timer_setup(&ucs->timer_ctrl, req_timeout, 0);
	timer_setup(&ucs->timer_atrdy, atrdy_timeout, 0);
	timer_setup(&ucs->timer_cmd_in, cmd_in_timeout, 0);
	timer_setup(&ucs->timer_int_in, int_in_resubmit, 0);
	init_waitqueue_head(&ucs->waitqueue);
	INIT_WORK(&ucs->int_in_wq, int_in_work);

Loading