]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: stmmac: Remove some unnecessary void pointers
authorAndrew Halaney <ahalaney@redhat.com>
Tue, 11 Apr 2023 20:04:04 +0000 (15:04 -0500)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 13 Apr 2023 10:50:46 +0000 (12:50 +0200)
There's a few spots in the hardware interface where a void pointer is
used, but what's passed in and later cast out is always the same type.

Just use the proper type directly.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/stmicro/stmmac/chain_mode.c
drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c
drivers/net/ethernet/stmicro/stmmac/enh_desc.c
drivers/net/ethernet/stmicro/stmmac/hwif.h
drivers/net/ethernet/stmicro/stmmac/norm_desc.c
drivers/net/ethernet/stmicro/stmmac/ring_mode.c

index 2e8744ac6b91aee6d0072694d10be6886c64d5da..fb55efd52240d066f913028ea0f919b37a68b789 100644 (file)
@@ -14,9 +14,9 @@
 
 #include "stmmac.h"
 
-static int jumbo_frm(void *p, struct sk_buff *skb, int csum)
+static int jumbo_frm(struct stmmac_tx_queue *tx_q, struct sk_buff *skb,
+                    int csum)
 {
-       struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)p;
        unsigned int nopaged_len = skb_headlen(skb);
        struct stmmac_priv *priv = tx_q->priv_data;
        unsigned int entry = tx_q->cur_tx;
@@ -125,9 +125,8 @@ static void init_dma_chain(void *des, dma_addr_t phy_addr,
        }
 }
 
-static void refill_desc3(void *priv_ptr, struct dma_desc *p)
+static void refill_desc3(struct stmmac_rx_queue *rx_q, struct dma_desc *p)
 {
-       struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)priv_ptr;
        struct stmmac_priv *priv = rx_q->priv_data;
 
        if (priv->hwts_rx_en && !priv->extend_desc)
@@ -141,9 +140,8 @@ static void refill_desc3(void *priv_ptr, struct dma_desc *p)
                                      sizeof(struct dma_desc)));
 }
 
-static void clean_desc3(void *priv_ptr, struct dma_desc *p)
+static void clean_desc3(struct stmmac_tx_queue *tx_q, struct dma_desc *p)
 {
-       struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)priv_ptr;
        struct stmmac_priv *priv = tx_q->priv_data;
        unsigned int entry = tx_q->dirty_tx;
 
index 8f0d9bc7cab54aae379b640d6dfa55d76d579991..f6abc7bfd29d4154432141a3a577cee6186b2742 100644 (file)
@@ -80,10 +80,10 @@ static void dwmac100_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space)
 }
 
 /* DMA controller has two counters to track the number of the missed frames. */
-static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,
+static void dwmac100_dma_diagnostic_fr(struct net_device_stats *stats,
+                                      struct stmmac_extra_stats *x,
                                       void __iomem *ioaddr)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)data;
        u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR);
 
        if (unlikely(csr8)) {
index 8cc80b1db4cbc477037225a41b4d78ec5e72c88e..6a011d8633e8e04f4dd97bed6f3c0f902492acfd 100644 (file)
 #include "dwmac4.h"
 #include "dwmac4_descs.h"
 
-static int dwmac4_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x,
+static int dwmac4_wrback_get_tx_status(struct net_device_stats *stats,
+                                      struct stmmac_extra_stats *x,
                                       struct dma_desc *p,
                                       void __iomem *ioaddr)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)data;
        unsigned int tdes3;
        int ret = tx_done;
 
@@ -73,10 +73,10 @@ static int dwmac4_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x,
        return ret;
 }
 
-static int dwmac4_wrback_get_rx_status(void *data, struct stmmac_extra_stats *x,
+static int dwmac4_wrback_get_rx_status(struct net_device_stats *stats,
+                                      struct stmmac_extra_stats *x,
                                       struct dma_desc *p)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)data;
        unsigned int rdes1 = le32_to_cpu(p->des1);
        unsigned int rdes2 = le32_to_cpu(p->des2);
        unsigned int rdes3 = le32_to_cpu(p->des3);
index b1f0c3984a093ffbb6a12bf59bb58be3547222f1..13c347ee8be9cd7bb0adba29e90d79e5a7f009c0 100644 (file)
@@ -8,7 +8,8 @@
 #include "common.h"
 #include "dwxgmac2.h"
 
