Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch
From: kbuild test robot
Date: Tue Mar 14 2017 - 22:31:04 EST
Hi Sean,
[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.11-rc2 next-20170310]
[cannot apply to net-next/master net/master]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/sean-wang-mediatek-com/dt-bindings-net-dsa-add-Mediatek-MT7530-binding/20170315-083834
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/net/dsa/mt7530.c: In function 'mt7530_probe':
drivers/net/dsa/mt7530.c:1076:27: warning: unused variable 'mdio' [-Wunused-variable]
struct device_node *dn, *mdio;
^~~~
drivers/net/dsa/mt7530.c: In function 'mt7530_remove':
>> drivers/net/dsa/mt7530.c:1173:9: warning: 'return' with a value, in function returning void
return ret;
^~~
drivers/net/dsa/mt7530.c:1153:1: note: declared here
mt7530_remove(struct mdio_device *mdiodev)
^~~~~~~~~~~~~
vim +/return +1173 drivers/net/dsa/mt7530.c
1070 };
1071
1072 static int
1073 mt7530_probe(struct mdio_device *mdiodev)
1074 {
1075 struct mt7530_priv *priv;
> 1076 struct device_node *dn, *mdio;
1077 int ret;
1078 const char *pm;
1079
1080 dn = mdiodev->dev.of_node;
1081
1082 priv = devm_kzalloc(&mdiodev->dev, sizeof(*priv), GFP_KERNEL);
1083 if (!priv)
1084 return -ENOMEM;
1085
1086 priv->ds = devm_kzalloc(&mdiodev->dev, sizeof(*priv->ds), GFP_KERNEL);
1087 if (!priv->ds)
1088 return -ENOMEM;
1089
1090 /* Use medatek,mcm property to distinguish hardware type that would
1091 * casues a little bit differences on power-on sequence.
1092 */
1093 ret = of_property_read_string(dn, "mediatek,mcm", &pm);
1094 if (!ret && !strcasecmp(pm, "enabled")) {
1095 priv->mcm = true;
1096 dev_info(&mdiodev->dev, "MT7530 adapts as multi-chip module\n");
1097 }
1098
1099 priv->core_pwr = devm_regulator_get(&mdiodev->dev, "core");
1100 if (IS_ERR(priv->core_pwr))
1101 return PTR_ERR(priv->core_pwr);
1102
1103 priv->io_pwr = devm_regulator_get(&mdiodev->dev, "io");
1104 if (IS_ERR(priv->io_pwr))
1105 return PTR_ERR(priv->io_pwr);
1106
1107 /* MT7530 shares the certain address space with Mediatek Ethernet
1108 * driver for controling TRGMII. Here we create syscon regmap for
1109 * access and control these parameters up on TRGMII.
1110 */
1111 priv->ethsys = syscon_regmap_lookup_by_phandle(dn,
1112 "mediatek,ethsys");
1113 if (IS_ERR(priv->ethsys))
1114 return PTR_ERR(priv->ethsys);
1115
1116 priv->ethernet = syscon_regmap_lookup_by_phandle(dn,
1117 "mediatek,ethernet");
1118 if (IS_ERR(priv->ethernet))
1119 return PTR_ERR(priv->ethernet);
1120
1121 /* Not MCM that indicates switch works as the remote standalone
1122 * integrated circuit so the GPIO pin would be used to complete
1123 * the reset, otherwise memory-mapped register accessing used
1124 * through syscon provides in the case of MCM.
1125 */
1126 if (!priv->mcm) {
1127 priv->reset = of_get_named_gpio(dn, "mediatek,reset-pin", 0);
1128 if (!gpio_is_valid(priv->reset))
1129 return priv->reset;
1130
1131 ret = devm_gpio_request_one(&mdiodev->dev,
1132 priv->reset, GPIOF_OUT_INIT_LOW,
1133 "mediatek,reset-pin");
1134 if (ret < 0) {
1135 dev_err(&mdiodev->dev,
1136 "fail to devm_gpio_request reset\n");
1137 return ret;
1138 }
1139 }
1140
1141 priv->bus = mdiodev->bus;
1142 priv->dev = &mdiodev->dev;
1143 priv->ds->priv = priv;
1144 priv->ds->dev = &mdiodev->dev;
1145 priv->ds->ops = &mt7530_switch_ops;
1146 mutex_init(&priv->reg_mutex);
1147 dev_set_drvdata(&mdiodev->dev, priv);
1148
1149 return dsa_register_switch(priv->ds, priv->ds->dev->of_node);
1150 }
1151
1152 static void
1153 mt7530_remove(struct mdio_device *mdiodev)
1154 {
1155 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
1156 int ret = 0;
1157
1158 ret = regulator_disable(priv->core_pwr);
1159 if (ret < 0) {
1160 dev_err(priv->dev,
1161 "Failed to disable core power: %d\n", ret);
1162 goto err;
1163 }
1164
1165 ret = regulator_disable(priv->io_pwr);
1166 if (ret < 0)
1167 dev_err(&mdiodev->dev, "Failed to disable io pwr: %d\n",
1168 ret);
1169
1170 dsa_unregister_switch(priv->ds);
1171 mutex_destroy(&priv->reg_mutex);
1172 err:
> 1173 return ret;
1174 }
1175
1176 static const struct of_device_id mt7530_of_match[] = {
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip