diff --git a/[refs] b/[refs] index de6e03049f1a..e06b57d43d8a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 97740400bc76b64781d01f8cdfbcf750582006ef +refs/heads/master: 012f3b9118c7aaa3549f89299386f92b6580d235 diff --git a/trunk/Documentation/coccinelle.txt b/trunk/Documentation/coccinelle.txt index cf44eb6499b4..96b690348ba1 100644 --- a/trunk/Documentation/coccinelle.txt +++ b/trunk/Documentation/coccinelle.txt @@ -102,15 +102,9 @@ or make coccicheck COCCI= MODE=report - Controlling Which Files are Processed by Coccinelle -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -By default the entire kernel source tree is checked. - -To apply Coccinelle to a specific directory, M= can be used. -For example, to check drivers/net/wireless/ one may write: + Using Coccinelle on (modified) files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - make coccicheck M=drivers/net/wireless/ - To apply Coccinelle on a file basis, instead of a directory basis, the following command may be used: diff --git a/trunk/Makefile b/trunk/Makefile index 4b8ae0483768..adddd11c3b3b 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -312,7 +312,7 @@ endif # If the user is running make -s (silent mode), suppress echoing of # commands -ifneq ($(filter s% -s%,$(MAKEFLAGS)),) +ifneq ($(findstring s,$(MAKEFLAGS)),) quiet=silent_ endif diff --git a/trunk/arch/arm/boot/Makefile b/trunk/arch/arm/boot/Makefile index fc871e719aae..5df26a9976a2 100644 --- a/trunk/arch/arm/boot/Makefile +++ b/trunk/arch/arm/boot/Makefile @@ -59,11 +59,9 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE endif -targets += $(dtb-y) - # Rule to build device tree blobs -$(obj)/%.dtb: $(src)/dts/%.dts FORCE - $(call if_changed_dep,dtc) +$(obj)/%.dtb: $(src)/dts/%.dts + $(call cmd,dtc) $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y)) diff --git a/trunk/arch/arm/mach-shmobile/pm-sh7372.c b/trunk/arch/arm/mach-shmobile/pm-sh7372.c index fcf8b1761aef..77b8fc12fc2f 100644 --- a/trunk/arch/arm/mach-shmobile/pm-sh7372.c +++ b/trunk/arch/arm/mach-shmobile/pm-sh7372.c @@ -276,7 +276,7 @@ static int sh7372_a3sp_suspend(void) * Serial consoles make use of SCIF hardware located in A3SP, * keep such power domain on if "no_console_suspend" is set. */ - return console_suspend_enabled ? 0 : -EBUSY; + return console_suspend_enabled ? -EBUSY : 0; } struct sh7372_pm_domain sh7372_a3sp = { diff --git a/trunk/arch/microblaze/boot/Makefile b/trunk/arch/microblaze/boot/Makefile index 0c796cf81586..4c4e58ef0cb6 100644 --- a/trunk/arch/microblaze/boot/Makefile +++ b/trunk/arch/microblaze/boot/Makefile @@ -53,6 +53,6 @@ $(obj)/simpleImage.%: vmlinux FORCE DTC_FLAGS := -p 1024 $(obj)/%.dtb: $(src)/dts/%.dts FORCE - $(call if_changed_dep,dtc) + $(call cmd,dtc) clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub diff --git a/trunk/arch/openrisc/boot/Makefile b/trunk/arch/openrisc/boot/Makefile index 09958358601a..98ca185097a5 100644 --- a/trunk/arch/openrisc/boot/Makefile +++ b/trunk/arch/openrisc/boot/Makefile @@ -11,5 +11,5 @@ clean-files := *.dtb.S #DTC_FLAGS ?= -p 1024 -$(obj)/%.dtb: $(src)/dts/%.dts FORCE - $(call if_changed_dep,dtc) +$(obj)/%.dtb: $(src)/dts/%.dts + $(call cmd,dtc) diff --git a/trunk/arch/powerpc/boot/Makefile b/trunk/arch/powerpc/boot/Makefile index 8844a17ce8ed..15986e70799c 100644 --- a/trunk/arch/powerpc/boot/Makefile +++ b/trunk/arch/powerpc/boot/Makefile @@ -345,8 +345,8 @@ $(obj)/treeImage.%: vmlinux $(obj)/%.dtb $(wrapperbits) $(call if_changed,wrap,treeboot-$*,,$(obj)/$*.dtb) # Rule to build device tree blobs -$(obj)/%.dtb: $(src)/dts/%.dts FORCE - $(call if_changed_dep,dtc) +$(obj)/%.dtb: $(src)/dts/%.dts + $(call cmd,dtc) # If there isn't a platform selected then just strip the vmlinux. ifeq (,$(image-y)) diff --git a/trunk/drivers/base/power/domain.c b/trunk/drivers/base/power/domain.c index 978bbf7ac6af..92e6a9048065 100644 --- a/trunk/drivers/base/power/domain.c +++ b/trunk/drivers/base/power/domain.c @@ -1429,8 +1429,6 @@ static int pm_genpd_default_restore_state(struct device *dev) return 0; } -#ifdef CONFIG_PM_SLEEP - /** * pm_genpd_default_suspend - Default "device suspend" for PM domians. * @dev: Device to handle. @@ -1519,19 +1517,6 @@ static int pm_genpd_default_thaw(struct device *dev) return cb ? cb(dev) : pm_generic_thaw(dev); } -#else /* !CONFIG_PM_SLEEP */ - -#define pm_genpd_default_suspend NULL -#define pm_genpd_default_suspend_late NULL -#define pm_genpd_default_resume_early NULL -#define pm_genpd_default_resume NULL -#define pm_genpd_default_freeze NULL -#define pm_genpd_default_freeze_late NULL -#define pm_genpd_default_thaw_early NULL -#define pm_genpd_default_thaw NULL - -#endif /* !CONFIG_PM_SLEEP */ - /** * pm_genpd_init - Initialize a generic I/O PM domain object. * @genpd: PM domain object to initialize. diff --git a/trunk/drivers/base/power/domain_governor.c b/trunk/drivers/base/power/domain_governor.c index 66a265bf5867..51527ee92d10 100644 --- a/trunk/drivers/base/power/domain_governor.c +++ b/trunk/drivers/base/power/domain_governor.c @@ -12,8 +12,6 @@ #include #include -#ifdef CONFIG_PM_RUNTIME - /** * default_stop_ok - Default PM domain governor routine for stopping devices. * @dev: Device to check. @@ -139,28 +137,16 @@ static bool default_power_down_ok(struct dev_pm_domain *pd) return true; } -static bool always_on_power_down_ok(struct dev_pm_domain *domain) -{ - return false; -} - -#else /* !CONFIG_PM_RUNTIME */ - -bool default_stop_ok(struct device *dev) -{ - return false; -} - -#define default_power_down_ok NULL -#define always_on_power_down_ok NULL - -#endif /* !CONFIG_PM_RUNTIME */ - struct dev_power_governor simple_qos_governor = { .stop_ok = default_stop_ok, .power_down_ok = default_power_down_ok, }; +static bool always_on_power_down_ok(struct dev_pm_domain *domain) +{ + return false; +} + /** * pm_genpd_gov_always_on - A governor implementing an always-on policy */ diff --git a/trunk/drivers/hwmon/max1111.c b/trunk/drivers/hwmon/max1111.c index 84ef3a898707..482ca901db30 100644 --- a/trunk/drivers/hwmon/max1111.c +++ b/trunk/drivers/hwmon/max1111.c @@ -106,11 +106,14 @@ static ssize_t show_adc(struct device *dev, if (ret < 0) return ret; - return sprintf(buf, "%d\n", ret); + /* assume the reference voltage to be 2.048V, with an 8-bit sample, + * the LSB weight is 8mV + */ + return sprintf(buf, "%d\n", ret * 8); } #define MAX1111_ADC_ATTR(_id) \ - SENSOR_DEVICE_ATTR(adc##_id##_in, S_IRUGO, show_adc, NULL, _id) + SENSOR_DEVICE_ATTR(in##_id##_input, S_IRUGO, show_adc, NULL, _id) static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); static MAX1111_ADC_ATTR(0); @@ -120,10 +123,10 @@ static MAX1111_ADC_ATTR(3); static struct attribute *max1111_attributes[] = { &dev_attr_name.attr, - &sensor_dev_attr_adc0_in.dev_attr.attr, - &sensor_dev_attr_adc1_in.dev_attr.attr, - &sensor_dev_attr_adc2_in.dev_attr.attr, - &sensor_dev_attr_adc3_in.dev_attr.attr, + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, NULL, }; diff --git a/trunk/kernel/Makefile b/trunk/kernel/Makefile index 2d9de86b7e76..f70396e5a24b 100644 --- a/trunk/kernel/Makefile +++ b/trunk/kernel/Makefile @@ -23,7 +23,6 @@ CFLAGS_REMOVE_irq_work.o = -pg endif obj-y += sched/ -obj-y += power/ obj-$(CONFIG_FREEZER) += freezer.o obj-$(CONFIG_PROFILING) += profile.o @@ -53,6 +52,8 @@ obj-$(CONFIG_PROVE_LOCKING) += spinlock.o obj-$(CONFIG_UID16) += uid16.o obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_KALLSYMS) += kallsyms.o +obj-$(CONFIG_PM) += power/ +obj-$(CONFIG_FREEZER) += power/ obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o obj-$(CONFIG_KEXEC) += kexec.o obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o diff --git a/trunk/kernel/power/swap.c b/trunk/kernel/power/swap.c index 8742fd013a94..3739ecced085 100644 --- a/trunk/kernel/power/swap.c +++ b/trunk/kernel/power/swap.c @@ -773,7 +773,8 @@ static int enough_swap(unsigned int nr_pages, unsigned int flags) pr_debug("PM: Free swap pages: %u\n", free_swap); - required = PAGES_FOR_IO + nr_pages; + required = PAGES_FOR_IO + ((flags & SF_NOCOMPRESS_MODE) ? + nr_pages : (nr_pages * LZO_CMP_PAGES) / LZO_UNC_PAGES + 1); return free_swap > required; } @@ -801,12 +802,10 @@ int swsusp_write(unsigned int flags) printk(KERN_ERR "PM: Cannot get swap writer\n"); return error; } - if (flags & SF_NOCOMPRESS_MODE) { - if (!enough_swap(pages, flags)) { - printk(KERN_ERR "PM: Not enough free swap\n"); - error = -ENOSPC; - goto out_finish; - } + if (!enough_swap(pages, flags)) { + printk(KERN_ERR "PM: Not enough free swap\n"); + error = -ENOSPC; + goto out_finish; } memset(&snapshot, 0, sizeof(struct snapshot_handle)); error = snapshot_read_next(&snapshot); diff --git a/trunk/scripts/Makefile.lib b/trunk/scripts/Makefile.lib index 00c368c6e996..5d986d9adf1b 100644 --- a/trunk/scripts/Makefile.lib +++ b/trunk/scripts/Makefile.lib @@ -93,9 +93,9 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) # already # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will # end up in (or would, if it gets compiled in) -# Note: Files that end up in two or more modules are compiled without the -# KBUILD_MODNAME definition. The reason is that any made-up name would -# differ in different configs. +# Note: It's possible that one object gets potentially linked into more +# than one module. In that case KBUILD_MODNAME will be set to foo_bar, +# where foo and bar are the name of the modules. name-fix = $(subst $(comma),_,$(subst -,_,$1)) basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" modname_flags = $(if $(filter 1,$(words $(modname))),\ @@ -264,7 +264,7 @@ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb) quiet_cmd_dtc = DTC $@ -cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< +cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $< # Bzip2 # --------------------------------------------------------------------------- diff --git a/trunk/scripts/coccicheck b/trunk/scripts/coccicheck index 3c2776466d87..1bb1a1bd2daa 100755 --- a/trunk/scripts/coccicheck +++ b/trunk/scripts/coccicheck @@ -9,23 +9,14 @@ if [ "$C" = "1" -o "$C" = "2" ]; then # FLAGS="-ignore_unknown_options -very_quiet" # OPTIONS=$* - if [ "$KBUILD_EXTMOD" = "" ] ; then - # Workaround for Coccinelle < 0.2.3 - FLAGS="-I $srctree/include -very_quiet" - shift $(( $# - 1 )) - OPTIONS=$1 - else - echo M= is not currently supported when C=1 or C=2 - exit 1 - fi +# Workaround for Coccinelle < 0.2.3 + FLAGS="-I $srctree/include -very_quiet" + shift $(( $# - 1 )) + OPTIONS=$1 else ONLINE=0 FLAGS="-very_quiet" - if [ "$KBUILD_EXTMOD" = "" ] ; then - OPTIONS="-dir $srctree" - else - OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" - fi + OPTIONS="-dir $srctree" fi if [ ! -x "$SPATCH" ]; then diff --git a/trunk/scripts/coccinelle/api/devm_request_and_ioremap.cocci b/trunk/scripts/coccinelle/api/devm_request_and_ioremap.cocci deleted file mode 100644 index 46beb81406ab..000000000000 --- a/trunk/scripts/coccinelle/api/devm_request_and_ioremap.cocci +++ /dev/null @@ -1,105 +0,0 @@ -/// Reimplement a call to devm_request_mem_region followed by a call to ioremap -/// or ioremap_nocache by a call to devm_request_and_ioremap. -/// Devm_request_and_ioremap was introduced in -/// 72f8c0bfa0de64c68ee59f40eb9b2683bffffbb0. It makes the code much more -/// concise. -/// -/// -// Confidence: High -// Copyright: (C) 2011 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -// Options: -no_includes -include_headers - -virtual patch -virtual org -virtual report -virtual context - -@nm@ -expression myname; -identifier i; -@@ - -struct platform_driver i = { .driver = { .name = myname } }; - -@depends on patch@ -expression dev,res,size; -@@ - --if (!devm_request_mem_region(dev, res->start, size, -- \(res->name\|dev_name(dev)\))) { -- ... -- return ...; --} -... when != res->start -( --devm_ioremap(dev,res->start,size) -+devm_request_and_ioremap(dev,res) -| --devm_ioremap_nocache(dev,res->start,size) -+devm_request_and_ioremap(dev,res) -) -... when any - when != res->start - -// this rule is separate from the previous one, because a single file can -// have multiple values of myname -@depends on patch@ -expression dev,res,size; -expression nm.myname; -@@ - --if (!devm_request_mem_region(dev, res->start, size,myname)) { -- ... -- return ...; --} -... when != res->start -( --devm_ioremap(dev,res->start,size) -+devm_request_and_ioremap(dev,res) -| --devm_ioremap_nocache(dev,res->start,size) -+devm_request_and_ioremap(dev,res) -) -... when any - when != res->start - - -@pb depends on org || report || context@ -expression dev,res,size; -expression nm.myname; -position p1,p2; -@@ - -*if - (!devm_request_mem_region@p1(dev, res->start, size, - \(res->name\|dev_name(dev)\|myname\))) { - ... - return ...; -} -... when != res->start -( -*devm_ioremap@p2(dev,res->start,size) -| -*devm_ioremap_nocache@p2(dev,res->start,size) -) -... when any - when != res->start - -@script:python depends on org@ -p1 << pb.p1; -p2 << pb.p2; -@@ - -cocci.print_main("INFO: replace by devm_request_and_ioremap",p1) -cocci.print_secs("",p2) - -@script:python depends on report@ -p1 << pb.p1; -p2 << pb.p2; -@@ - -msg = "INFO: devm_request_mem_region followed by ioremap on line %s can be replaced by devm_request_and_ioremap" % (p2[0].line) -coccilib.report.print_report(p1[0],msg) diff --git a/trunk/scripts/coccinelle/api/kstrdup.cocci b/trunk/scripts/coccinelle/api/kstrdup.cocci index 07a74b2c6196..e0805ad08d39 100644 --- a/trunk/scripts/coccinelle/api/kstrdup.cocci +++ b/trunk/scripts/coccinelle/api/kstrdup.cocci @@ -1,19 +1,16 @@ /// Use kstrdup rather than duplicating its implementation /// // Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report -@depends on patch@ +@@ expression from,to; expression flag,E1,E2; statement S; @@ -26,7 +23,7 @@ statement S; ... when != \(from = E2 \| to = E2 \) - strcpy(to, from); -@depends on patch@ +@@ expression x,from,to; expression flag,E1,E2,E3; statement S; @@ -40,65 +37,3 @@ statement S; if (to==NULL || ...) S ... when != \(x = E3 \| from = E3 \| to = E3 \) - memcpy(to, from, x); - -// --------------------------------------------------------------------- - -@r1 depends on !patch exists@ -expression from,to; -expression flag,E1,E2; -statement S; -position p1,p2; -@@ - -* to = kmalloc@p1(strlen(from) + 1,flag); - ... when != \(from = E1 \| to = E1 \) - if (to==NULL || ...) S - ... when != \(from = E2 \| to = E2 \) -* strcpy@p2(to, from); - -@r2 depends on !patch exists@ -expression x,from,to; -expression flag,E1,E2,E3; -statement S; -position p1,p2; -@@ - -* x = strlen(from) + 1; - ... when != \( x = E1 \| from = E1 \) -* to = \(kmalloc@p1\|kzalloc@p2\)(x,flag); - ... when != \(x = E2 \| from = E2 \| to = E2 \) - if (to==NULL || ...) S - ... when != \(x = E3 \| from = E3 \| to = E3 \) -* memcpy@p2(to, from, x); - -@script:python depends on org@ -p1 << r1.p1; -p2 << r1.p2; -@@ - -cocci.print_main("WARNING opportunity for kstrdep",p1) -cocci.print_secs("strcpy",p2) - -@script:python depends on org@ -p1 << r2.p1; -p2 << r2.p2; -@@ - -cocci.print_main("WARNING opportunity for kstrdep",p1) -cocci.print_secs("memcpy",p2) - -@script:python depends on report@ -p1 << r1.p1; -p2 << r1.p2; -@@ - -msg = "WARNING opportunity for kstrdep (strcpy on line %s)" % (p2[0].line) -coccilib.report.print_report(p1[0], msg) - -@script:python depends on report@ -p1 << r2.p1; -p2 << r2.p2; -@@ - -msg = "WARNING opportunity for kstrdep (memcpy on line %s)" % (p2[0].line) -coccilib.report.print_report(p1[0], msg) diff --git a/trunk/scripts/coccinelle/api/memdup.cocci b/trunk/scripts/coccinelle/api/memdup.cocci index 4dceab6d54de..b5d722077dc1 100644 --- a/trunk/scripts/coccinelle/api/memdup.cocci +++ b/trunk/scripts/coccinelle/api/memdup.cocci @@ -1,17 +1,14 @@ /// Use kmemdup rather than duplicating its implementation /// // Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report @r1@ expression from,to; @@ -31,7 +28,7 @@ position p; ... when != \( x = E1 \| from = E1 \) to = \(kmalloc@p\|kzalloc@p\)(x,flag); -@depends on patch@ +@@ expression from,to,size,flag; position p != {r1.p,r2.p}; statement S; @@ -41,26 +38,3 @@ statement S; + to = kmemdup(from,size,flag); if (to==NULL || ...) S - memcpy(to, from, size); - -@r depends on !patch@ -expression from,to,size,flag; -position p != {r1.p,r2.p}; -statement S; -@@ - -* to = \(kmalloc@p\|kzalloc@p\)(size,flag); - to = kmemdup(from,size,flag); - if (to==NULL || ...) S -* memcpy(to, from, size); - -@script:python depends on org@ -p << r.p; -@@ - -coccilib.org.print_todo(p[0], "WARNING opportunity for kmemdep") - -@script:python depends on report@ -p << r.p; -@@ - -coccilib.report.print_report(p[0], "WARNING opportunity for kmemdep") diff --git a/trunk/scripts/coccinelle/api/memdup_user.cocci b/trunk/scripts/coccinelle/api/memdup_user.cocci index 2efac289fd59..72ce012e878a 100644 --- a/trunk/scripts/coccinelle/api/memdup_user.cocci +++ b/trunk/scripts/coccinelle/api/memdup_user.cocci @@ -1,25 +1,23 @@ -/// Use memdup_user rather than duplicating its implementation +/// Use kmemdup_user rather than duplicating its implementation /// This is a little bit restricted to reduce false positives /// // Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report -@depends on patch@ +@@ expression from,to,size,flag; +position p; identifier l1,l2; @@ -- to = \(kmalloc\|kzalloc\)(size,flag); +- to = \(kmalloc@p\|kzalloc@p\)(size,flag); + to = memdup_user(from,size); if ( - to==NULL @@ -35,26 +33,3 @@ identifier l1,l2; - -EFAULT - ...+> - } - -@r depends on !patch@ -expression from,to,size,flag; -position p; -statement S1,S2; -@@ - -* to = \(kmalloc@p\|kzalloc@p\)(size,flag); - if (to==NULL || ...) S1 - if (copy_from_user(to, from, size) != 0) - S2 - -@script:python depends on org@ -p << r.p; -@@ - -coccilib.org.print_todo(p[0], "WARNING opportunity for memdep_user") - -@script:python depends on report@ -p << r.p; -@@ - -coccilib.report.print_report(p[0], "WARNING opportunity for memdep_user") diff --git a/trunk/scripts/coccinelle/free/devm_free.cocci b/trunk/scripts/coccinelle/free/devm_free.cocci deleted file mode 100644 index 0a1e36146d76..000000000000 --- a/trunk/scripts/coccinelle/free/devm_free.cocci +++ /dev/null @@ -1,71 +0,0 @@ -/// Find uses of standard freeing functons on values allocated using devm_ -/// functions. Values allocated using the devm_functions are freed when -/// the device is detached, and thus the use of the standard freeing -/// function would cause a double free. -/// See Documentation/driver-model/devres.txt for more information. -/// -/// A difficulty of detecting this problem is that the standard freeing -/// function might be called from a different function than the one -/// containing the allocation function. It is thus necessary to make the -/// connection between the allocation function and the freeing function. -/// Here this is done using the specific argument text, which is prone to -/// false positives. There is no rule for the request_region and -/// request_mem_region variants because this heuristic seems to be a bit -/// less reliable in these cases. -/// -// Confidence: Moderate -// Copyright: (C) 2011 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2011 Gilles Muller, INRIA/LiP6. GPLv2. -// URL: http://coccinelle.lip6.fr/ -// Comments: -// Options: -no_includes -include_headers - -virtual org -virtual report -virtual context - -@r depends on context || org || report@ -expression x; -@@ - -( - x = devm_kzalloc(...) -| - x = devm_request_irq(...) -| - x = devm_ioremap(...) -| - x = devm_ioremap_nocache(...) -| - x = devm_ioport_map(...) -) - -@pb@ -expression r.x; -position p; -@@ - -( -* kfree@p(x) -| -* free_irq@p(x) -| -* iounmap@p(x) -| -* ioport_unmap@p(x) -) - -@script:python depends on org@ -p << pb.p; -@@ - -msg="WARNING: invalid free of devm_ allocated data" -coccilib.org.print_todo(p[0], msg) - -@script:python depends on report@ -p << pb.p; -@@ - -msg="WARNING: invalid free of devm_ allocated data" -coccilib.report.print_report(p[0], msg) - diff --git a/trunk/scripts/coccinelle/free/kfree.cocci b/trunk/scripts/coccinelle/free/kfree.cocci index d9ae6d89c2f5..f9f79d9245ee 100644 --- a/trunk/scripts/coccinelle/free/kfree.cocci +++ b/trunk/scripts/coccinelle/free/kfree.cocci @@ -5,9 +5,9 @@ //# SCTP_DBG_OBJCNT_DEC that do not actually evaluate their argument /// // Confidence: Moderate -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers @@ -23,7 +23,7 @@ position p1; kfree@p1(E) @print expression@ -constant char [] c; +constant char *c; expression free.E,E2; type T; position p; @@ -36,10 +36,6 @@ identifier f; E@p == E2 | E@p != E2 -| - E2 == E@p -| - E2 != E@p | !E@p | @@ -117,5 +113,5 @@ p1 << free.p1; p2 << r.p2; @@ -msg = "ERROR: reference preceded by free on line %s" % (p1[0].line) +msg = "reference preceded by free on line %s" % (p1[0].line) coccilib.report.print_report(p2[0],msg) diff --git a/trunk/scripts/coccinelle/iterators/fen.cocci b/trunk/scripts/coccinelle/iterators/fen.cocci index 0a40af828c43..77bc108c3f59 100644 --- a/trunk/scripts/coccinelle/iterators/fen.cocci +++ b/trunk/scripts/coccinelle/iterators/fen.cocci @@ -2,19 +2,16 @@ /// is no point to call of_node_put on the final value. /// // Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report -@depends on patch@ +@@ iterator name for_each_node_by_name; expression np,E; identifier l; @@ -27,7 +24,7 @@ for_each_node_by_name(np,...) { ... when != np = E - of_node_put(np); -@depends on patch@ +@@ iterator name for_each_node_by_type; expression np,E; identifier l; @@ -40,7 +37,7 @@ for_each_node_by_type(np,...) { ... when != np = E - of_node_put(np); -@depends on patch@ +@@ iterator name for_each_compatible_node; expression np,E; identifier l; @@ -53,7 +50,7 @@ for_each_compatible_node(np,...) { ... when != np = E - of_node_put(np); -@depends on patch@ +@@ iterator name for_each_matching_node; expression np,E; identifier l; @@ -65,59 +62,3 @@ for_each_matching_node(np,...) { } ... when != np = E - of_node_put(np); - -// ---------------------------------------------------------------------- - -@r depends on !patch forall@ -//iterator name for_each_node_by_name; -//iterator name for_each_node_by_type; -//iterator name for_each_compatible_node; -//iterator name for_each_matching_node; -expression np,E; -identifier l; -position p1,p2; -@@ - -( -*for_each_node_by_name@p1(np,...) -{ - ... when != break; - when != goto l; -} -| -*for_each_node_by_type@p1(np,...) -{ - ... when != break; - when != goto l; -} -| -*for_each_compatible_node@p1(np,...) -{ - ... when != break; - when != goto l; -} -| -*for_each_matching_node@p1(np,...) -{ - ... when != break; - when != goto l; -} -) -... when != np = E -* of_node_put@p2(np); - -@script:python depends on org@ -p1 << r.p1; -p2 << r.p2; -@@ - -cocci.print_main("unneeded of_node_put",p2) -cocci.print_secs("iterator",p1) - -@script:python depends on report@ -p1 << r.p1; -p2 << r.p2; -@@ - -msg = "ERROR: of_node_put not needed after iterator on line %s" % (p1[0].line) -coccilib.report.print_report(p2[0], msg) diff --git a/trunk/scripts/coccinelle/iterators/itnull.cocci b/trunk/scripts/coccinelle/iterators/itnull.cocci index 259899f6838e..baa4297a4ed1 100644 --- a/trunk/scripts/coccinelle/iterators/itnull.cocci +++ b/trunk/scripts/coccinelle/iterators/itnull.cocci @@ -1,24 +1,20 @@ /// Many iterators have the property that the first argument is always bound -/// to a real list element, never NULL. -//# False positives arise for some iterators that do not have this property, -//# or in cases when the loop cursor is reassigned. The latter should only -//# happen when the matched code is on the way to a loop exit (break, goto, -//# or return). +/// to a real list element, never NULL. False positives arise for some +/// iterators that do not have this property, or in cases when the loop +/// cursor is reassigned. The latter should only happen when the matched +/// code is on the way to a loop exit (break, goto, or return). /// // Confidence: Moderate -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report -@depends on patch@ +@@ iterator I; expression x,E,E1,E2; statement S,S1,S2; @@ -59,36 +55,4 @@ I(x,...) { <... x != NULL + ) ) - ...> } - -@r depends on !patch exists@ -iterator I; -expression x,E; -position p1,p2; -@@ - -*I@p1(x,...) -{ ... when != x = E -( -* x@p2 == NULL -| -* x@p2 != NULL -) - ... when any -} - -@script:python depends on org@ -p1 << r.p1; -p2 << r.p2; -@@ - -cocci.print_main("iterator-bound variable",p1) -cocci.print_secs("useless NULL test",p2) - -@script:python depends on report@ -p1 << r.p1; -p2 << r.p2; -@@ - -msg = "ERROR: iterator variable bound on line %s cannot be NULL" % (p1[0].line) -coccilib.report.print_report(p2[0], msg) + ...> } \ No newline at end of file diff --git a/trunk/scripts/coccinelle/locks/call_kern.cocci b/trunk/scripts/coccinelle/locks/call_kern.cocci index 8f10b49603c3..00af5344a68f 100644 --- a/trunk/scripts/coccinelle/locks/call_kern.cocci +++ b/trunk/scripts/coccinelle/locks/call_kern.cocci @@ -1,20 +1,17 @@ /// Find functions that refer to GFP_KERNEL but are called with locks held. -//# The proposed change of converting the GFP_KERNEL is not necessarily the -//# correct one. It may be desired to unlock the lock, or to not call the -//# function under the lock in the first place. +/// The proposed change of converting the GFP_KERNEL is not necessarily the +/// correct one. It may be desired to unlock the lock, or to not call the +/// function under the lock in the first place. /// // Confidence: Moderate -// Copyright: (C) 2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report @gfp exists@ identifier fn; @@ -35,29 +32,28 @@ fn(...) { ... when any } -@locked exists@ +@locked@ identifier gfp.fn; -position p1,p2; @@ ( -read_lock_irq@p1 +read_lock_irq | -write_lock_irq@p1 +write_lock_irq | -read_lock_irqsave@p1 +read_lock_irqsave | -write_lock_irqsave@p1 +write_lock_irqsave | -spin_lock@p1 +spin_lock | -spin_trylock@p1 +spin_trylock | -spin_lock_irq@p1 +spin_lock_irq | -spin_lock_irqsave@p1 +spin_lock_irqsave | -local_irq_disable@p1 +local_irq_disable ) (...) ... when != read_unlock_irq(...) @@ -68,38 +64,11 @@ local_irq_disable@p1 when != spin_unlock_irq(...) when != spin_unlock_irqrestore(...) when != local_irq_enable(...) -fn@p2(...) +fn(...) -@depends on locked && patch@ +@depends on locked@ position gfp.p; @@ - GFP_KERNEL@p + GFP_ATOMIC - -@depends on locked && !patch@ -position gfp.p; -@@ - -* GFP_KERNEL@p - -@script:python depends on !patch && org@ -p << gfp.p; -fn << gfp.fn; -p1 << locked.p1; -p2 << locked.p2; -@@ - -cocci.print_main("lock",p1) -cocci.print_secs("call",p2) -cocci.print_secs("GFP_KERNEL",p) - -@script:python depends on !patch && report@ -p << gfp.p; -fn << gfp.fn; -p1 << locked.p1; -p2 << locked.p2; -@@ - -msg = "ERROR: function %s called on line %s inside lock on line %s but uses GFP_KERNEL" % (fn,p2[0].line,p1[0].line) -coccilib.report.print_report(p[0], msg) diff --git a/trunk/scripts/coccinelle/locks/flags.cocci b/trunk/scripts/coccinelle/locks/flags.cocci index 1c4ffe6fd846..b4344d838097 100644 --- a/trunk/scripts/coccinelle/locks/flags.cocci +++ b/trunk/scripts/coccinelle/locks/flags.cocci @@ -1,9 +1,9 @@ /// Find nested lock+irqsave functions that use the same flags variables /// // Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers @@ -12,7 +12,7 @@ virtual context virtual org virtual report -@r exists@ +@r@ expression lock1,lock2,flags; position p1,p2; @@ @@ -39,7 +39,7 @@ read_lock_irqsave@p2(lock2,flags) write_lock_irqsave@p2(lock2,flags) ) -@d exists@ +@d@ expression f <= r.flags; expression lock1,lock2,flags; position r.p1, r.p2; @@ -76,5 +76,5 @@ p1 << r.p1; p2 << r.p2; @@ -msg="ERROR: nested lock+irqsave that reuses flags from line %s." % (p1[0].line) +msg="ERROR: nested lock+irqsave that reuses flags from %s." % (p1[0].line) coccilib.report.print_report(p2[0], msg) diff --git a/trunk/scripts/coccinelle/locks/mini_lock.cocci b/trunk/scripts/coccinelle/locks/mini_lock.cocci index 3267d7410bd5..7641a2925434 100644 --- a/trunk/scripts/coccinelle/locks/mini_lock.cocci +++ b/trunk/scripts/coccinelle/locks/mini_lock.cocci @@ -6,14 +6,13 @@ /// function call that releases the lock. /// // Confidence: Moderate -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers -virtual context virtual org virtual report @@ -58,7 +57,7 @@ position r; for(...;...;...) { <+... return@r ...; ...+> } -@err exists@ +@err@ expression E1; position prelocked.p; position up != prelocked.p1; @@ -66,14 +65,14 @@ position r!=looped.r; identifier lock,unlock; @@ -*lock(E1@p,...); +lock(E1@p,...); <+... when != E1 if (...) { ... when != E1 -* return@r ...; + return@r ...; } ...+> -*unlock@up(E1,...); +unlock@up(E1,...); @script:python depends on org@ p << prelocked.p1; diff --git a/trunk/scripts/coccinelle/misc/doubleinit.cocci b/trunk/scripts/coccinelle/misc/doubleinit.cocci index cf74a00cf597..156b20adb351 100644 --- a/trunk/scripts/coccinelle/misc/doubleinit.cocci +++ b/trunk/scripts/coccinelle/misc/doubleinit.cocci @@ -3,9 +3,9 @@ /// initialization. /// // Confidence: Low -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: requires at least Coccinelle 0.2.4, lex or parse error otherwise // Options: -no_includes -include_headers @@ -49,5 +49,5 @@ pr << r.p; @@ if int(ps[0].line) < int(pr[0].line) or (int(ps[0].line) == int(pr[0].line) and int(ps[0].column) < int(pr[0].column)): - msg = "%s: first occurrence line %s, second occurrence line %s" % (fld,ps[0].line,pr[0].line) + msg = "%s: first occurrence %s, second occurrence %s" % (fld,ps[0].line,pr[0].line) coccilib.report.print_report(p0[0],msg) diff --git a/trunk/scripts/coccinelle/null/eno.cocci b/trunk/scripts/coccinelle/null/eno.cocci index ed961a1f7d11..4c9c52b9c413 100644 --- a/trunk/scripts/coccinelle/null/eno.cocci +++ b/trunk/scripts/coccinelle/null/eno.cocci @@ -1,19 +1,16 @@ /// The various basic memory allocation functions don't return ERR_PTR /// // Confidence: High -// Copyright: (C) 2010-2012 Nicolas Palix. GPLv2. -// Copyright: (C) 2010-2012 Julia Lawall, INRIA/LIP6. GPLv2. -// Copyright: (C) 2010-2012 Gilles Muller, INRIA/LiP6. GPLv2. +// Copyright: (C) 2010 Nicolas Palix, DIKU. GPLv2. +// Copyright: (C) 2010 Julia Lawall, DIKU. GPLv2. +// Copyright: (C) 2010 Gilles Muller, INRIA/LiP6. GPLv2. // URL: http://coccinelle.lip6.fr/ // Comments: // Options: -no_includes -include_headers virtual patch -virtual context -virtual org -virtual report -@depends on patch@ +@@ expression x,E; @@ @@ -21,28 +18,3 @@ x = \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|kmem_cache ... when != x = E - IS_ERR(x) + !x - -@r depends on !patch exists@ -expression x,E; -position p1,p2; -@@ - -*x = \(kmalloc@p1\|kzalloc@p1\|kcalloc@p1\|kmem_cache_alloc@p1\|kmem_cache_zalloc@p1\|kmem_cache_alloc_node@p1\|kmalloc_node@p1\|kzalloc_node@p1\)(...) -... when != x = E -* IS_ERR@p2(x) - -@script:python depends on org@ -p1 << r.p1; -p2 << r.p2; -@@ - -cocci.print_main("alloc call",p1) -cocci.print_secs("IS_ERR that should be NULL tests",p2) - -@script:python depends on report@ -p1 << r.p1; -p2 << r.p2; -@@ - -msg = "ERROR: allocation function on line %s returns NULL not ERR_PTR on failure" % (p1[0].line) -coccilib.report.print_report(p2[0], msg) diff --git a/trunk/scripts/dtc/dtc.c b/trunk/scripts/dtc/dtc.c index 451c92d31b19..cbc0193098e4 100644 --- a/trunk/scripts/dtc/dtc.c +++ b/trunk/scripts/dtc/dtc.c @@ -71,7 +71,6 @@ static void __attribute__ ((noreturn)) usage(void) fprintf(stderr, "\t\t\tasm - assembler source\n"); fprintf(stderr, "\t-V \n"); fprintf(stderr, "\t\tBlob version to produce, defaults to %d (relevant for dtb\n\t\tand asm output only)\n", DEFAULT_FDT_VERSION); - fprintf(stderr, "\t-d \n"); fprintf(stderr, "\t-R \n"); fprintf(stderr, "\t\tMake space for reserve map entries (relevant for \n\t\tdtb and asm output only)\n"); fprintf(stderr, "\t-S \n"); @@ -100,7 +99,6 @@ int main(int argc, char *argv[]) const char *inform = "dts"; const char *outform = "dts"; const char *outname = "-"; - const char *depname = NULL; int force = 0, check = 0, sort = 0; const char *arg; int opt; @@ -113,8 +111,7 @@ int main(int argc, char *argv[]) minsize = 0; padsize = 0; - while ((opt = getopt(argc, argv, "hI:O:o:V:d:R:S:p:fcqb:vH:s")) - != EOF) { + while ((opt = getopt(argc, argv, "hI:O:o:V:R:S:p:fcqb:vH:s")) != EOF) { switch (opt) { case 'I': inform = optarg; @@ -128,9 +125,6 @@ int main(int argc, char *argv[]) case 'V': outversion = strtol(optarg, NULL, 0); break; - case 'd': - depname = optarg; - break; case 'R': reservenum = strtol(optarg, NULL, 0); break; @@ -194,14 +188,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "DTC: %s->%s on file \"%s\"\n", inform, outform, arg); - if (depname) { - depfile = fopen(depname, "w"); - if (!depfile) - die("Couldn't open dependency file %s: %s\n", depname, - strerror(errno)); - fprintf(depfile, "%s:", outname); - } - if (streq(inform, "dts")) bi = dt_from_source(arg); else if (streq(inform, "fs")) @@ -211,11 +197,6 @@ int main(int argc, char *argv[]) else die("Unknown input format \"%s\"\n", inform); - if (depfile) { - fputc('\n', depfile); - fclose(depfile); - } - if (cmdline_boot_cpuid != -1) bi->boot_cpuid_phys = cmdline_boot_cpuid; diff --git a/trunk/scripts/dtc/srcpos.c b/trunk/scripts/dtc/srcpos.c index 36a38e9f1a2c..2dbc874288ca 100644 --- a/trunk/scripts/dtc/srcpos.c +++ b/trunk/scripts/dtc/srcpos.c @@ -40,7 +40,6 @@ static char *dirname(const char *path) return NULL; } -FILE *depfile; /* = NULL */ struct srcfile_state *current_srcfile; /* = NULL */ /* Detect infinite include recursion. */ @@ -68,9 +67,6 @@ FILE *srcfile_relative_open(const char *fname, char **fullnamep) strerror(errno)); } - if (depfile) - fprintf(depfile, " %s", fullname); - if (fullnamep) *fullnamep = fullname; else diff --git a/trunk/scripts/dtc/srcpos.h b/trunk/scripts/dtc/srcpos.h index ce980cafe588..bd7966e56a53 100644 --- a/trunk/scripts/dtc/srcpos.h +++ b/trunk/scripts/dtc/srcpos.h @@ -30,7 +30,6 @@ struct srcfile_state { struct srcfile_state *prev; }; -extern FILE *depfile; /* = NULL */ extern struct srcfile_state *current_srcfile; /* = NULL */ FILE *srcfile_relative_open(const char *fname, char **fullnamep); diff --git a/trunk/scripts/genksyms/Makefile b/trunk/scripts/genksyms/Makefile index aca33b98bf63..a5510903e874 100644 --- a/trunk/scripts/genksyms/Makefile +++ b/trunk/scripts/genksyms/Makefile @@ -11,4 +11,3 @@ HOSTCFLAGS_lex.lex.o := -I$(src) # dependencies on generated files need to be listed explicitly $(obj)/lex.lex.o: $(obj)/keywords.hash.c $(obj)/parse.tab.h -clean-files := keywords.hash.c lex.lex.c parse.tab.c parse.tab.h diff --git a/trunk/scripts/kconfig/Makefile b/trunk/scripts/kconfig/Makefile index 79662658fb91..914833d99b06 100644 --- a/trunk/scripts/kconfig/Makefile +++ b/trunk/scripts/kconfig/Makefile @@ -50,8 +50,9 @@ localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf # Create new linux.pot file # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files +# The symlink is used to repair a deficiency in arch/um update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h - $(Q)echo " GEN config.pot" + $(Q)echo " GEN config" $(Q)xgettext --default-domain=linux \ --add-comments --keyword=_ --keyword=N_ \ --from-code=UTF-8 \ @@ -62,11 +63,10 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ $(srctree)/arch/*/um/Kconfig`; \ do \ - echo " GEN $$i"; \ + echo " GEN $$i"; \ $(obj)/kxgettext $$i \ >> $(obj)/config.pot; \ done ) - $(Q)echo " GEN linux.pot" $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ --output $(obj)/linux.pot $(Q)rm -f $(obj)/config.pot diff --git a/trunk/scripts/kconfig/confdata.c b/trunk/scripts/kconfig/confdata.c index 7c7a5a6cc3f5..5a58965d8800 100644 --- a/trunk/scripts/kconfig/confdata.c +++ b/trunk/scripts/kconfig/confdata.c @@ -464,7 +464,7 @@ kconfig_print_comment(FILE *fp, const char *value, void *arg) fprintf(fp, "#"); if (l) { fprintf(fp, " "); - xfwrite(p, l, 1, fp); + fwrite(p, l, 1, fp); p += l; } fprintf(fp, "\n"); @@ -537,7 +537,7 @@ header_print_comment(FILE *fp, const char *value, void *arg) fprintf(fp, " *"); if (l) { fprintf(fp, " "); - xfwrite(p, l, 1, fp); + fwrite(p, l, 1, fp); p += l; } fprintf(fp, "\n"); diff --git a/trunk/scripts/kconfig/expr.h b/trunk/scripts/kconfig/expr.h index d4ecce8bc3a6..80fce57080cc 100644 --- a/trunk/scripts/kconfig/expr.h +++ b/trunk/scripts/kconfig/expr.h @@ -10,7 +10,6 @@ extern "C" { #endif -#include #include #ifndef __cplusplus #include diff --git a/trunk/scripts/kconfig/gconf.c b/trunk/scripts/kconfig/gconf.c index adc230638c5b..9f4438027df4 100644 --- a/trunk/scripts/kconfig/gconf.c +++ b/trunk/scripts/kconfig/gconf.c @@ -683,7 +683,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, - GTK_BUTTONS_CLOSE, "%s", intro_text); + GTK_BUTTONS_CLOSE, intro_text); g_signal_connect_swapped(GTK_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); @@ -701,7 +701,7 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, - GTK_BUTTONS_CLOSE, "%s", about_text); + GTK_BUTTONS_CLOSE, about_text); g_signal_connect_swapped(GTK_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); @@ -720,7 +720,7 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, - GTK_BUTTONS_CLOSE, "%s", license_text); + GTK_BUTTONS_CLOSE, license_text); g_signal_connect_swapped(GTK_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(dialog)); @@ -830,7 +830,7 @@ static void renderer_edited(GtkCellRendererText * cell, static void change_sym_value(struct menu *menu, gint col) { struct symbol *sym = menu->sym; - tristate newval; + tristate oldval, newval; if (!sym) return; @@ -847,6 +847,7 @@ static void change_sym_value(struct menu *menu, gint col) switch (sym_get_type(sym)) { case S_BOOLEAN: case S_TRISTATE: + oldval = sym_get_tristate_value(sym); if (!sym_tristate_within_range(sym, newval)) newval = yes; sym_set_tristate_value(sym, newval); @@ -1277,6 +1278,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) gboolean valid; GtkTreeIter *sibling; struct symbol *sym; + struct property *prop; struct menu *menu1, *menu2; if (src == &rootmenu) @@ -1285,6 +1287,7 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) valid = gtk_tree_model_iter_children(model2, child2, dst); for (child1 = src->list; child1; child1 = child1->next) { + prop = child1->prompt; sym = child1->sym; reparse: diff --git a/trunk/scripts/kconfig/lkc.h b/trunk/scripts/kconfig/lkc.h index c18f2bd9c095..b633bdb9f3d4 100644 --- a/trunk/scripts/kconfig/lkc.h +++ b/trunk/scripts/kconfig/lkc.h @@ -90,10 +90,8 @@ struct conf_printer { /* confdata.c and expr.c */ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) { - assert(len != 0); - - if (fwrite(str, len, count, out) != count) - fprintf(stderr, "Error in writing or end of file.\n"); + if (fwrite(str, len, count, out) < count) + fprintf(stderr, "\nError in writing or end of file.\n"); } /* menu.c */ diff --git a/trunk/scripts/kconfig/mconf.c b/trunk/scripts/kconfig/mconf.c index 2c6286c0bc1a..19e200d91120 100644 --- a/trunk/scripts/kconfig/mconf.c +++ b/trunk/scripts/kconfig/mconf.c @@ -830,8 +830,6 @@ static int handle_exit(void) fprintf(stderr, _("\n\n" "Your configuration changes were NOT saved." "\n\n")); - if (res != KEY_ESC) - res = 0; } return res; diff --git a/trunk/scripts/kconfig/merge_config.sh b/trunk/scripts/kconfig/merge_config.sh deleted file mode 100644 index ceadf0e150cf..000000000000 --- a/trunk/scripts/kconfig/merge_config.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/sh -# merge_config.sh - Takes a list of config fragment values, and merges -# them one by one. Provides warnings on overridden values, and specified -# values that did not make it to the resulting .config file (due to missed -# dependencies or config symbol removal). -# -# Portions reused from kconf_check and generate_cfg: -# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/kconf_check -# http://git.yoctoproject.org/cgit/cgit.cgi/yocto-kernel-tools/tree/tools/generate_cfg -# -# Copyright (c) 2009-2010 Wind River Systems, Inc. -# Copyright 2011 Linaro -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. - -clean_up() { - rm -f $TMP_FILE - exit -} -trap clean_up HUP INT TERM - -usage() { - echo "Usage: $0 [OPTIONS] [CONFIG [...]]" - echo " -h display this help text" - echo " -m only merge the fragments, do not execute the make command" - echo " -n use allnoconfig instead of alldefconfig" -} - -MAKE=true -ALLTARGET=alldefconfig - -while true; do - case $1 in - "-n") - ALLTARGET=allnoconfig - shift - continue - ;; - "-m") - MAKE=false - shift - continue - ;; - "-h") - usage - exit - ;; - *) - break - ;; - esac -done - - - -MERGE_LIST=$* -SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" -TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) - -# Merge files, printing warnings on overrided values -for MERGE_FILE in $MERGE_LIST ; do - echo "Merging $MERGE_FILE" - CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) - - for CFG in $CFG_LIST ; do - grep -q -w $CFG $TMP_FILE - if [ $? -eq 0 ] ; then - PREV_VAL=$(grep -w $CFG $TMP_FILE) - NEW_VAL=$(grep -w $CFG $MERGE_FILE) - if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then - echo Value of $CFG is redefined by fragment $MERGE_FILE: - echo Previous value: $PREV_VAL - echo New value: $NEW_VAL - echo - fi - sed -i "/$CFG[ =]/d" $TMP_FILE - fi - done - cat $MERGE_FILE >> $TMP_FILE -done - -if [ "$MAKE" = "false" ]; then - cp $TMP_FILE .config - echo "#" - echo "# merged configuration written to .config (needs make)" - echo "#" - clean_up - exit -fi - -# Use the merged file as the starting point for: -# alldefconfig: Fills in any missing symbols with Kconfig default -# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set -make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET - - -# Check all specified config values took (might have missed-dependency issues) -for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do - - REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) - ACTUAL_VAL=$(grep -w -e "$CFG" .config) - if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then - echo "Value requested for $CFG not in final .config" - echo "Requested value: $REQUESTED_VAL" - echo "Actual value: $ACTUAL_VAL" - echo "" - fi -done - -clean_up diff --git a/trunk/scripts/tags.sh b/trunk/scripts/tags.sh index 833813a99e7c..38f6617a2cb1 100755 --- a/trunk/scripts/tags.sh +++ b/trunk/scripts/tags.sh @@ -132,28 +132,7 @@ exuberant() --regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/' \ --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ - --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' \ - --regex-c++='/PAGEFLAG\(([^,)]*).*/Page\1/' \ - --regex-c++='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \ - --regex-c++='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \ - --regex-c++='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \ - --regex-c++='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \ - --regex-c++='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \ - --regex-c++='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \ - --regex-c++='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \ - --regex-c++='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \ - --regex-c++='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \ - --regex-c++='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \ - --regex-c++='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \ - --regex-c++='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \ - --regex-c++='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \ - --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \ - --regex-c++='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \ - --regex-c++='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \ - --regex-c++='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ - --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ - --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ - --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' + --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' all_kconfigs | xargs $1 -a \ --langdef=kconfig --language-force=kconfig \ @@ -167,8 +146,6 @@ exuberant() --langdef=dotconfig --language-force=dotconfig \ --regex-dotconfig='/^#?[[:blank:]]*(CONFIG_[[:alnum:]_]+)/\1/' - # Remove structure forward declarations. - LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' tags } emacs() @@ -177,28 +154,7 @@ emacs() --regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/' \ --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ - --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' \ - --regex='/PAGEFLAG\(([^,)]*).*/Page\1/' \ - --regex='/PAGEFLAG\(([^,)]*).*/SetPage\1/' \ - --regex='/PAGEFLAG\(([^,)]*).*/ClearPage\1/' \ - --regex='/TESTSETFLAG\(([^,)]*).*/TestSetPage\1/' \ - --regex='/TESTPAGEFLAG\(([^,)]*).*/Page\1/' \ - --regex='/SETPAGEFLAG\(([^,)]*).*/SetPage\1/' \ - --regex='/__SETPAGEFLAG\(([^,)]*).*/__SetPage\1/' \ - --regex='/TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \ - --regex='/__TESTCLEARFLAG\(([^,)]*).*/TestClearPage\1/' \ - --regex='/CLEARPAGEFLAG\(([^,)]*).*/ClearPage\1/' \ - --regex='/__CLEARPAGEFLAG\(([^,)]*).*/__ClearPage\1/' \ - --regex='/__PAGEFLAG\(([^,)]*).*/__SetPage\1/' \ - --regex='/__PAGEFLAG\(([^,)]*).*/__ClearPage\1/' \ - --regex='/PAGEFLAG_FALSE\(([^,)]*).*/Page\1/' \ - --regex='/TESTSCFLAG\(([^,)]*).*/TestSetPage\1/' \ - --regex='/TESTSCFLAG\(([^,)]*).*/TestClearPage\1/' \ - --regex='/SETPAGEFLAG_NOOP\(([^,)]*).*/SetPage\1/' \ - --regex='/CLEARPAGEFLAG_NOOP\(([^,)]*).*/ClearPage\1/' \ - --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ - --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ - --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' + --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' all_kconfigs | xargs $1 -a \ --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'