Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

stmmac: platform: fix sparse warnings

This patch fixes the following sparse warnings. One is fixed by casting return
value to a return type of the function. The others by creating a specific
stmmac_platform.h which provides the bits related to the platform driver.

drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c:59:29: warning: incorrect type in return expression (different address spaces)
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c:59:29: expected void *
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c:59:29: got void [noderef] <asn:2>*reg

drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c:64:29: warning: symbol 'meson6_dwmac_data' was not declared. Should it be static?
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c:354:29: warning: symbol 'stih4xx_dwmac_data' was not declared. Should it be static?
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c:361:29: warning: symbol 'stid127_dwmac_data' was not declared. Should it be static?
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c:133:29: warning: symbol 'sun7i_gmac_data' was not declared. Should it be static?

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andy Shevchenko and committed by
David S. Miller
f10f9fb2 424c4f78

+39 -6
+3 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c
··· 18 18 #include <linux/platform_device.h> 19 19 #include <linux/stmmac.h> 20 20 21 + #include "stmmac_platform.h" 22 + 21 23 #define ETHMAC_SPEED_100 BIT(1) 22 24 23 25 struct meson_dwmac { ··· 58 56 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 59 57 dwmac->reg = devm_ioremap_resource(&pdev->dev, res); 60 58 if (IS_ERR(dwmac->reg)) 61 - return dwmac->reg; 59 + return ERR_CAST(dwmac->reg); 62 60 63 61 return dwmac; 64 62 }
+2
drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
··· 23 23 #include <linux/regmap.h> 24 24 #include <linux/reset.h> 25 25 #include <linux/stmmac.h> 26 + 26 27 #include "stmmac.h" 28 + #include "stmmac_platform.h" 27 29 28 30 #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII 0x0 29 31 #define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII 0x1
+2
drivers/net/ethernet/stmicro/stmmac/dwmac-sti.c
··· 22 22 #include <linux/of.h> 23 23 #include <linux/of_net.h> 24 24 25 + #include "stmmac_platform.h" 26 + 25 27 #define DWMAC_125MHZ 125000000 26 28 #define DWMAC_50MHZ 50000000 27 29 #define DWMAC_25MHZ 25000000
+2
drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c
··· 22 22 #include <linux/of_net.h> 23 23 #include <linux/regulator/consumer.h> 24 24 25 + #include "stmmac_platform.h" 26 + 25 27 struct sunxi_priv_data { 26 28 int interface; 27 29 int clk_enabled;
-5
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 135 135 bool stmmac_eee_init(struct stmmac_priv *priv); 136 136 137 137 #ifdef CONFIG_STMMAC_PLATFORM 138 - extern const struct stmmac_of_data meson6_dwmac_data; 139 - extern const struct stmmac_of_data sun7i_gmac_data; 140 - extern const struct stmmac_of_data stih4xx_dwmac_data; 141 - extern const struct stmmac_of_data stid127_dwmac_data; 142 - extern const struct stmmac_of_data socfpga_gmac_data; 143 138 extern struct platform_driver stmmac_pltfr_driver; 144 139 145 140 static inline int stmmac_register_platform(void)
+2
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 27 27 #include <linux/of.h> 28 28 #include <linux/of_net.h> 29 29 #include <linux/of_device.h> 30 + 30 31 #include "stmmac.h" 32 + #include "stmmac_platform.h" 31 33 32 34 static const struct of_device_id stmmac_dt_ids[] = { 33 35 /* SoC specific glue layers should come before generic bindings */
+28
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h
··· 1 + /******************************************************************************* 2 + Copyright (C) 2007-2009 STMicroelectronics Ltd 3 + 4 + This program is free software; you can redistribute it and/or modify it 5 + under the terms and conditions of the GNU General Public License, 6 + version 2, as published by the Free Software Foundation. 7 + 8 + This program is distributed in the hope it will be useful, but WITHOUT 9 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 + more details. 12 + 13 + The full GNU General Public License is included in this distribution in 14 + the file called "COPYING". 15 + 16 + Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> 17 + *******************************************************************************/ 18 + 19 + #ifndef __STMMAC_PLATFORM_H__ 20 + #define __STMMAC_PLATFORM_H__ 21 + 22 + extern const struct stmmac_of_data meson6_dwmac_data; 23 + extern const struct stmmac_of_data sun7i_gmac_data; 24 + extern const struct stmmac_of_data stih4xx_dwmac_data; 25 + extern const struct stmmac_of_data stid127_dwmac_data; 26 + extern const struct stmmac_of_data socfpga_gmac_data; 27 + 28 + #endif /* __STMMAC_PLATFORM_H__ */