Message ID | 20170718133338.16475-1-luca@coelho.fi (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On 18-07-17 15:33, Luca Coelho wrote: > From: Luca Coelho <luciano.coelho@intel.com> > > The commit that changed the netdev destructor was also applied in > v4.12-rc6, so we need to update the backport. > > Another issue was that when the default free_netdev() destructor was supposed to be used, we would get compilation errors, such as this one in hwsim: [...] > Fixes: 721ae78f9355 ("backport: handle change in netdevice destructor usage") Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> > Signed-off-by: Luca Coelho <luciano.coelho@intel.com> > --- > backport/backport-include/linux/netdevice.h | 9 ++++++--- > patches/0079-netdev-destructor.cocci | 8 ++++---- > 2 files changed, 10 insertions(+), 7 deletions(-) > > diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h > index 98e781eeb740..d22eec2d3113 100644 > --- a/backport/backport-include/linux/netdevice.h > +++ b/backport/backport-include/linux/netdevice.h > @@ -320,14 +320,17 @@ static inline void netif_trans_update(struct net_device *dev) > } > #endif > > -#if LINUX_VERSION_IS_LESS(4,13,0) > +#if LINUX_VERSION_IS_LESS(4,12,0) > #define netdev_set_priv_destructor(_dev, _destructor) \ > (_dev)->destructor = __ ## _destructor > +#define netdev_set_def_destructor(_dev) \ > + (_dev)->destructor = free_netdev I tried to stick with one macro, but it is indeed awkward and oviously incomplete. This looks better. Thanks, Arend -- To unsubscribe from this list: send the line "unsubscribe backports" in
On Sat, 2017-07-22 at 10:01 +0200, Arend van Spriel wrote: > On 18-07-17 15:33, Luca Coelho wrote: > > From: Luca Coelho <luciano.coelho@intel.com> > > > > The commit that changed the netdev destructor was also applied in > > v4.12-rc6, so we need to update the backport. > > > > Another issue was that when the default free_netdev() destructor was supposed to be used, we would get compilation errors, such as this one in hwsim: > > [...] > > > Fixes: 721ae78f9355 ("backport: handle change in netdevice destructor usage") > > Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com> Thanks, Arend. Applied. -- Cheers, Luca. -- To unsubscribe from this list: send the line "unsubscribe backports" in
diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h index 98e781eeb740..d22eec2d3113 100644 --- a/backport/backport-include/linux/netdevice.h +++ b/backport/backport-include/linux/netdevice.h @@ -320,14 +320,17 @@ static inline void netif_trans_update(struct net_device *dev) } #endif -#if LINUX_VERSION_IS_LESS(4,13,0) +#if LINUX_VERSION_IS_LESS(4,12,0) #define netdev_set_priv_destructor(_dev, _destructor) \ (_dev)->destructor = __ ## _destructor +#define netdev_set_def_destructor(_dev) \ + (_dev)->destructor = free_netdev #else #define netdev_set_priv_destructor(_dev, _destructor) \ (_dev)->needs_free_netdev = true; \ - if ((_destructor) != free_netdev) \ - (_dev)->priv_destructor = (_destructor); + (_dev)->priv_destructor = (_destructor); +#define netdev_set_def_destructor(_dev) \ + (_dev)->needs_free_netdev = true; #endif #endif /* __BACKPORT_NETDEVICE_H */ diff --git a/patches/0079-netdev-destructor.cocci b/patches/0079-netdev-destructor.cocci index fab8af192aac..199aacf29032 100644 --- a/patches/0079-netdev-destructor.cocci +++ b/patches/0079-netdev-destructor.cocci @@ -17,7 +17,7 @@ identifier r1.D, r1.C; fresh identifier E = "__" ## D; @@ -+#if LINUX_VERSION_IS_LESS(4,13,0) ++#if LINUX_VERSION_IS_LESS(4,12,0) +static void E(struct net_device *ndev) +{ + D(ndev); @@ -40,7 +40,7 @@ T RET; RET = \(register_netdevice\|register_ndev\)(NDEV); if (<+... RET ...+>) { <... -+#if LINUX_VERSION_IS_LESS(4,13,0) ++#if LINUX_VERSION_IS_LESS(4,12,0) + D(NDEV); +#endif free_netdev(NDEV); @@ -60,7 +60,7 @@ else RET = register_netdev(NDEV); if (<+... RET ...+>) { <... -+#if LINUX_VERSION_IS_LESS(4,13,0) ++#if LINUX_VERSION_IS_LESS(4,12,0) + D(NDEV); +#endif free_netdev(NDEV); @@ -73,7 +73,7 @@ identifier TRUE =~ "true"; @@ -NDEV->needs_free_netdev = TRUE; -+netdev_set_priv_destructor(NDEV, free_netdev); ++netdev_set_def_destructor(NDEV); @r6@ struct net_device *NDEV;