* [PATCH net-next 0/4] cpsw cleanups
@ 2015-05-25 9:02 Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 1/4] net: cpsw: fix misplaced break statements Richard Cochran
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Richard Cochran @ 2015-05-25 9:02 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Mugunthan V N
While working on an out-of-tree customization, I noticed a few minor
problems in the cpsw code. This series cleans up the issues I found.
Thanks,
Richard
Richard Cochran (4):
net: cpsw: fix misplaced break statements.
net: cpsw: remove two unused global functions
net: cpsw: remove redundant calls enabling dma interrupts.
net: cpsw: remove redundant calls disabling dma interrupts.
drivers/net/ethernet/ti/cpsw.c | 9 ++------
drivers/net/ethernet/ti/cpsw_ale.c | 45 --------------------------------------
drivers/net/ethernet/ti/cpsw_ale.h | 2 --
3 files changed, 2 insertions(+), 54 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 1/4] net: cpsw: fix misplaced break statements.
2015-05-25 9:02 [PATCH net-next 0/4] cpsw cleanups Richard Cochran
@ 2015-05-25 9:02 ` Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 2/4] net: cpsw: remove two unused global functions Richard Cochran
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2015-05-25 9:02 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Mugunthan V N
Having the breaks too far to the left makes parsing the dense switch/case
block unnecessarily harder.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/ti/cpsw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index b536b4c..e9e3ab3 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1456,7 +1456,7 @@ static void cpsw_hwtstamp_v2(struct cpsw_priv *priv)
if (priv->cpts->rx_enable)
ctrl |= CTRL_V2_RX_TS_BITS;
- break;
+ break;
case CPSW_VERSION_3:
default:
ctrl &= ~CTRL_V3_ALL_TS_MASK;
@@ -1466,7 +1466,7 @@ static void cpsw_hwtstamp_v2(struct cpsw_priv *priv)
if (priv->cpts->rx_enable)
ctrl |= CTRL_V3_RX_TS_BITS;
- break;
+ break;
}
mtype = (30 << TS_SEQ_ID_OFFSET_SHIFT) | EVENT_MSG_BITS;
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/4] net: cpsw: remove two unused global functions
2015-05-25 9:02 [PATCH net-next 0/4] cpsw cleanups Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 1/4] net: cpsw: fix misplaced break statements Richard Cochran
@ 2015-05-25 9:02 ` Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 3/4] net: cpsw: remove redundant calls enabling dma interrupts Richard Cochran
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2015-05-25 9:02 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Mugunthan V N
The funtions, cpsw_ale_flush and cpsw_ale_set_ageout, have never been used
since they were first introduced. This patch removes the dead code.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/ti/cpsw_ale.c | 45 --------------------------------------
drivers/net/ethernet/ti/cpsw_ale.h | 2 --
2 files changed, 47 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 6e927b4..43b061b 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -268,39 +268,6 @@ int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid)
}
EXPORT_SYMBOL_GPL(cpsw_ale_flush_multicast);
-static void cpsw_ale_flush_ucast(struct cpsw_ale *ale, u32 *ale_entry,
- int port_mask)
-{
- int port;
-
- port = cpsw_ale_get_port_num(ale_entry);
- if ((BIT(port) & port_mask) == 0)
- return; /* ports dont intersect, not interested */
- cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE);
-}
-
-int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask)
-{
- u32 ale_entry[ALE_ENTRY_WORDS];
- int ret, idx;
-
- for (idx = 0; idx < ale->params.ale_entries; idx++) {
- cpsw_ale_read(ale, idx, ale_entry);
- ret = cpsw_ale_get_entry_type(ale_entry);
- if (ret != ALE_TYPE_ADDR && ret != ALE_TYPE_VLAN_ADDR)
- continue;
-
- if (cpsw_ale_get_mcast(ale_entry))
- cpsw_ale_flush_mcast(ale, ale_entry, port_mask);
- else
- cpsw_ale_flush_ucast(ale, ale_entry, port_mask);
-
- cpsw_ale_write(ale, idx, ale_entry);
- }
- return 0;
-}
-EXPORT_SYMBOL_GPL(cpsw_ale_flush);
-
static inline void cpsw_ale_set_vlan_entry_type(u32 *ale_entry,
int flags, u16 vid)
{
@@ -752,18 +719,6 @@ static void cpsw_ale_timer(unsigned long arg)
}
}
-int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout)
-{
- del_timer_sync(&ale->timer);
- ale->ageout = ageout * HZ;
- if (ale->ageout) {
- ale->timer.expires = jiffies + ale->ageout;
- add_timer(&ale->timer);
- }
- return 0;
-}
-EXPORT_SYMBOL_GPL(cpsw_ale_set_ageout);
-
void cpsw_ale_start(struct cpsw_ale *ale)
{
u32 rev;
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h
index af1e7ec..a700189 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.h
+++ b/drivers/net/ethernet/ti/cpsw_ale.h
@@ -90,8 +90,6 @@ int cpsw_ale_destroy(struct cpsw_ale *ale);
void cpsw_ale_start(struct cpsw_ale *ale);
void cpsw_ale_stop(struct cpsw_ale *ale);
-int cpsw_ale_set_ageout(struct cpsw_ale *ale, int ageout);
-int cpsw_ale_flush(struct cpsw_ale *ale, int port_mask);
int cpsw_ale_flush_multicast(struct cpsw_ale *ale, int port_mask, int vid);
int cpsw_ale_add_ucast(struct cpsw_ale *ale, u8 *addr, int port,
int flags, u16 vid);
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/4] net: cpsw: remove redundant calls enabling dma interrupts.
2015-05-25 9:02 [PATCH net-next 0/4] cpsw cleanups Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 1/4] net: cpsw: fix misplaced break statements Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 2/4] net: cpsw: remove two unused global functions Richard Cochran
@ 2015-05-25 9:02 ` Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 4/4] net: cpsw: remove redundant calls disabling " Richard Cochran
2015-05-25 22:19 ` [PATCH net-next 0/4] cpsw cleanups David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2015-05-25 9:02 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Mugunthan V N
The function, cpsw_intr_enable, already calls cpdma_ctlr_int_ctrl. There
is no need to enable the dma interrupts twice. This patch removes the
extra call.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/ti/cpsw.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e9e3ab3..0d0cf9a 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1592,7 +1592,6 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev)
cpdma_ctlr_int_ctrl(priv->dma, false);
cpdma_chan_stop(priv->txch);
cpdma_chan_start(priv->txch);
- cpdma_ctlr_int_ctrl(priv->dma, true);
cpsw_intr_enable(priv);
}
@@ -1632,7 +1631,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev)
cpdma_ctlr_int_ctrl(priv->dma, false);
cpsw_rx_interrupt(priv->irqs_table[0], priv);
cpsw_tx_interrupt(priv->irqs_table[1], priv);
- cpdma_ctlr_int_ctrl(priv->dma, true);
cpsw_intr_enable(priv);
}
#endif
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 4/4] net: cpsw: remove redundant calls disabling dma interrupts.
2015-05-25 9:02 [PATCH net-next 0/4] cpsw cleanups Richard Cochran
` (2 preceding siblings ...)
2015-05-25 9:02 ` [PATCH net-next 3/4] net: cpsw: remove redundant calls enabling dma interrupts Richard Cochran
@ 2015-05-25 9:02 ` Richard Cochran
2015-05-25 22:19 ` [PATCH net-next 0/4] cpsw cleanups David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2015-05-25 9:02 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Mugunthan V N
The function, cpsw_intr_disable, already calls cpdma_ctlr_int_ctrl. There
is no need to disable the dma interrupts twice. This patch removes the
extra calls.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
drivers/net/ethernet/ti/cpsw.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 0d0cf9a..4628205 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1361,7 +1361,6 @@ static int cpsw_ndo_stop(struct net_device *ndev)
if (cpsw_common_res_usage_state(priv) <= 1) {
cpts_unregister(priv->cpts);
cpsw_intr_disable(priv);
- cpdma_ctlr_int_ctrl(priv->dma, false);
cpdma_ctlr_stop(priv->dma);
cpsw_ale_stop(priv->ale);
}
@@ -1589,7 +1588,6 @@ static void cpsw_ndo_tx_timeout(struct net_device *ndev)
cpsw_err(priv, tx_err, "transmit timeout, restarting dma\n");
ndev->stats.tx_errors++;
cpsw_intr_disable(priv);
- cpdma_ctlr_int_ctrl(priv->dma, false);
cpdma_chan_stop(priv->txch);
cpdma_chan_start(priv->txch);
cpsw_intr_enable(priv);
@@ -1628,7 +1626,6 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev)
struct cpsw_priv *priv = netdev_priv(ndev);
cpsw_intr_disable(priv);
- cpdma_ctlr_int_ctrl(priv->dma, false);
cpsw_rx_interrupt(priv->irqs_table[0], priv);
cpsw_tx_interrupt(priv->irqs_table[1], priv);
cpsw_intr_enable(priv);
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/4] cpsw cleanups
2015-05-25 9:02 [PATCH net-next 0/4] cpsw cleanups Richard Cochran
` (3 preceding siblings ...)
2015-05-25 9:02 ` [PATCH net-next 4/4] net: cpsw: remove redundant calls disabling " Richard Cochran
@ 2015-05-25 22:19 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2015-05-25 22:19 UTC (permalink / raw)
To: richardcochran; +Cc: netdev, mugunthanvnm
From: Richard Cochran <richardcochran@gmail.com>
Date: Mon, 25 May 2015 11:02:12 +0200
> While working on an out-of-tree customization, I noticed a few minor
> problems in the cpsw code. This series cleans up the issues I found.
Series applied, thanks Richard.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-05-25 22:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-25 9:02 [PATCH net-next 0/4] cpsw cleanups Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 1/4] net: cpsw: fix misplaced break statements Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 2/4] net: cpsw: remove two unused global functions Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 3/4] net: cpsw: remove redundant calls enabling dma interrupts Richard Cochran
2015-05-25 9:02 ` [PATCH net-next 4/4] net: cpsw: remove redundant calls disabling " Richard Cochran
2015-05-25 22:19 ` [PATCH net-next 0/4] cpsw cleanups David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).