From 31c4fc7414a6c01a4a8341692f1ee181bf10b436 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 8 Feb 2024 14:48:50 +0100 Subject: [PATCH] ramips: 6.1: ralink: fix const warning in the ethernet driver Change fe_hw_set_macaddr and the set_mac parameter to const to fix errors in the form of: drivers/net/ethernet/ralink/mtk_eth_soc.c: In function 'fe_set_mac_address': drivers/net/ethernet/ralink/mtk_eth_soc.c:174:53: error: passing argument 2 of 'priv->soc->set_mac' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 174 | priv->soc->set_mac(priv, dev->dev_addr); | ~~~^~~~~~~~~~ drivers/net/ethernet/ralink/mtk_eth_soc.c:174:53: note: expected 'unsigned char *' but argument is of type 'const unsigned char *' drivers/net/ethernet/ralink/mtk_eth_soc.c: In function 'fe_hw_init': drivers/net/ethernet/ralink/mtk_eth_soc.c:1220:45: error: passing argument 2 of 'priv->soc->set_mac' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 1220 | priv->soc->set_mac(priv, dev->dev_addr); | ~~~^~~~~~~~~~ drivers/net/ethernet/ralink/mtk_eth_soc.c:1220:45: note: expected 'unsigned char *' but argument is of type 'const unsigned char *' drivers/net/ethernet/ralink/mtk_eth_soc.c:1222:44: error: passing argument 2 of 'fe_hw_set_macaddr' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] 1222 | fe_hw_set_macaddr(priv, dev->dev_addr); | ~~~^~~~~~~~~~ drivers/net/ethernet/ralink/mtk_eth_soc.c:155:75: note: expected 'unsigned char *' but argument is of type 'const unsigned char *' 155 | static inline void fe_hw_set_macaddr(struct fe_priv *priv, unsigned char *mac) | ~~~~~~~~~~~~~~~^~~ cc1: all warnings being treated as errors Signed-off-by: Nick Hainke --- .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 2 +- .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h | 2 +- .../linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c | 2 +- .../linux/ramips/files/drivers/net/ethernet/ralink/soc_rt3050.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c index c741c85f4a5..03e65a0c8a6 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c @@ -152,7 +152,7 @@ static inline void fe_int_enable(u32 mask) fe_reg_r32(FE_REG_FE_INT_ENABLE); } -static inline void fe_hw_set_macaddr(struct fe_priv *priv, unsigned char *mac) +static inline void fe_hw_set_macaddr(struct fe_priv *priv, const unsigned char *mac) { unsigned long flags; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h index 7b291ff43e5..364dd54a58f 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h @@ -378,7 +378,7 @@ struct fe_soc_data { const u16 *reg_table; void (*init_data)(struct fe_soc_data *data, struct net_device *netdev); - void (*set_mac)(struct fe_priv *priv, unsigned char *mac); + void (*set_mac)(struct fe_priv *priv, const unsigned char *mac); int (*fwd_config)(struct fe_priv *priv); void (*tx_dma)(struct fe_tx_dma *txd); int (*switch_init)(struct fe_priv *priv); diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c index 172dda11b75..e2b2aceff95 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_mt7620.c @@ -107,7 +107,7 @@ static int mt7620_gsw_config(struct fe_priv *priv) return 0; } -static void mt7620_set_mac(struct fe_priv *priv, unsigned char *mac) +static void mt7620_set_mac(struct fe_priv *priv, const unsigned char *mac) { struct mt7620_gsw *gsw = (struct mt7620_gsw *)priv->soc->swpriv; unsigned long flags; diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_rt3050.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_rt3050.c index 435f0074778..3f961797ed4 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_rt3050.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/soc_rt3050.c @@ -76,7 +76,7 @@ static void rt5350_init_data(struct fe_soc_data *data, netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM; } -static void rt5350_set_mac(struct fe_priv *priv, unsigned char *mac) +static void rt5350_set_mac(struct fe_priv *priv, const unsigned char *mac) { unsigned long flags;