ath79/mikrotik: use routerbootpart partitions
[oweals/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0343-staging-dpaa2-ethsw-move-port-notifier-per-ethsw.patch
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
5
6 Register a different net_device 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-2-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 | 13 ++++++-------
15  drivers/staging/fsl-dpaa2/ethsw/ethsw.h |  2 ++
16  2 files changed, 8 insertions(+), 7 deletions(-)
17
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);
22  }
23  
24 -static struct notifier_block port_nb __read_mostly = {
25 -       .notifier_call = port_netdevice_event,
26 -};
27 -
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
32  
33  static int ethsw_register_notifier(struct device *dev)
34  {
35 +       struct ethsw_core *ethsw = dev_get_drvdata(dev);
36         int err;
37  
38 -       err = register_netdevice_notifier(&port_nb);
39 +       ethsw->port_nb.notifier_call = port_netdevice_event;
40 +       err = register_netdevice_notifier(&ethsw->port_nb);
41         if (err) {
42                 dev_err(dev, "Failed to register netdev notifier\n");
43                 return err;
44 @@ -1353,7 +1351,7 @@ static int ethsw_register_notifier(struc
45  err_switchdev_blocking_nb:
46         unregister_switchdev_notifier(&port_switchdev_nb);
47  err_switchdev_nb:
48 -       unregister_netdevice_notifier(&port_nb);
49 +       unregister_netdevice_notifier(&ethsw->port_nb);
50         return err;
51  }
52  
53 @@ -1491,6 +1489,7 @@ static int ethsw_port_init(struct ethsw_
54  
55  static void ethsw_unregister_notifier(struct device *dev)
56  {
57 +       struct ethsw_core *ethsw = dev_get_drvdata(dev);
58         struct notifier_block *nb;
59         int err;
60  
61 @@ -1505,7 +1504,7 @@ static void ethsw_unregister_notifier(st
62                 dev_err(dev,
63                         "Failed to unregister switchdev notifier (%d)\n", err);
64  
65 -       err = unregister_netdevice_notifier(&port_nb);
66 +       err = unregister_netdevice_notifier(&ethsw->port_nb);
67         if (err)
68                 dev_err(dev,
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 {
73  
74         u8                              vlans[VLAN_VID_MASK + 1];
75         bool                            learning;
76 +
77 +       struct notifier_block           port_nb;
78  };
79  
80  #endif /* __ETHSW_H */