1 From daaa4e77f9bc9e67fa3fd973d4455631d59fb898 Mon Sep 17 00:00:00 2001
2 From: Ioana Ciornei <ioana.ciornei@nxp.com>
3 Date: Mon, 11 Nov 2019 18:50:55 +0200
4 Subject: [PATCH] staging: dpaa2-ethsw: move port notifier per ethsw
6 Register a different net_device notifier block per ethsw instance.
7 When probing multiple dpaa2-ethsw instances, without this the register
10 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
11 Link: https://lore.kernel.org/r/1573491058-24766-2-git-send-email-ioana.ciornei@nxp.com
12 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
14 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 13 ++++++-------
15 drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 2 ++
16 2 files changed, 8 insertions(+), 7 deletions(-)
18 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
19 +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
20 @@ -1174,10 +1174,6 @@ static int port_netdevice_event(struct n
21 return notifier_from_errno(err);
24 -static struct notifier_block port_nb __read_mostly = {
25 - .notifier_call = port_netdevice_event,
28 struct ethsw_switchdev_event_work {
29 struct work_struct work;
30 struct switchdev_notifier_fdb_info fdb_info;
31 @@ -1328,9 +1324,11 @@ static struct notifier_block port_switch
33 static int ethsw_register_notifier(struct device *dev)
35 + struct ethsw_core *ethsw = dev_get_drvdata(dev);
38 - err = register_netdevice_notifier(&port_nb);
39 + ethsw->port_nb.notifier_call = port_netdevice_event;
40 + err = register_netdevice_notifier(ðsw->port_nb);
42 dev_err(dev, "Failed to register netdev notifier\n");
44 @@ -1353,7 +1351,7 @@ static int ethsw_register_notifier(struc
45 err_switchdev_blocking_nb:
46 unregister_switchdev_notifier(&port_switchdev_nb);
48 - unregister_netdevice_notifier(&port_nb);
49 + unregister_netdevice_notifier(ðsw->port_nb);
53 @@ -1491,6 +1489,7 @@ static int ethsw_port_init(struct ethsw_
55 static void ethsw_unregister_notifier(struct device *dev)
57 + struct ethsw_core *ethsw = dev_get_drvdata(dev);
58 struct notifier_block *nb;
61 @@ -1505,7 +1504,7 @@ static void ethsw_unregister_notifier(st
63 "Failed to unregister switchdev notifier (%d)\n", err);
65 - err = unregister_netdevice_notifier(&port_nb);
66 + err = unregister_netdevice_notifier(ðsw->port_nb);
69 "Failed to unregister netdev notifier (%d)\n", err);
70 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
71 +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
72 @@ -66,6 +66,8 @@ struct ethsw_core {
74 u8 vlans[VLAN_VID_MASK + 1];
77 + struct notifier_block port_nb;
80 #endif /* __ETHSW_H */