On 09/18/2018 08:28 AM, Omer Efrat wrote: > On Tue, Sep 18, 2018, Hauke Mehrtens wrote: > >> The device structure now has this .coredump member which is also used by >> some wireless drivers, see here for example: >> https://git.kernel.org/linus/8e072168f75ebce85b96cbcefea2b10ddbd5913f >> >> I tried to create a spatch for this, but I failed to match the driver >> member because it is embedded inside an other structure, it looks like >> this for example: >> >> static struct pci_driver brcmf_pciedrvr = { >> .... >> .driver.coredump = brcmf_dev_coredump, >> }; >> >> I would like to convert this to this: >> >> static struct pci_driver brcmf_pciedrvr = { >> .... >> #if LINUX_VERSION_IS_GEQ(4,16,0) >> .driver.coredump = brcmf_dev_coredump, >> #endif >> }; >> >> Hauke > > I think you should have a look at 0075-ndo-stats-64.cocci for a good reference. > > Omer. > Hi Omer, Thanks for the hint, but I already tried something like that. The suggested code looks like this: struct net_device_ops OPS@p = { +#if LINUX_VERSION_IS_GEQ(4,11,0) .ndo_get_stats64 = stats64_fn, +#else + .ndo_get_stats64 = stats64_fn_wrap, +#endif }; This directly uses a member of a structure, but the .coredump is in a structure which is embedded in a different structure like this: struct pci_driver { ... struct device_driver driver; ... }; struct device_driver { ... void (*coredump) (struct device *dev); ... }; Hauke