1
0
Fork 0
alistair23-linux/Documentation
Luis R. Rodriguez dd951fc1b6 scripts: add Linux .cocciconfig for coccinelle
Coccinelle supports reading .cocciconfig, the order of precedence for
variables for .cocciconfig is as follows:

 o Your current user's home directory is processed first
 o Your directory from which spatch is called is processed next
 o The directory provided with the --dir option is processed last, if used

Since coccicheck runs through make, it naturally runs from the kernel
proper dir, as such the second rule above would be implied for picking up a
.cocciconfig when using 'make coccicheck'.

'make coccicheck' also supports using M= targets.If you do not supply
any M= target, it is assumed you want to target the entire kernel.
The kernel coccicheck script has:

    if [ "$KBUILD_EXTMOD" = "" ] ; then
        OPTIONS="--dir $srctree $COCCIINCLUDE"
    else
        OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE"
    fi

KBUILD_EXTMOD is set when an explicit target with M= is used. For both cases
the spatch --dir argument is used, as such third rule applies when
whether M= is used or not, and when M= is used the target directory can
have its own .cocciconfig file. When M= is not passed as an argument to
coccicheck the target directory is the same as the directory from where
spatch was called.

If not using the kernel's coccicheck target, keep the above precedence order
logic of .cocciconfig reading. If using the kernel's coccicheck target,
override any of the kernel's .coccicheck's settings using SPFLAGS.

We help Coccinelle when used against Linux with a set of sensible defaults
options for Linux with our own Linux .cocciconfig. This hints to coccinelle
git can be used for 'git grep' queries over coccigrep. A timeout of 200
seconds should suffice for now.

The options picked up by coccinelle when reading a .cocciconfig do not appear
as arguments to spatch processes running on your system, to confirm what
options will be used by Coccinelle run:

  spatch --print-options-only

You can override with your own preferred index option by using SPFLAGS.
Coccinelle supports both glimpse and idutils. Glimpse had historically
provided the best performance, however recent benchmarks reveal idutils
is performing just as well. Due to some recent fixes however you however
will need at least coccinelle >= 1.0.6 if using idutils.

Coccinelle carries a script scripts/idutils_index.sh which creates the
idutils database with as follows:

    mkid -i C --output .id-utils.index

If using just "--use-idutils" coccinelle expects your idutils database to be
on the top level of the kernel as a file named ".id-utils.index". If you do
not use this you can symlink your database file to it, or you can specify the
database file following the "--use-idutils" argument. Examples:

    make SPFLAGS=--use-idutils coccicheck

This assumes you have $srctree/.id-utils.index, where $srctree is
the top level of the kernel.

    make SPFLAGS="--use-idutils /full-path/to/ID" coccicheck

Here you specify the full path of the idutils ID database. Using
.cocciconfig is possible, however given the order of precedence followed
by Coccinelle, and since the kernel now carries its own .cocciconfig,
you will need to use SPFLAGS to use idutils if desired.

v4:

o Recommend upgrade for using idutils with coccinelle due to some
  recent fixes.

o Refer to using --print-options-only for testing what options are
  picked up by .cocciconfig reading.

o Expand commit log considerably explaining *why* .cocconfig from
  two precedence rules are used when using coccicheck, and how to
  properly override these if needed.

o Expand Documentation/coccinelle.txt

v3: Expand commit log a bit more

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.com>
2016-07-22 12:13:39 +02:00
..
ABI This pull request contains mostly cleanups and minor 2016-05-27 18:49:29 -07:00
DocBook Merge tag 'drm-intel-next-fixes-2016-05-25' of git://anongit.freedesktop.org/drm-intel into drm-next 2016-05-27 16:08:38 +10:00
EDID
PCI The documentation tree update for 4.1. Numerous fixes, the overdue removal 2015-04-18 11:10:49 -04:00
RCU The most interesting thing (IMO) this time around is some beginning 2016-05-19 18:07:25 -07:00
accounting taskstats: fix nl parsing in accounting/getdelays.c 2016-04-27 12:50:14 -04:00
acpi ACPI / tables: Convert initrd table override to table upgrade mechanism 2016-04-18 23:59:09 +02:00
aoe
arm Documentation: fix common spelling mistakes 2016-04-28 07:51:59 -06:00
arm64 IOMMU Updates for Linux v4.7 2016-05-19 17:07:04 -07:00
auxdisplay
backlight
blackfin Docs: blackfin: Use new switch macro SAMPLE_IRQ_TIMER instead of IRQ_TIMER5 2015-05-07 09:35:14 -06:00
block The most interesting thing (IMO) this time around is some beginning 2016-05-19 18:07:25 -07:00
blockdev zram: introduce per-device debug_stat sysfs node 2016-05-20 17:58:30 -07:00
bus-devices
cdrom
cgroup-v1 Documentation/memcg: update kmem limit doc as codes behavior 2016-05-14 10:12:45 -06:00
cma cma: debug: document new debugfs interface 2015-04-14 16:49:00 -07:00
connector samples: connector: from Documentation to samples directory 2016-04-28 07:47:35 -06:00
console
cpu-freq Documentation: cpufreq: intel_pstate: fix typo 2016-02-18 20:31:53 +01:00
cpuidle
cris
crypto crypto: doc - Use ahash 2016-02-06 15:33:11 +08:00
development-process
device-mapper dm stats: fix spelling mistake in Documentation 2016-05-05 15:25:54 -04:00
devicetree Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2016-05-28 16:41:39 -07:00
dmaengine Merge branch 'topic/async' into for-linus 2016-01-06 15:17:47 +05:30
driver-model Staging and IIO driver update for 4.7-rc1 2016-05-20 22:20:48 -07:00
dvb [media] media: change email address 2016-01-25 12:01:08 -02:00
early-userspace
extcon
fault-injection net: Add support for CHANGEUPPER notifier error injection 2015-12-03 11:49:23 -05:00
fb Documentation: fb: fix spelling mistakes 2016-05-10 12:05:27 +03:00
features powerpc: Add HAVE_PERF_USER_STACK_DUMP support 2016-05-11 21:54:05 +10:00
filesystems Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-05-27 17:14:05 -07:00
firmware_class Documentation: fix common spelling mistakes 2016-04-28 07:51:59 -06:00
fmc
fpga usage documentation for FPGA manager core 2015-10-07 18:07:20 +01:00
frv
gpio gpio: clarify open drain/source docs 2016-04-27 10:23:44 +02:00
hid HID: sensor: Update document for custom sensor 2015-04-10 22:22:56 +02:00
hwmon Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2016-05-26 09:48:23 -07:00
i2c [media] rtl2832: change the i2c gate to be mux-locked 2016-05-04 22:40:02 +02:00
ia64
ide
iio iio: Documentation: Add IIO configfs documentation 2015-12-03 18:19:28 +00:00
infiniband Round two of 4.7 merge window patches 2016-05-28 11:04:16 -07:00
input Input: clarify we want BTN_TOOL_<name> on proximity 2016-04-06 10:23:09 -07:00
ioctl gpio: uapi: use 0xB4 as ioctl() major 2016-03-10 16:02:52 +07:00
isdn isdn: i4l: move active-isdn drivers to staging 2016-03-05 15:00:38 -08:00
ja_JP Documentatio: HOWTO: remove regression postings info from translations 2016-04-16 10:49:08 -06:00
kbuild kconfig-language: elaborate on the type of a choice 2016-05-10 17:30:14 +02:00
kdump kdump: fix gdb macros work work with newer and 64-bit kernels 2016-05-23 17:04:14 -07:00
ko_KR Documentation: HOWTO: update git home URL in translations 2016-04-16 10:49:18 -06:00
laptops Documentation: laptops: fix spelling mistake 2016-04-28 07:21:48 -06:00
leds Documentation: leds: Add description of brightness setting API 2016-01-04 09:57:31 +01:00
livepatch Merge branches 'for-4.7/core', 'for-4.7/livepatching-doc' and 'for-4.7/livepatching-ppc64' into for-linus 2016-05-17 12:06:35 +02:00
locking locking/Documentation/lockdep: Fix spelling mistakes 2016-04-28 10:40:57 +02:00
m68k
memory-devices
metag
mic Char/Misc patches for 4.6-rc1 2016-03-17 13:47:50 -07:00
mips
misc-devices Merge char-misc-next into staging-next 2016-02-22 14:46:24 -08:00
mmc Documentation: mmc: Add the introduction for mmc-utils 2016-03-31 00:54:22 -06:00
mn10300
mtd Documentation: mtd: improve nand_ecc.txt for readability and correctness 2015-11-17 17:05:14 -08:00
namespaces
netlabel
networking The most interesting thing (IMO) this time around is some beginning 2016-05-19 18:07:25 -07:00
nfc NFC: Fix typo in nfc-hci.txt 2015-06-08 23:15:45 +02:00
nios2
nvdimm libnvdimm: documentation clarifications 2015-11-12 09:55:23 -08:00
nvmem Documentation: nvmem: add nvmem api level and how-to doc 2015-08-05 13:43:45 -07:00
parisc
pcmcia pcmcia: Fix typo in locking documentation 2015-08-07 14:34:58 +02:00
phy
platform
power PM / runtime: Document steps for device removal 2016-04-05 03:46:59 +02:00
powerpc powerpc/eeh: rename EEH from "extended" to "enhanced" error handling 2016-04-11 20:30:42 +10:00
pps Documentation: pps: fix spelling mistake 2016-04-28 07:23:59 -06:00
prctl Documentation: Fix int/unsigned int comparison 2016-02-17 14:09:43 -07:00
pti
ptp Another relatively boring cycle for the docs tree: typo fixes, translation 2016-03-17 12:09:35 -07:00
rapidio rapidio: add mport char device driver 2016-03-22 15:36:02 -07:00
s390 s390/zcore: remove /sys/kernel/debug/zcore/mem 2015-11-27 09:24:12 +01:00
scheduler sched/dl/Documentation: Split Section 3 2015-05-19 08:39:21 +02:00
scsi Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2016-05-28 12:04:17 -07:00
security The most interesting thing (IMO) this time around is some beginning 2016-05-19 18:07:25 -07:00
serial TTY and Serial driver update for 4.7-rc1 2016-05-20 20:57:27 -07:00
sh
sound ALSA: compress: fix some typo 2016-05-08 11:27:44 +02:00
spi spi: tools: move spidev_test metadata 2015-11-30 12:14:12 +00:00
sysctl Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-05-25 17:05:40 -07:00
target target: make close_session optional 2016-05-10 01:19:26 -07:00
thermal thermal: Syntactic and factual errors in the API document 2016-05-17 07:28:24 -07:00
timers Documentation: fix common spelling mistakes 2016-04-28 07:51:59 -06:00
tpm
trace Char / Misc driver update for 4.7-rc1 2016-05-20 21:20:31 -07:00
usb Hi Greg, below are changes for chipidea and OTG FSM, no major changes. 2016-05-04 10:25:58 -07:00
vDSO Documentation/vDSO: don't build tests when cross compiling 2015-06-22 16:04:57 -06:00
video4linux The most interesting thing (IMO) this time around is some beginning 2016-05-19 18:07:25 -07:00
virtual kvm: introduce KVM_MAX_VCPU_ID 2016-05-11 22:37:54 +02:00
vm z3fold: the 3-fold allocator for compressed pages 2016-05-20 17:58:30 -07:00
w1 w1: add ability to set (SRAM) and store (EEPROM) configuration for temp sensors like DS18B20 2016-05-01 14:37:49 -07:00
watchdog Documentation: Add ebc-c384_wdt watchdog-parameters.txt entry 2016-05-14 18:28:29 +02:00
wimax
x86 The most interesting thing (IMO) this time around is some beginning 2016-05-19 18:07:25 -07:00
xtensa
zh_CN Documentation:Update Documentation/zh_CN/arm64/booting.txt 2016-04-28 07:15:36 -06:00
00-INDEX
BUG-HUNTING
Changes There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
CodeOfConflict
CodingStyle Documentation/CodingStyle: add space before parenthesis in example macro 2016-01-25 12:36:28 -07:00
DMA-API-HOWTO.txt dma-mapping: always provide the dma_map_ops based implementation 2016-01-20 17:09:18 -08:00
DMA-API.txt DMA-API: fix confusing sentence in Documentation/DMA-API.txt 2016-01-11 18:29:00 -07:00
DMA-ISA-LPC.txt
DMA-attributes.txt ARM: 8506/1: common: DMA-mapping: add DMA_ATTR_ALLOC_SINGLE_PAGES attribute 2016-02-11 15:33:38 +00:00
HOWTO Documentation: Howto: Fixed subtitles style 2016-03-09 15:30:03 -07:00
IPMI.txt ipmi watchdog : add panic_wdt_timeout parameter 2015-11-16 06:28:43 -06:00
IRQ-affinity.txt
IRQ-domain.txt Documentation/IRQ-domain.txt: Document irq_domain_create_{linear, tree} 2016-03-31 00:32:59 -06:00
IRQ.txt
Intel-IOMMU.txt iommu/vt-d: Fix link to Intel IOMMU Specification 2016-01-29 12:32:12 +01:00
Makefile [media] samples: v4l: from Documentation to samples directory 2016-05-09 18:34:37 -03:00
ManagementStyle
SAK.txt
SM501.txt
SecurityBugs
SubmitChecklist
SubmittingDrivers
SubmittingPatches SubmittingPatches: fix spelling of "git send-email" 2016-01-25 12:30:18 -07:00
VGA-softcursor.txt
adding-syscalls.txt documentation: trivial typo: adding-syscalls.txt: s/statat/fstatat/ 2016-04-18 11:31:49 -06:00
applying-patches.txt
assoc_array.txt
atomic_ops.txt locking/atomics, cmpxchg: Privatize the inclusion of asm/cmpxchg.h 2015-09-13 10:35:46 +02:00
bad_memory.txt
basic_profiling.txt
bcache.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
cachetlb.txt
cgroup-v2.txt Merge branch 'for-4.6-ns' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup 2016-03-21 10:05:13 -07:00
circular-buffers.txt
clk.txt clk: change clk_ops' ->determine_rate() prototype 2015-07-27 18:12:01 -07:00
coccinelle.txt scripts: add Linux .cocciconfig for coccinelle 2016-07-22 12:13:39 +02:00
cpu-hotplug.txt Documentation: cpu-hotplug: Fix sysfs mount instructions 2015-12-10 11:35:30 -07:00
cpu-load.txt
cputopology.txt Documentation: Update cputopology.txt 2015-05-27 15:22:15 +02:00
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt Doc: Change wikipedia's URL from http to https 2015-06-22 10:14:05 -06:00
dell_rbu.txt
devices.txt Documentation: update the devices.txt documentation 2016-03-29 10:11:44 -07:00
digsig.txt
dma-buf-sharing.txt dma-buf: Update docs for SYNC ioctl 2016-03-21 09:26:45 +01:00
dontdiff Documentation: dontdiff: remove media from dontdiff 2015-11-11 10:08:07 -07:00
dynamic-debug-howto.txt
edac.txt EDAC: Remove references to bluesmoke.sourceforge.net 2015-11-26 14:46:06 +01:00
efi-stub.txt doc: efi-stub.txt: Fix arm64 paths 2015-12-14 15:24:03 +00:00
eisa.txt
email-clients.txt A few more documentation patches that wandered in and have no reason to 2015-11-13 09:19:05 -08:00
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gdb-kernel-debugging.txt scripts/gdb: add documentation example for radix tree 2016-05-23 17:04:14 -07:00
highuid.txt
hsi.txt
hw_random.txt hwrng: doc - Fix device node name reference /dev/hw_random => /dev/hwrng 2015-09-21 22:00:41 +08:00
hwspinlock.txt hwspinlock/core: add device tree support 2015-05-02 09:54:30 +03:00
init.txt
initrd.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
irqflags-tracing.txt
isa.txt Documentation: Add ISA bus driver documentation 2016-05-02 09:32:04 -07:00
isapnp.txt
java.txt
kasan.txt mm, kasan: SLAB support 2016-03-25 16:37:42 -07:00
kcov.txt kernel: add kcov code coverage 2016-03-22 15:36:02 -07:00
kernel-doc-nano-HOWTO.txt Documenation: Update location of docproc.c 2015-07-14 12:36:39 -06:00
kernel-docs.txt Documentation: update Michael K. Johnson's work 2016-04-15 15:37:25 -06:00
kernel-parameters.txt TTY and Serial driver update for 4.7-rc1 2016-05-20 20:57:27 -07:00
kernel-per-CPU-kthreads.txt irq_poll: make blk-iopoll available outside the block layer 2015-12-11 11:52:24 -08:00
kmemcheck.txt
kmemleak.txt Doc: Change wikipedia's URL from http to https 2015-06-22 10:14:05 -06:00
kobject.txt
kprobes.txt
kref.txt
kselftest.txt Documentation: kselftest: Remove duplicate word 2016-03-09 15:33:38 -07:00
ldm.txt
local_ops.txt
lockup-watchdogs.txt kernel/watchdog.c: add sysctl knob hardlockup_panic 2015-11-05 19:34:48 -08:00
logo.gif
logo.txt
lzo.txt Documentation: lzo: fix spelling mistakes 2016-04-28 07:23:11 -06:00
magic-number.txt Documentation/magic-number: Remove SCC_MAGIC 2015-05-13 15:39:04 -04:00
mailbox.txt Documentation: minor typo fix in mailbox.txt 2015-08-13 18:03:18 -06:00
md-cluster.txt md-cluster: change array_sectors and update size are not supported 2016-05-04 12:39:35 -07:00
md.txt doc:md: fix typo in md.txt. 2015-06-23 06:49:44 -06:00
memory-barriers.txt locking/Documentation: Clarify that ACQUIRE applies to loads, RELEASE applies to stores 2016-04-28 10:57:51 +02:00
memory-hotplug.txt memory_hotplug: introduce CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE 2016-05-19 19:12:14 -07:00
men-chameleon-bus.txt Documentation: Minor changes to men-chameleon-bus.txt 2015-07-24 15:15:17 +02:00
module-signing.txt modsign: Fix documentation on module signing enforcement parameter. 2016-03-12 01:48:11 -07:00
mono.txt
nommu-mmap.txt
ntb.txt NTB: Rename Intel code names to platform names 2015-07-04 14:09:25 -04:00
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
phy.txt phy: core: Allow children node to be overridden 2016-04-29 16:39:39 +02:00
pi-futex.txt
pinctrl.txt pinctrl: move strict option to pinmux_ops 2015-05-06 14:45:19 +02:00
pnp.txt
preempt-locking.txt x86/fpu: Rename math_state_restore() to fpu__restore() 2015-05-19 15:47:18 +02:00
printk-formats.txt mm, printk: introduce new format string for flags 2016-03-15 16:55:16 -07:00
pwm.txt pwm: Update documentation 2016-05-17 14:48:04 +02:00
ramoops.txt
rbtree.txt documentation: fix small typo in rbtree.txt 2015-09-13 14:38:50 -06:00
remoteproc.txt remoteproc: introduce rproc_get_by_phandle API 2015-06-16 21:12:52 +03:00
rfkill.txt rfkill: Add documentation about LED triggers 2016-02-24 09:13:12 +01:00
robust-futex-ABI.txt
robust-futexes.txt Documentation: robust-futexes: fix spelling mistakes 2016-04-28 07:26:41 -06:00
rpmsg.txt rpmsg: use module_rpmsg_driver in existing drivers and examples 2016-05-06 11:09:01 -07:00
rtc.txt rtc: implement a sysfs interface for clock offset 2016-03-14 17:08:16 +01:00
serial-console.txt
sgi-ioc4.txt
smsc_ece1099.txt
sparse.txt
stable_api_nonsense.txt
stable_kernel_rules.txt stable_kernel_rules.txt: Remove extra space after Cc: 2015-11-20 16:54:57 -07:00
static-keys.txt locking/static_keys: Fix up the static keys documentation 2015-09-15 07:12:06 +02:00
svga.txt
sync_file.txt Documentation: add Sync File doc 2016-04-29 17:37:10 -07:00
sysfs-rules.txt
sysrq.txt Doc: correct the location of sysrq.c 2016-04-28 08:02:36 -06:00
this_cpu_ops.txt
ubsan.txt UBSAN: run-time undefined behavior sanity checker 2016-01-20 17:09:18 -08:00
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt vfio: powerpc/spapr: Support Dynamic DMA windows 2015-06-11 15:16:55 +10:00
vgaarbiter.txt
video-output.txt
vme_api.txt Documentation: mention vme_master_mmap() in VME API 2015-06-12 17:26:56 -07:00
volatile-considered-harmful.txt
workqueue.txt workqueue: fix trivial typo in Documentation/workqueue.txt 2015-05-05 09:50:38 -04:00
xillybus.txt Documentation: xillybus: fix spelling mistake 2016-04-28 07:44:54 -06:00
xz.txt
zorro.txt