aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Oltean2021-03-10 14:03:44 +0200
committerDavid S. Miller2021-03-10 13:14:15 -0800
commit0bfde022b345763df70fdc73bcb5ab8943589487 (patch)
tree4d42b999b59fb990b905d3015c5180f45e568acd
parent27f9025d49416e35bd7f1cedc9edd0388612501f (diff)
net: enetc: squash clear_cbdr and free_cbdr into teardown_cbdr
All call sites call enetc_clear_cbdr and enetc_free_cbdr one after another, so let's combine the two functions into a single method named enetc_teardown_cbdr which does both, and in the same order. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/freescale/enetc/enetc.c6
-rw-r--r--drivers/net/ethernet/freescale/enetc/enetc.h3
-rw-r--r--drivers/net/ethernet/freescale/enetc/enetc_cbdr.c11
-rw-r--r--drivers/net/ethernet/freescale/enetc/enetc_pf.c3
4 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index 80f80a1c7dd2..ff507b4ab478 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -1074,8 +1074,7 @@ int enetc_alloc_si_resources(struct enetc_ndev_priv *priv)
return 0;
err_alloc_cls:
- enetc_clear_cbdr(&si->cbd_ring);
- enetc_free_cbdr(&si->cbd_ring);
+ enetc_teardown_cbdr(&si->cbd_ring);
return err;
}
@@ -1084,8 +1083,7 @@ void enetc_free_si_resources(struct enetc_ndev_priv *priv)
{
struct enetc_si *si = priv->si;
- enetc_clear_cbdr(&si->cbd_ring);
- enetc_free_cbdr(&si->cbd_ring);
+ enetc_teardown_cbdr(&si->cbd_ring);
kfree(priv->cls_rules);
}
diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
index 9d4dbeef61ac..19772be63a2c 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.h
+++ b/drivers/net/ethernet/freescale/enetc/enetc.h
@@ -314,8 +314,7 @@ void enetc_set_ethtool_ops(struct net_device *ndev);
/* control buffer descriptor ring (CBDR) */
int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw,
struct enetc_cbdr *cbdr);
-void enetc_free_cbdr(struct enetc_cbdr *cbdr);
-void enetc_clear_cbdr(struct enetc_cbdr *cbdr);
+void enetc_teardown_cbdr(struct enetc_cbdr *cbdr);
int enetc_set_mac_flt_entry(struct enetc_si *si, int index,
char *mac_addr, int si_map);
int enetc_clear_mac_flt_entry(struct enetc_si *si, int index);
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c b/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c
index bb20a58e8830..bee453be2240 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_cbdr.c
@@ -44,22 +44,19 @@ int enetc_setup_cbdr(struct device *dev, struct enetc_hw *hw,
return 0;
}
-void enetc_free_cbdr(struct enetc_cbdr *cbdr)
+void enetc_teardown_cbdr(struct enetc_cbdr *cbdr)
{
int size = cbdr->bd_count * sizeof(struct enetc_cbd);
+ /* disable ring */
+ enetc_wr_reg(cbdr->mr, 0);
+
dma_free_coherent(cbdr->dma_dev, size, cbdr->bd_base,
cbdr->bd_dma_base);
cbdr->bd_base = NULL;
cbdr->dma_dev = NULL;
}
-void enetc_clear_cbdr(struct enetc_cbdr *cbdr)
-{
- /* disable ring */
- enetc_wr_reg(cbdr->mr, 0);
-}
-
static void enetc_clean_cbdr(struct enetc_cbdr *ring)
{
struct enetc_cbd *dest_cbd;
diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
index f083d49d7772..4dd7199d5007 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
@@ -1095,8 +1095,7 @@ static void enetc_init_unused_port(struct enetc_si *si)
enetc_init_port_rfs_memory(si);
enetc_init_port_rss_memory(si);
- enetc_clear_cbdr(&si->cbd_ring);
- enetc_free_cbdr(&si->cbd_ring);
+ enetc_teardown_cbdr(&si->cbd_ring);
}
static int enetc_pf_probe(struct pci_dev *pdev,