aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-4.4/7210-staging-fsl-dpaa2-mac-Fix-unregister_netdev-issue.patch
blob: ea582835c875fdfdb1cb7682fd5a5f5e443bc525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From e74b6010eca026625ba4e39c80620320ca777deb Mon Sep 17 00:00:00 2001
From: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Date: Tue, 5 Apr 2016 13:35:14 +0300
Subject: [PATCH 210/226] staging: fsl-dpaa2/mac: Fix unregister_netdev issue

We only register the netdevice associated with a mac object if
ONFIG_FSL_DPAA2_MAC_NETDEV is set, but we always unregister it
during device remove(). Fix this by ifdef-ing the unregister
operation.

Also ifdef the change in netdevice name as it only makes sense
under this option.

Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
(cherry picked from commit dd6a5313e194168d46fef495a6e3bc5207801473)
---
 drivers/staging/fsl-dpaa2/mac/mac.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/staging/fsl-dpaa2/mac/mac.c
+++ b/drivers/staging/fsl-dpaa2/mac/mac.c
@@ -534,7 +534,10 @@ static int dpaa2_mac_probe(struct fsl_mc
 	priv->netdev = netdev;
 
 	SET_NETDEV_DEV(netdev, dev);
+
+#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS
 	snprintf(netdev->name, IFNAMSIZ, "mac%d", mc_dev->obj_desc.id);
+#endif
 
 	dev_set_drvdata(dev, priv);
 
@@ -684,7 +687,9 @@ static int dpaa2_mac_remove(struct fsl_m
 	struct device		*dev = &mc_dev->dev;
 	struct dpaa2_mac_priv	*priv = dev_get_drvdata(dev);
 
+#ifdef CONFIG_FSL_DPAA2_MAC_NETDEVS
 	unregister_netdev(priv->netdev);
+#endif
 	teardown_irqs(priv->mc_dev);
 	dpmac_close(priv->mc_dev->mc_io, 0, priv->mc_dev->mc_handle);
 	fsl_mc_portal_free(priv->mc_dev->mc_io);