diff mbox series

[net-next,05/12] net: enetc: squash clear_cbdr and free_cbdr into teardown_cbdr

Message ID 20210310120351.542292-6-vladimir.oltean@nxp.com (mailing list archive)
State Accepted
Commit 0bfde022b345763df70fdc73bcb5ab8943589487
Delegated to: Netdev Maintainers
Headers show
Series Refactoring/cleanup for NXP ENETC | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Vladimir Oltean <olteanv@gmail.com>' != 'Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>'
netdev/build_allmodconfig_warn success Errors and warnings before: 3 this patch: 3
netdev/header_inline success Link

Commit Message

Vladimir Oltean March 10, 2021, 12:03 p.m. UTC
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>
---
 drivers/net/ethernet/freescale/enetc/enetc.c      |  6 ++----
 drivers/net/ethernet/freescale/enetc/enetc.h      |  3 +--
 drivers/net/ethernet/freescale/enetc/enetc_cbdr.c | 11 ++++-------
 drivers/net/ethernet/freescale/enetc/enetc_pf.c   |  3 +--
 4 files changed, 8 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index b1077a6e2b2b..a32283533408 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -1078,8 +1078,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;
 }
@@ -1088,8 +1087,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,