Hi all,
Today's linux-next merge of the net-next tree got a conflict in:
drivers/net/dsa/motorcomm/chip.c
between commit:
4dd10fbbeb9c3 ("treewide: Convert devm_kmalloc() family to the devm_kmalloc_obj() family")
from the origin tree and commit:
a9a173f81c83e ("net: dsa: motorcomm: Free the MIB block on port teardown")
from the net-next tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --combined drivers/net/dsa/motorcomm/chip.c
index c753c746490a1,a1d0ce35f4f3f..0000000000000--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@@ -1405,9 -1405,6 +1405,9 @@@ yt921x_dsa_port_bridge_join(struct dsa_
struct netlink_ext_ack *extack)
{
struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
+ struct yt921x_port *pp = &priv->ports[port];
+ struct net_device *brport_dev;
+ struct dsa_port *dp;
u16 ports_mask;
int res;
@@@ -1417,12 -1414,7 +1417,12 @@@
ports_mask = dsa_bridge_ports(ds, bridge.dev);
ports_mask |= priv->cpu_ports_mask;
+ dp = dsa_to_port(ds, port);
+ brport_dev = dsa_port_to_bridge_port(dp);
+
mutex_lock(&priv->reg_lock);
+ pp->isolated = br_port_flag_is_set(brport_dev, BR_ISOLATED);
+ pp->hairpin = br_port_flag_is_set(brport_dev, BR_HAIRPIN_MODE);
res = yt921x_bridge_join(priv, port, ports_mask);
mutex_unlock(&priv->reg_lock);
@@@ -1845,10 -1837,9 +1845,9 @@@ yt921x_phylink_mac_link_down(struct phy
int port = dp->index;
int res;
- /* No need to sync; port control block is hold until device remove */
pm = priv->ports[port].mib;
if (pm)
- cancel_delayed_work(&pm->work);
+ cancel_delayed_work_sync(&pm->work);
mutex_lock(&priv->reg_lock);
res = yt921x_port_down(priv, port);
@@@ -2002,11 -1993,11 +2001,11 @@@ static void yt921x_dsa_port_teardown(st
struct yt921x_port *pp = &priv->ports[port];
struct yt921x_mib *pm = pp->mib;
- /* get_stats64() might not be synchronized with port_teardown(), hold
- * the MIB block till the device teardown
- */
- if (pm)
+ if (pm) {
disable_delayed_work_sync(&pm->work);
+ pp->mib = NULL;
+ kvfree(pm);
+ }
}
static int yt921x_dsa_port_setup(struct dsa_switch *ds, int port)
@@@ -2014,12 -2005,11 +2013,11 @@@
struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
struct yt921x_port *pp = &priv->ports[port];
const struct yt921x_info *info = priv->info;
- struct device *dev = yt921x_priv_to_device(priv);
- struct yt921x_mib *pm = pp->mib;
+ struct yt921x_mib *pm;
int res;
- if (!pm && (BIT(port) & yt921x_info_ports_mask(info))) {
- pm = devm_kzalloc_obj(dev, *pm);
+ if (BIT(port) & yt921x_info_ports_mask(info)) {
+ pm = kvzalloc_obj(*pm);
if (!pm)
return -ENOMEM;
pp->mib = pm;
@@@ -2027,20 -2017,15 +2025,15 @@@
pm->port = pp;
u64_stats_init(&pm->syncp);
INIT_DELAYED_WORK(&pm->work, yt921x_mib_poll);
- /* Start disabled, so that the enable below always pairs with
- * either this disable or the one from a previous teardown
- */
- disable_delayed_work_sync(&pm->work);
}
mutex_lock(&priv->reg_lock);
res = yt921x_port_setup(priv, port);
mutex_unlock(&priv->reg_lock);
- if (res)
+ if (res) {
+ yt921x_dsa_port_teardown(ds, port);
return res;
-
- if (pm)
- enable_delayed_work(&pm->work);
+ }
return 0;
}
@@@ -2625,11 -2610,11 +2618,11 @@@ static int yt921x_mdio_probe(struct mdi
struct yt921x_priv *priv;
struct dsa_switch *ds;
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ priv = devm_kzalloc_obj(dev, *priv);
if (!priv)
return -ENOMEM;
- mdio = devm_kzalloc(dev, sizeof(*mdio), GFP_KERNEL);
+ mdio = devm_kzalloc_obj(dev, *mdio);
if (!mdio)
return -ENOMEM;