-static int dwxgmac2_get_tx_status(void *data, struct stmmac_extra_stats *x,
+static int dwxgmac2_get_tx_status(struct net_device_stats *stats,
+                                 struct stmmac_extra_stats *x,
                                  struct dma_desc *p, void __iomem *ioaddr)
 {
        unsigned int tdes3 = le32_to_cpu(p->des3);
@@ -22,7 +23,8 @@ static int dwxgmac2_get_tx_status(void *data, struct stmmac_extra_stats *x,
        return ret;
 }
 
-static int dwxgmac2_get_rx_status(void *data, struct stmmac_extra_stats *x,
+static int dwxgmac2_get_rx_status(struct net_device_stats *stats,
+                                 struct stmmac_extra_stats *x,
                                  struct dma_desc *p)
 {
        unsigned int rdes3 = le32_to_cpu(p->des3);
index 1bcbbd724fb52fd62b3bab2440c806051f043ba2..a91d8f13a931d0c218c635edc40b52d19317d8a3 100644 (file)
 #include "common.h"
 #include "descs_com.h"
 
-static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x,
+static int enh_desc_get_tx_status(struct net_device_stats *stats,
+                                 struct stmmac_extra_stats *x,
                                  struct dma_desc *p, void __iomem *ioaddr)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)data;
        unsigned int tdes0 = le32_to_cpu(p->des0);
        int ret = tx_done;
 
@@ -117,7 +117,8 @@ static int enh_desc_coe_rdes0(int ipc_err, int type, int payload_err)
        return ret;
 }
 
-static void enh_desc_get_ext_status(void *data, struct stmmac_extra_stats *x,
+static void enh_desc_get_ext_status(struct net_device_stats *stats,
+                                   struct stmmac_extra_stats *x,
                                    struct dma_extended_desc *p)
 {
        unsigned int rdes0 = le32_to_cpu(p->basic.des0);
@@ -181,10 +182,10 @@ static void enh_desc_get_ext_status(void *data, struct stmmac_extra_stats *x,
        }
 }
 
-static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
+static int enh_desc_get_rx_status(struct net_device_stats *stats,
+                                 struct stmmac_extra_stats *x,
                                  struct dma_desc *p)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)data;
        unsigned int rdes0 = le32_to_cpu(p->des0);
        int ret = good_frame;
 
index 1cc286b000b6397f7cb25e263be77b33153a0b4c..7f906ef3ea4f45b6777f6fb60d510f14c1b123ab 100644 (file)
@@ -56,8 +56,9 @@ struct stmmac_desc_ops {
        /* Last tx segment reports the transmit status */
        int (*get_tx_ls)(struct dma_desc *p);
        /* Return the transmit status looking at the TDES1 */
-       int (*tx_status)(void *data, struct stmmac_extra_stats *x,
-                       struct dma_desc *p, void __iomem *ioaddr);
+       int (*tx_status)(struct net_device_stats *stats,
+                        struct stmmac_extra_stats *x,
+                        struct dma_desc *p, void __iomem *ioaddr);
        /* Get the buffer size from the descriptor */
        int (*get_tx_len)(struct dma_desc *p);
        /* Handle extra events on specific interrupts hw dependent */
@@ -65,10 +66,12 @@ struct stmmac_desc_ops {
        /* Get the receive frame size */
        int (*get_rx_frame_len)(struct dma_desc *p, int rx_coe_type);
        /* Return the reception status looking at the RDES1 */
-       int (*rx_status)(void *data, struct stmmac_extra_stats *x,
-                       struct dma_desc *p);
-       void (*rx_extended_status)(void *data, struct stmmac_extra_stats *x,
-                       struct dma_extended_desc *p);
+       int (*rx_status)(struct net_device_stats *stats,
+                        struct stmmac_extra_stats *x,
+                        struct dma_desc *p);
+       void (*rx_extended_status)(struct net_device_stats *stats,
+                                  struct stmmac_extra_stats *x,
+                                  struct dma_extended_desc *p);
        /* Set tx timestamp enable bit */
        void (*enable_tx_timestamp) (struct dma_desc *p);
        /* get tx timestamp status */
@@ -185,8 +188,9 @@ struct stmmac_dma_ops {
        void (*dma_tx_mode)(void __iomem *ioaddr, int mode, u32 channel,
                            int fifosz, u8 qmode);
        /* To track extra statistic (if supported) */
-       void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
-                                  void __iomem *ioaddr);
+       void (*dma_diagnostic_fr)(struct net_device_stats *stats,
+                                 struct stmmac_extra_stats *x,
+                                 void __iomem *ioaddr);
        void (*enable_dma_transmission) (void __iomem *ioaddr);
        void (*enable_dma_irq)(void __iomem *ioaddr, u32 chan,
                               bool rx, bool tx);
@@ -533,16 +537,20 @@ struct stmmac_hwtimestamp {
 #define stmmac_timestamp_interrupt(__priv, __args...) \
        stmmac_do_void_callback(__priv, ptp, timestamp_interrupt, __args)
 
+struct stmmac_tx_queue;
+struct stmmac_rx_queue;
+
 /* Helpers to manage the descriptors for chain and ring modes */
 struct stmmac_mode_ops {
        void (*init) (void *des, dma_addr_t phy_addr, unsigned int size,
                      unsigned int extend_desc);
        unsigned int (*is_jumbo_frm) (int len, int ehn_desc);
-       int (*jumbo_frm)(void *priv, struct sk_buff *skb, int csum);
+       int (*jumbo_frm)(struct stmmac_tx_queue *tx_q, struct sk_buff *skb,
+                        int csum);
        int (*set_16kib_bfsize)(int mtu);
        void (*init_desc3)(struct dma_desc *p);
-       void (*refill_desc3) (void *priv, struct dma_desc *p);
-       void (*clean_desc3) (void *priv, struct dma_desc *p);
+       void (*refill_desc3)(struct stmmac_rx_queue *rx_q, struct dma_desc *p);
+       void (*clean_desc3)(struct stmmac_tx_queue *tx_q, struct dma_desc *p);
 };
 
 #define stmmac_mode_init(__priv, __args...) \
index e3da4da242ee59fc8e7cd349575c9f202a0d0a43..350e6670a5766d1dea7a3f97c0f7ecb1cfe26aa6 100644 (file)
 #include "common.h"
 #include "descs_com.h"
 
-static int ndesc_get_tx_status(void *data, struct stmmac_extra_stats *x,
+static int ndesc_get_tx_status(struct net_device_stats *stats,
+                              struct stmmac_extra_stats *x,
                               struct dma_desc *p, void __iomem *ioaddr)
 {
-       struct net_device_stats *stats = (struct net_device_stats *)data;
        unsigned int tdes0 = le32_to_cpu(p->des0);
        unsigned int tdes1 = le32_to_cpu(p->des1);
        int ret = tx_done;
@@ -70,12 +70,12 @@ static int ndesc_get_tx_len(struct dma_desc *p)
  * and, if required, updates the multicast statistics.
  * In case of success, it returns good_frame because the GMAC device
  * is supposed to be able to compute the csum in HW. */
-static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
+static int ndesc_get_rx_status(struct net_device_stats *stats,
+                              struct stmmac_extra_stats *x,
                               struct dma_desc *p)
 {
        int ret = good_frame;
        unsigned int rdes0 = le32_to_cpu(p->des0);
-       struct net_device_stats *stats = (struct net_device_stats *)data;
 
        if (unlikely(rdes0 & RDES0_OWN))
                return dma_own;
index 2b5b17d8b8a01932fd2c4b68be03f519baf4cec2..d218412ca832f5ba93fbda657365ae417943bc28 100644 (file)
@@ -14,9 +14,9 @@
 
 #include "stmmac.h"
 
-static int jumbo_frm(void *p, struct sk_buff *skb, int csum)
+static int jumbo_frm(struct stmmac_tx_queue *tx_q, struct sk_buff *skb,
+                    int csum)
 {
-       struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)p;
        unsigned int nopaged_len = skb_headlen(skb);
        struct stmmac_priv *priv = tx_q->priv_data;
        unsigned int entry = tx_q->cur_tx;
@@ -101,9 +101,8 @@ static unsigned int is_jumbo_frm(int len, int enh_desc)
        return ret;
 }
 
-static void refill_desc3(void *priv_ptr, struct dma_desc *p)
+static void refill_desc3(struct stmmac_rx_queue *rx_q, struct dma_desc *p)
 {
-       struct stmmac_rx_queue *rx_q = priv_ptr;
        struct stmmac_priv *priv = rx_q->priv_data;
 
        /* Fill DES3 in case of RING mode */
@@ -117,9 +116,8 @@ static void init_desc3(struct dma_desc *p)
        p->des3 = cpu_to_le32(le32_to_cpu(p->des2) + BUF_SIZE_8KiB);
 }
 
-static void clean_desc3(void *priv_ptr, struct dma_desc *p)
+static void clean_desc3(struct stmmac_tx_queue *tx_q, struct dma_desc *p)
 {
-       struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)priv_ptr;
        struct stmmac_priv *priv = tx_q->priv_data;
        unsigned int entry = tx_q->dirty_tx;