From b784ecba51da465bc15fdd1d6715479f3adc560e Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Tue, 10 Oct 2017 12:25:48 -0700 Subject: atm: idt77105: Drop needless setup_timer() Calling setup_timer() is redundant when DEFINE_TIMER() has been used. Cc: Chas Williams <3chas3@gmail.com> Cc: linux-atm-general@lists.sourceforge.net Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: David S. Miller --- drivers/atm/idt77105.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/atm') diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c index 082aa02abc57..d781b3f87693 100644 --- a/drivers/atm/idt77105.c +++ b/drivers/atm/idt77105.c @@ -306,11 +306,9 @@ static int idt77105_start(struct atm_dev *dev) if (start_timer) { start_timer = 0; - setup_timer(&stats_timer, idt77105_stats_timer_func, 0UL); stats_timer.expires = jiffies+IDT77105_STATS_TIMER_PERIOD; add_timer(&stats_timer); - setup_timer(&restart_timer, idt77105_restart_timer_func, 0UL); restart_timer.expires = jiffies+IDT77105_RESTART_TIMER_PERIOD; add_timer(&restart_timer); } -- cgit v1.2.3 From ec0d0987f084cdaf7b7ff8bd8f9f946e29fb8d94 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Thu, 12 Oct 2017 16:11:32 -0500 Subject: atm: fore200e: mark expected switch fall-throughs In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller --- drivers/atm/fore200e.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'drivers/atm') diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index f8b7e86907cc..126855e6cb7d 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -358,26 +358,33 @@ fore200e_shutdown(struct fore200e* fore200e) case FORE200E_STATE_COMPLETE: kfree(fore200e->stats); + /* fall through */ case FORE200E_STATE_IRQ: free_irq(fore200e->irq, fore200e->atm_dev); + /* fall through */ case FORE200E_STATE_ALLOC_BUF: fore200e_free_rx_buf(fore200e); + /* fall through */ case FORE200E_STATE_INIT_BSQ: fore200e_uninit_bs_queue(fore200e); + /* fall through */ case FORE200E_STATE_INIT_RXQ: fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_rxq.status); fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_rxq.rpd); + /* fall through */ case FORE200E_STATE_INIT_TXQ: fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_txq.status); fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_txq.tpd); + /* fall through */ case FORE200E_STATE_INIT_CMDQ: fore200e->bus->dma_chunk_free(fore200e, &fore200e->host_cmdq.status); + /* fall through */ case FORE200E_STATE_INITIALIZE: /* nothing to do for that state */ @@ -390,6 +397,7 @@ fore200e_shutdown(struct fore200e* fore200e) case FORE200E_STATE_MAP: fore200e->bus->unmap(fore200e); + /* fall through */ case FORE200E_STATE_CONFIGURE: /* nothing to do for that state */ -- cgit v1.2.3 From 847f03ee16cd4dbe1f15fe09989f52300e43ca10 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 16 Oct 2017 17:29:03 -0700 Subject: drivers/atm/suni: 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. Passes NULL timer when doing non- timer call. Cc: Chas Williams <3chas3@gmail.com> Cc: linux-atm-general@lists.sourceforge.net Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: David S. Miller --- drivers/atm/suni.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/atm') diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c index b0363149b2fd..b8825f2d79e0 100644 --- a/drivers/atm/suni.c +++ b/drivers/atm/suni.c @@ -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); -- cgit v1.2.3 From 3d2ceaa63b81f41cd95e8954555130cc801c4452 Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 16 Oct 2017 17:29:04 -0700 Subject: atm: idt77252: 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. This required adding a pointer back to vc_map, and adjusting the locking around removal a bit. Cc: Chas Williams <3chas3@gmail.com> Cc: linux-atm-general@lists.sourceforge.net Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: David S. Miller --- drivers/atm/idt77252.c | 21 ++++++++++++--------- drivers/atm/idt77252.h | 3 +++ 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'drivers/atm') diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 47f3c4ae0594..0e3b9c44c808 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -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) diff --git a/drivers/atm/idt77252.h b/drivers/atm/idt77252.h index 3a82cc23a053..9339197d701c 100644 --- a/drivers/atm/idt77252.h +++ b/drivers/atm/idt77252.h @@ -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 { -- cgit v1.2.3 From 8caae31a8c2759fcdca7edc2bd41bba8d230a5cc Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Mon, 30 Oct 2017 21:22:03 +0530 Subject: atm: iphase: Fix space before '[' error. Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Signed-off-by: Arvind Yadav Signed-off-by: David S. Miller --- drivers/atm/iphase.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/atm') diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index fc72b763fdd7..a785c6e69757 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -880,7 +880,7 @@ static void ia_phy_write(struct iadev_priv *iadev, static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev) { - static const struct ia_reg suni_ds3_init [] = { + static const struct ia_reg suni_ds3_init[] = { { SUNI_DS3_FRM_INTR_ENBL, 0x17 }, { SUNI_DS3_FRM_CFG, 0x01 }, { SUNI_DS3_TRAN_CFG, 0x01 }, @@ -898,7 +898,7 @@ static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev) static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev) { - static const struct ia_reg suni_e3_init [] = { + static const struct ia_reg suni_e3_init[] = { { SUNI_E3_FRM_FRAM_OPTIONS, 0x04 }, { SUNI_E3_FRM_MAINT_OPTIONS, 0x20 }, { SUNI_E3_FRM_FRAM_INTR_ENBL, 0x1d }, @@ -918,7 +918,7 @@ static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev) static void ia_suni_pm7345_init(struct iadev_priv *iadev) { - static const struct ia_reg suni_init [] = { + static const struct ia_reg suni_init[] = { /* Enable RSOP loss of signal interrupt. */ { SUNI_INTR_ENBL, 0x28 }, /* Clear error counters. */ -- cgit v1.2.3 From bde533f2ea607cbbbe76ef8738b36243939a7bc2 Mon Sep 17 00:00:00 2001 From: Arvind Yadav Date: Tue, 14 Nov 2017 13:42:38 +0530 Subject: atm: horizon: Fix irq release error atm_dev_register() can fail here and passed parameters to free irq which is not initialised. Initialization of 'dev->irq' happened after the 'goto out_free_irq'. So using 'irq' insted of 'dev->irq' in free_irq(). Signed-off-by: Arvind Yadav Signed-off-by: David S. Miller --- drivers/atm/horizon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/atm') diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index 7e76b35f422c..e121b8485731 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c @@ -2803,7 +2803,7 @@ out: return err; out_free_irq: - free_irq(dev->irq, dev); + free_irq(irq, dev); out_free: kfree(dev); out_release: -- cgit v1.2.3