Commit 0c3f3c4f authored by Andrew Halaney's avatar Andrew Halaney Committed by Paolo Abeni

net: stmmac: Remove some unnecessary void pointers

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: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarAndrew Halaney <ahalaney@redhat.com>
Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarBrian Masney <bmasney@redhat.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent d638dcb5
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include "stmmac.h" #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); unsigned int nopaged_len = skb_headlen(skb);
struct stmmac_priv *priv = tx_q->priv_data; struct stmmac_priv *priv = tx_q->priv_data;
unsigned int entry = tx_q->cur_tx; unsigned int entry = tx_q->cur_tx;
...@@ -125,9 +125,8 @@ static void init_dma_chain(void *des, dma_addr_t phy_addr, ...@@ -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; struct stmmac_priv *priv = rx_q->priv_data;
if (priv->hwts_rx_en && !priv->extend_desc) if (priv->hwts_rx_en && !priv->extend_desc)
...@@ -141,9 +140,8 @@ static void refill_desc3(void *priv_ptr, struct dma_desc *p) ...@@ -141,9 +140,8 @@ static void refill_desc3(void *priv_ptr, struct dma_desc *p)
sizeof(struct dma_desc))); 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; struct stmmac_priv *priv = tx_q->priv_data;
unsigned int entry = tx_q->dirty_tx; unsigned int entry = tx_q->dirty_tx;
......
...@@ -80,10 +80,10 @@ static void dwmac100_dump_dma_regs(void __iomem *ioaddr, u32 *reg_space) ...@@ -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. */ /* 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) void __iomem *ioaddr)
{ {
struct net_device_stats *stats = (struct net_device_stats *)data;
u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR); u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR);
if (unlikely(csr8)) { if (unlikely(csr8)) {
......
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
#include "dwmac4.h" #include "dwmac4.h"
#include "dwmac4_descs.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, struct dma_desc *p,
void __iomem *ioaddr) void __iomem *ioaddr)
{ {
struct net_device_stats *stats = (struct net_device_stats *)data;
unsigned int tdes3; unsigned int tdes3;
int ret = tx_done; int ret = tx_done;
...@@ -73,10 +73,10 @@ static int dwmac4_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x, ...@@ -73,10 +73,10 @@ static int dwmac4_wrback_get_tx_status(void *data, struct stmmac_extra_stats *x,
return ret; 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 dma_desc *p)
{ {
struct net_device_stats *stats = (struct net_device_stats *)data;
unsigned int rdes1 = le32_to_cpu(p->des1); unsigned int rdes1 = le32_to_cpu(p->des1);
unsigned int rdes2 = le32_to_cpu(p->des2); unsigned int rdes2 = le32_to_cpu(p->des2);
unsigned int rdes3 = le32_to_cpu(p->des3); unsigned int rdes3 = le32_to_cpu(p->des3);
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
#include "common.h" #include "common.h"
#include "dwxgmac2.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) struct dma_desc *p, void __iomem *ioaddr)
{ {
unsigned int tdes3 = le32_to_cpu(p->des3); 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, ...@@ -22,7 +23,8 @@ static int dwxgmac2_get_tx_status(void *data, struct stmmac_extra_stats *x,
return ret; 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) struct dma_desc *p)
{ {
unsigned int rdes3 = le32_to_cpu(p->des3); unsigned int rdes3 = le32_to_cpu(p->des3);
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "common.h" #include "common.h"
#include "descs_com.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 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 tdes0 = le32_to_cpu(p->des0);
int ret = tx_done; int ret = tx_done;
...@@ -117,7 +117,8 @@ static int enh_desc_coe_rdes0(int ipc_err, int type, int payload_err) ...@@ -117,7 +117,8 @@ static int enh_desc_coe_rdes0(int ipc_err, int type, int payload_err)
return ret; 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) struct dma_extended_desc *p)
{ {
unsigned int rdes0 = le32_to_cpu(p->basic.des0); 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, ...@@ -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 dma_desc *p)
{ {
struct net_device_stats *stats = (struct net_device_stats *)data;
unsigned int rdes0 = le32_to_cpu(p->des0); unsigned int rdes0 = le32_to_cpu(p->des0);
int ret = good_frame; int ret = good_frame;
......
...@@ -56,7 +56,8 @@ struct stmmac_desc_ops { ...@@ -56,7 +56,8 @@ struct stmmac_desc_ops {
/* Last tx segment reports the transmit status */ /* Last tx segment reports the transmit status */
int (*get_tx_ls)(struct dma_desc *p); int (*get_tx_ls)(struct dma_desc *p);
/* Return the transmit status looking at the TDES1 */ /* Return the transmit status looking at the TDES1 */
int (*tx_status)(void *data, struct stmmac_extra_stats *x, int (*tx_status)(struct net_device_stats *stats,
struct stmmac_extra_stats *x,
struct dma_desc *p, void __iomem *ioaddr); struct dma_desc *p, void __iomem *ioaddr);
/* Get the buffer size from the descriptor */ /* Get the buffer size from the descriptor */
int (*get_tx_len)(struct dma_desc *p); int (*get_tx_len)(struct dma_desc *p);
...@@ -65,9 +66,11 @@ struct stmmac_desc_ops { ...@@ -65,9 +66,11 @@ struct stmmac_desc_ops {
/* Get the receive frame size */ /* Get the receive frame size */
int (*get_rx_frame_len)(struct dma_desc *p, int rx_coe_type); int (*get_rx_frame_len)(struct dma_desc *p, int rx_coe_type);
/* Return the reception status looking at the RDES1 */ /* Return the reception status looking at the RDES1 */
int (*rx_status)(void *data, struct stmmac_extra_stats *x, int (*rx_status)(struct net_device_stats *stats,
struct stmmac_extra_stats *x,
struct dma_desc *p); struct dma_desc *p);
void (*rx_extended_status)(void *data, struct stmmac_extra_stats *x, void (*rx_extended_status)(struct net_device_stats *stats,
struct stmmac_extra_stats *x,
struct dma_extended_desc *p); struct dma_extended_desc *p);
/* Set tx timestamp enable bit */ /* Set tx timestamp enable bit */
void (*enable_tx_timestamp) (struct dma_desc *p); void (*enable_tx_timestamp) (struct dma_desc *p);
...@@ -185,7 +188,8 @@ struct stmmac_dma_ops { ...@@ -185,7 +188,8 @@ struct stmmac_dma_ops {
void (*dma_tx_mode)(void __iomem *ioaddr, int mode, u32 channel, void (*dma_tx_mode)(void __iomem *ioaddr, int mode, u32 channel,
int fifosz, u8 qmode); int fifosz, u8 qmode);
/* To track extra statistic (if supported) */ /* To track extra statistic (if supported) */
void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x, void (*dma_diagnostic_fr)(struct net_device_stats *stats,
struct stmmac_extra_stats *x,
void __iomem *ioaddr); void __iomem *ioaddr);
void (*enable_dma_transmission) (void __iomem *ioaddr); void (*enable_dma_transmission) (void __iomem *ioaddr);
void (*enable_dma_irq)(void __iomem *ioaddr, u32 chan, void (*enable_dma_irq)(void __iomem *ioaddr, u32 chan,
...@@ -533,16 +537,20 @@ struct stmmac_hwtimestamp { ...@@ -533,16 +537,20 @@ struct stmmac_hwtimestamp {
#define stmmac_timestamp_interrupt(__priv, __args...) \ #define stmmac_timestamp_interrupt(__priv, __args...) \
stmmac_do_void_callback(__priv, ptp, timestamp_interrupt, __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 */ /* Helpers to manage the descriptors for chain and ring modes */
struct stmmac_mode_ops { struct stmmac_mode_ops {
void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, void (*init) (void *des, dma_addr_t phy_addr, unsigned int size,
unsigned int extend_desc); unsigned int extend_desc);
unsigned int (*is_jumbo_frm) (int len, int ehn_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); int (*set_16kib_bfsize)(int mtu);
void (*init_desc3)(struct dma_desc *p); void (*init_desc3)(struct dma_desc *p);
void (*refill_desc3) (void *priv, struct dma_desc *p); void (*refill_desc3)(struct stmmac_rx_queue *rx_q, struct dma_desc *p);
void (*clean_desc3) (void *priv, struct dma_desc *p); void (*clean_desc3)(struct stmmac_tx_queue *tx_q, struct dma_desc *p);
}; };
#define stmmac_mode_init(__priv, __args...) \ #define stmmac_mode_init(__priv, __args...) \
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "common.h" #include "common.h"
#include "descs_com.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 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 tdes0 = le32_to_cpu(p->des0);
unsigned int tdes1 = le32_to_cpu(p->des1); unsigned int tdes1 = le32_to_cpu(p->des1);
int ret = tx_done; int ret = tx_done;
...@@ -70,12 +70,12 @@ static int ndesc_get_tx_len(struct dma_desc *p) ...@@ -70,12 +70,12 @@ static int ndesc_get_tx_len(struct dma_desc *p)
* and, if required, updates the multicast statistics. * and, if required, updates the multicast statistics.
* In case of success, it returns good_frame because the GMAC device * In case of success, it returns good_frame because the GMAC device
* is supposed to be able to compute the csum in HW. */ * 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) struct dma_desc *p)
{ {
int ret = good_frame; int ret = good_frame;
unsigned int rdes0 = le32_to_cpu(p->des0); unsigned int rdes0 = le32_to_cpu(p->des0);
struct net_device_stats *stats = (struct net_device_stats *)data;
if (unlikely(rdes0 & RDES0_OWN)) if (unlikely(rdes0 & RDES0_OWN))
return dma_own; return dma_own;
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
#include "stmmac.h" #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); unsigned int nopaged_len = skb_headlen(skb);
struct stmmac_priv *priv = tx_q->priv_data; struct stmmac_priv *priv = tx_q->priv_data;
unsigned int entry = tx_q->cur_tx; unsigned int entry = tx_q->cur_tx;
...@@ -101,9 +101,8 @@ static unsigned int is_jumbo_frm(int len, int enh_desc) ...@@ -101,9 +101,8 @@ static unsigned int is_jumbo_frm(int len, int enh_desc)
return ret; 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; struct stmmac_priv *priv = rx_q->priv_data;
/* Fill DES3 in case of RING mode */ /* Fill DES3 in case of RING mode */
...@@ -117,9 +116,8 @@ static void init_desc3(struct dma_desc *p) ...@@ -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); 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; struct stmmac_priv *priv = tx_q->priv_data;
unsigned int entry = tx_q->dirty_tx; unsigned int entry = tx_q->dirty_tx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment