diff options
author | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-12-08 19:21:12 +0100 |
---|---|---|
committer | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-12-09 19:20:56 +0100 |
commit | 56971553af27e52add6029e1a29e34b266dc620a (patch) | |
tree | f51f1eedb481f8ab997f101fe6a2768df1a19734 /patches/collateral-evolutions/network/11-dev-pm-ops.cocci | |
parent | 0bc6d5517fa493f16dfa7d89906a7db65c1afadf (diff) |
backports: convert 11-dev-pm-ops patch series to SmPL
The collateral evolution on pci power management ops can easily
be expressed with SmPL, use that instead.
spatch version 1.0.0-rc19 with Python support and with PCRE support
mcgrof@drvbp1 ~/backports (git::master)$ time ./gentree.py \
--verbose \
--clean \
--refresh \
/home/mcgrof/linux-next/ \
/home/mcgrof/build/next-20131206
real 8m6.077s
user 7m46.076s
sys 0m18.124s
There are three exceptions that this patch does not address:
libertas: this should be made a separate collateral evolution
specifically for spi drivers
iwlegacy: we'll deal with this as an evolution to our spatch,
it deals with having to rely on grammar rules which
go beyond just one file.
mwifiex: coccinelle is not doing the transormation due to
an isomorphism on how pm suspend ops are declared,
although we may be able to deal with this within
Coccinelle to teach it this isomorphism we can
also address this by streamlining how pm ops are
defined upstream in the meantime.
Cc: Peter Senna <peter.senna@gmail.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Diffstat (limited to 'patches/collateral-evolutions/network/11-dev-pm-ops.cocci')
-rw-r--r-- | patches/collateral-evolutions/network/11-dev-pm-ops.cocci | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/collateral-evolutions/network/11-dev-pm-ops.cocci b/patches/collateral-evolutions/network/11-dev-pm-ops.cocci new file mode 100644 index 00000000..b89e2f19 --- /dev/null +++ b/patches/collateral-evolutions/network/11-dev-pm-ops.cocci @@ -0,0 +1,42 @@ +// The 2.6.29 kernel has new struct dev_pm_ops [1] which are used +// on the pci device to distinguish power management hooks for suspend +// to RAM and hibernation. Older kernels don't have these so we need +// to resort back to the good ol' suspend/resume. Fortunately the calls +// are not so different so it should be possible to resuse the same +// calls on compat code with only slight modifications. +// +// [1] http://lxr.linux.no/#linux+v2.6.29/include/linux/pm.h#L170 + +@ module_pci @ +declarer name MODULE_DEVICE_TABLE; +identifier pci_ids; +@@ + +MODULE_DEVICE_TABLE(pci, pci_ids); + +@ simple_dev_pm depends on module_pci @ +identifier ops, pci_suspend, pci_resume; +declarer name SIMPLE_DEV_PM_OPS; +declarer name compat_pci_suspend; +declarer name compat_pci_resume; +@@ + ++compat_pci_suspend(pci_suspend); ++compat_pci_resume(pci_resume); +SIMPLE_DEV_PM_OPS(ops, pci_suspend, pci_resume); + +@@ +identifier backport_driver; +expression pm_ops; +fresh identifier backports_pci_suspend = simple_dev_pm.pci_suspend ## "_compat"; +fresh identifier backports_pci_resume = simple_dev_pm.pci_resume ## "_compat"; +@@ + +struct pci_driver backport_driver = { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + .driver.pm = pm_ops, ++#elif defined(CONFIG_PM_SLEEP) ++ .suspend = backports_pci_suspend, ++ .resume = backports_pci_resume, ++#endif +}; |