Re: [PATCH V2] backport: handle change in netdevice destructor usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 21-06-17 23:18, Johannes Berg wrote:
> Perhaps that can be fixed as such:
> 
>> +@r2 depends on r1@
>> +identifier r1.D, r1.C;
>> +fresh identifier E = "__" ## D;
> 
> attribute __maybe_unused;
> 
>> +@@
>> +
>> ++#if LINUX_VERSION_IS_LESS(4,13,0)
>> ++static void E(struct net_device *ndev)
> 
> __maybe_unused

Ok. I clearly made a mistake in #else of the macro:

+#if LINUX_VERSION_IS_LESS(4,13,0)
+#define netdev_set_priv_destructor(_dev, _destructor) \
+	(_dev)->destructor = __ ## _destructor
+#else
+	(_dev)->needs_free_netdev = true;
+	if (_destructor != free_netdev)
+		(_dev)->priv_destructor = _destructor;
+#endif

So I will fix that, but I do not quite understand your comment.
Expanding the macro in spatch output for net/mac80211/iface.c:

+#if LINUX_VERSION_IS_LESS(4,13,0)
+static void __ieee80211_if_free(struct net_device *ndev)
+{
+	ieee80211_if_free(ndev);
+	free_netdev(ndev);
+}
+#endif
+
 static void ieee80211_if_setup(struct net_device *dev)
 {
 	ether_setup(dev);
 	dev->priv_flags &= ~IFF_TX_SKB_SHARING;
 	dev->netdev_ops = &ieee80211_dataif_ops;
-	dev->needs_free_netdev = true;
-	dev->priv_destructor = ieee80211_if_free;
+#if LINUX_VERSION_IS_LESS(4,13,0)
+       dev->destructor = __ieee80211_if_free
+#else
+       dev->needs_free_netdev = true;
+       if (ieee80211_if_free != free_netdev)
+               dev->priv_destructor = ieee80211_if_free;
+#endif
 }

So __ieee80211_if_free is only defined for lower kernels and it is only
used for lower kernels. Adding the __ieee80211_if_free depends on r1 in
the semantic patch.

So I will send a V3 fixing the macro in netdevice.h, but I don't think
we need the maybe_unused attribute.

Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux