diff mbox series

[09/10] backports: Make netdev destructor spatch apply correctly again

Message ID 20180923174535.16198-10-hauke@hauke-m.de (mailing list archive)
State Accepted
Headers show
Series backports: misc fixes to improve support of 4.19 | expand

Commit Message

Hauke Mehrtens Sept. 23, 2018, 5:45 p.m. UTC
The netdev destructor spatch did not apply to the wil6210 driver any
more, because there the calls were done in a different order compared to
the spatch. Add an additional rule which applies when the order is
changed.

Fixes: 30a378636e47 ("backports: speed up netdev destructor spatch by two orders of magnitude")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 patches/0079-netdev-destructor.cocci | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Johannes Berg Sept. 23, 2018, 8:17 p.m. UTC | #1
On Sun, 2018-09-23 at 19:45 +0200, Hauke Mehrtens wrote:
> The netdev destructor spatch did not apply to the wil6210 driver any
> more, because there the calls were done in a different order compared to
> the spatch. Add an additional rule which applies when the order is
> changed.

Weird, thanks! I compared the diffstat, but perhaps wil6210 also changed
in the meantime ... dunno, but whatever, thanks for fixing.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
diff mbox series

Patch

diff --git a/patches/0079-netdev-destructor.cocci b/patches/0079-netdev-destructor.cocci
index f2bea35b..8d7228ec 100644
--- a/patches/0079-netdev-destructor.cocci
+++ b/patches/0079-netdev-destructor.cocci
@@ -67,6 +67,38 @@  if (<+... RET ...+>) {
 	...>
 }
 
+@r11@
+struct net_device *NDEV;
+identifier D, C;
+identifier TRUE =~ "true";
+@@
+C(...)
+{
+	<+...
+-	NDEV->priv_destructor = D;
+-	NDEV->needs_free_netdev = TRUE;
++	netdev_set_priv_destructor(NDEV, D);
+	...+>
+}
+
+@r12 depends on r11@
+identifier r11.D, r11.C;
+fresh identifier E = "__" ## D;
+@@
+
++#if LINUX_VERSION_IS_LESS(4,12,0)
++static void E(struct net_device *ndev)
++{
++	D(ndev);
++	free_netdev(ndev);
++}
++#endif
++
+C(...)
+{
+	...
+}
+
 @r5@
 struct net_device *NDEV;
 identifier TRUE =~ "true";