From e619e376b36ffafd25ed0893e420d11063eca8c2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 23 Sep 2018 19:45:34 +0200 Subject: backports: Make netdev destructor spatch apply correctly again 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 Signed-off-by: Johannes Berg --- patches/0079-netdev-destructor.cocci | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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"; -- cgit v1.2.3