459d145afc3c0686336fc68f2d3b755e77f43323
[openwrt/staging/mkresin.git] /
1 From e35e9d1a3dd2cc4f06f03ec4c3fae781bb0c5075 Mon Sep 17 00:00:00 2001
2 From: Ioana Ciornei <ioana.ciornei@nxp.com>
3 Date: Mon, 11 Nov 2019 18:50:56 +0200
4 Subject: [PATCH] staging: dpaa2-ethsw: move port switchdev notifier per ethsw
5
6 Register a different switchdev notifier block per ethsw instance.
7 When probing multiple dpaa2-ethsw instances, without this the register
8 will fail.
9
10 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
11 Link: https://lore.kernel.org/r/1573491058-24766-3-git-send-email-ioana.ciornei@nxp.com
12 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 ---
14 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 11 ++++-------
15 drivers/staging/fsl-dpaa2/ethsw/ethsw.h | 1 +
16 2 files changed, 5 insertions(+), 7 deletions(-)
17
18 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
19 +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
20 @@ -1314,10 +1314,6 @@ static int port_switchdev_blocking_event
21 return NOTIFY_DONE;
22 }
23
24 -static struct notifier_block port_switchdev_nb = {
25 - .notifier_call = port_switchdev_event,
26 -};
27 -
28 static struct notifier_block port_switchdev_blocking_nb = {
29 .notifier_call = port_switchdev_blocking_event,
30 };
31 @@ -1334,7 +1330,8 @@ static int ethsw_register_notifier(struc
32 return err;
33 }
34
35 - err = register_switchdev_notifier(&port_switchdev_nb);
36 + ethsw->port_switchdev_nb.notifier_call = port_switchdev_event;
37 + err = register_switchdev_notifier(&ethsw->port_switchdev_nb);
38 if (err) {
39 dev_err(dev, "Failed to register switchdev notifier\n");
40 goto err_switchdev_nb;
41 @@ -1349,7 +1346,7 @@ static int ethsw_register_notifier(struc
42 return 0;
43
44 err_switchdev_blocking_nb:
45 - unregister_switchdev_notifier(&port_switchdev_nb);
46 + unregister_switchdev_notifier(&ethsw->port_switchdev_nb);
47 err_switchdev_nb:
48 unregister_netdevice_notifier(&ethsw->port_nb);
49 return err;
50 @@ -1499,7 +1496,7 @@ static void ethsw_unregister_notifier(st
51 dev_err(dev,
52 "Failed to unregister switchdev blocking notifier (%d)\n", err);
53
54 - err = unregister_switchdev_notifier(&port_switchdev_nb);
55 + err = unregister_switchdev_notifier(&ethsw->port_switchdev_nb);
56 if (err)
57 dev_err(dev,
58 "Failed to unregister switchdev notifier (%d)\n", err);
59 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
60 +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.h
61 @@ -68,6 +68,7 @@ struct ethsw_core {
62 bool learning;
63
64 struct notifier_block port_nb;
65 + struct notifier_block port_switchdev_nb;
66 };
67
68 #endif /* __ETHSW_H */