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