aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-12-10rtc: omap: add helper to read 32-bit registersJohan Hovold1-0/+5
Add helper to read full register width. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: add helper to read raw bcd timeJohan Hovold1-8/+10
Add helper to read raw BCD time that can be used in interrupt context. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: silence bogus power-up reset message at probeJohan Hovold1-6/+13
Some legacy RTC IP revisions has a power-up reset flag in the status register that later revisions lack. As this flag is always read back as set on later revisions (or is overloaded with a different flag), make sure to only clear the flag and print the info message on legacy platforms. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: add structured device-type infoJohan Hovold1-52/+51
Add structured device-type info to encode IP-block revision differences. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: remove DRIVER_NAME macroJohan Hovold1-5/+3
Remove DRIVER_NAME macro which was used for unrelated strings (e.g. id-table entry and module name), but not for related ones (e.g. module name and alias). Also move the module alias to the other module-info entries. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: add device abstractionJohan Hovold1-106/+133
Add struct omap_rtc to hold previously global data as well as the IP-block feature flags. Also convert the register-access macros to proper inline helper functions. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: make platform-device id table constJohan Hovold1-1/+1
Make platform-device id table const. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: use dev_infoJohan Hovold1-4/+3
Use dev_info rather than pr_info. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: remove unused register-base defineJohan Hovold1-2/+0
Remove register-base define, which is no longer used. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: fix class-device registrationJohan Hovold1-23/+23
Make sure not to register the class device until after the device has been configured. Currently, the device is not fully configured (e.g. 24-hour mode) when the class device is registered, something which involves driver callbacks for example to read the current time. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: clean up probe error handlingJohan Hovold1-23/+18
Remove some debug messages and return errors from subsystems rather than always fail with -EIO. Note that the class-registration error has already been logged by rtc core. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: fix interrupt disable at probeJohan Hovold1-3/+5
Use writel instead of writeb when disabling interrupts at probe as ALARM2 is not cleared otherwise on some IP-block revisions (e.g. AM3352). Note that the driver currently never enables the ALARM2 interrupt. Signed-off-by: Johan Hovold <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Tested-by: Felipe Balbi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: fix missing wakealarm attributeJohan Hovold1-2/+3
The platform device must be registered as wakeup capable before registering the class device, or the wakealarm attribute will not be created. Also make sure to unregister the wakeup source on probe errors. Fixes: 1d2e2b65d098 ("rtc: omap: restore back (hard-code) wakeup support") Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Felipe Balbi <[email protected]> Tested-by: Felipe Balbi <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10rtc: omap: fix clock-source configurationJohan Hovold1-2/+4
This series fixes a few issues with the omap rtc-driver, cleans up a bit, adds device abstraction, and finally adds support for the PMIC control feature found in some revisions of this RTC IP block. Ultimately, this allows for powering off the Beaglebone and waking it up again on RTC alarms. This patch (of 20): Make sure not to reset the clock-source configuration when enabling the 32kHz clock mux. Until the clock source can be configured through device tree we must not overwrite settings made by the bootloader (e.g. clock-source selection). Fixes: cd914bba03d8 ("drivers/rtc/rtc-omap.c: add support for enabling 32khz clock") Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Felipe Balbi <[email protected]> Tested-by: Felipe Balbi <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Tony Lindgren <[email protected]> Cc: Benot Cousson <[email protected]> Cc: Lokesh Vutla <[email protected]> Cc: Guenter Roeck <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Tero Kristo <[email protected]> Cc: Keerthy J <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10drivers/rtc/interface.c: check the validation of rtc_time in __rtc_read_timeHyogi Gim1-0/+8
Some rtc devices always return '0' when rtc_class_ops.read_time is called. So if rtc_time isn't verified in callback, rtc interface cannot know whether rtc_time is valid. Check rtc_time by using 'rtc_valid_tm' in '__rtc_read_time'. And add the message for debugging. Signed-off-by: Hyogi Gim <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: John Stultz <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10drivers/rtc/rtc-sirfsoc.c: move hardware initilization earlier in probeGuo Zeng1-8/+8
Move rtc register to be later than hardware initialization. The reason is that devm_rtc_device_register() will do read_time() which is a callback accessing hardware. This sometimes causes a hang in the hardware related callback. Signed-off-by: Guo Zeng <[email protected]> Signed-off-by: Barry Song <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10ncpfs: return proper error from NCP_IOC_SETROOT ioctlJan Kara1-1/+0
If some error happens in NCP_IOC_SETROOT ioctl, the appropriate error return value is then (in most cases) just overwritten before we return. This can result in reporting success to userspace although error happened. This bug was introduced by commit 2e54eb96e2c8 ("BKL: Remove BKL from ncpfs"). Propagate the errors correctly. Coverity id: 1226925. Fixes: 2e54eb96e2c80 ("BKL: Remove BKL from ncpfs") Signed-off-by: Jan Kara <[email protected]> Cc: Petr Vandrovec <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10init: allow CONFIG_INIT_FALLBACK=n to disable defaults if init= failsAndy Lutomirski2-1/+22
If a user puts init=/whatever on the command line and /whatever can't be run, then the kernel will try a few default options before giving up. If init=/whatever came from a bootloader prompt, then this is unexpected but probably harmless. On the other hand, if it comes from a script (e.g. a tool like virtme or perhaps a future kselftest script), then the fallbacks are likely to exist, but they'll do the wrong thing. For example, they might unexpectedly invoke systemd. This adds a config option CONFIG_INIT_FALLBACK. If unset, then a failure to run the specified init= process be fatal. The tentative plan is to remove CONFIG_INIT_FALLBACK for 3.20. [[email protected]: coding-style fixes] Signed-off-by: Andy Lutomirski <[email protected]> Cc: Rob Landley <[email protected]> Cc: Chuck Ebbert <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Shuah Khan <[email protected]> Cc: Frank Rowand <[email protected]> Cc: Josh Triplett <[email protected]> Acked-by: Rusty Russell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10fs/binfmt_elf.c: fix internal inconsistency relating to vma dump sizeJungseung Lee1-18/+22
vma_dump_size() has been used several times on actual dumper and it is supposed to return the same value for the same vma. But vma_dump_size() could return different values for same vma. The known problem case is concurrent shared memory removal. If a vma is used for a shared memory and that shared memory is removed between writing program header and dumping vma memory, this will result in a dump file which is internally consistent. To fix the problem, we set baseline to get dump size and store the size into vma_filesz and always use the same vma dump size which is stored in vma_filsz. The consistnecy with reality is not actually guranteed, but it's tolerable since that is fully consistent with base line. Signed-off-by: Jungseung Lee <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10fs/binfmt_misc.c: use GFP_KERNEL instead of GFP_USERAndrew Morton1-2/+2
GFP_USER means "honour cpuset nodes-allowed beancounting". These are regular old kernel objects and there seems no reason to give them this treatment. Acked-by: Mike Frysinger <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10binfmt_misc: clean up code style a bitMike Frysinger1-148/+145
Clean up various coding style issues that checkpatch complains about. No functional changes here. Signed-off-by: Mike Frysinger <[email protected]> Cc: Al Viro <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10binfmt_misc: add comments & debug logsMike Frysinger1-15/+121
When trying to develop a custom format handler, the errors returned all effectively get bucketed as EINVAL with no kernel messages. The other errors (ENOMEM/EFAULT) are internal/obvious and basic. Thus any time a bad handler is rejected, the developer has to walk the dense code and try to guess where it went wrong. Needing to dive into kernel code is itself a fairly high barrier for a lot of people. To improve this situation, let's deploy extensive pr_debug markers at logical parse points, and add comments to the dense parsing logic. It let's you see exactly where the parsing aborts, the string the kernel received (useful when dealing with shell code), how it translated the buffers to binary data, and how it will apply the mask at runtime. Some example output: $ echo ':qemu-foo:M::\x7fELF\xAD\xAD\x01\x00:\xff\xff\xff\xff\xff\x00\xff\x00:/usr/bin/qemu-foo:POC' > register $ dmesg binfmt_misc: register: received 92 bytes binfmt_misc: register: delim: 0x3a {:} binfmt_misc: register: name: {qemu-foo} binfmt_misc: register: type: M (magic) binfmt_misc: register: offset: 0x0 binfmt_misc: register: magic[raw]: 5c 78 37 66 45 4c 46 5c 78 41 44 5c 78 41 44 5c \x7fELF\xAD\xAD\ binfmt_misc: register: magic[raw]: 78 30 31 5c 78 30 30 00 x01\x00. binfmt_misc: register: mask[raw]: 5c 78 66 66 5c 78 66 66 5c 78 66 66 5c 78 66 66 \xff\xff\xff\xff binfmt_misc: register: mask[raw]: 5c 78 66 66 5c 78 30 30 5c 78 66 66 5c 78 30 30 \xff\x00\xff\x00 binfmt_misc: register: mask[raw]: 00 . binfmt_misc: register: magic/mask length: 8 binfmt_misc: register: magic[decoded]: 7f 45 4c 46 ad ad 01 00 .ELF.... binfmt_misc: register: mask[decoded]: ff ff ff ff ff 00 ff 00 ........ binfmt_misc: register: magic[masked]: 7f 45 4c 46 ad 00 01 00 .ELF.... binfmt_misc: register: interpreter: {/usr/bin/qemu-foo} binfmt_misc: register: flag: P (preserve argv0) binfmt_misc: register: flag: O (open binary) binfmt_misc: register: flag: C (preserve creds) The [raw] lines show us exactly what was received from userspace. The lines after that show us how the kernel has decoded things. Signed-off-by: Mike Frysinger <[email protected]> Cc: Al Viro <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: add ability to --fix (coalesce) string fragments on multiple linesJoe Perches1-46/+69
Add --fix option to coalesce string fragments. This does not coalesce string fragments that have newline terminations or are otherwise exempted. Other miscellanea: o move all the string tests together. o fix get_quoted_string function for tab characters o fix concatination typo Signed-off-by: Joe Perches <[email protected]> Cc: Andy Whitcroft <[email protected]> Cc: Dan Carpenter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: add --strict "pointer comparison to NULL" testJoe Perches1-0/+14
It seems there are more and more uses of "if (!ptr)" in preference to "if (ptr == NULL)" so add a --strict test to emit a message when using the latter form. This also finds (ptr != NULL). Fix it too if desired. Signed-off-by: Joe Perches <[email protected]> Cc: Dan Carpenter <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: add test for consecutive string fragmentsJoe Perches1-0/+6
Emit a warning when single line string coalescing occurs. Code that uses compiler string concatenation on a single line like: printk("foo" "bar"); is generally better to read concatenated like: printk("foobar"); Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: add --strict preference for #defines using BIT(foo)Joe Perches1-0/+11
Using BIT(foo) and BIT_ULL(bar) is more common now. Suggest using these macros over #defines with 1<<value. Add a --fix option too. Signed-off-by: Joe Perches <[email protected]> Cc: David Miller <[email protected]> Cc: Jiri Pirko <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: allow certain SI units with three charactersJulius Werner1-1/+3
Checkpatch flags CamelCase identifiers in strict mode, but it has a feature to ignore parts with only two characters to allow for SI units like mV or uA. Unfortunately, not all SI units fit in two characters, and not all are lower case followed by upper case. This patch adds hardcoded detection for frequency and 1024-based size units (Hz/KHz/MHz/GHz/THz and KiB/MiB/GiB/TiB), since allowing any three character combinations might be too lenient. The list can later be expanded as needed. Signed-off-by: Julius Werner <[email protected]> Acked-by: Joe Perches <[email protected]> Cc: Andy Whitcroft <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: Add --strict test for function pointer calling styleJoe Perches1-3/+21
Peter Hurley wrote: The use of older function ptr calling style, (*fn)(), makes static analysis more error-prone; replace with modern fn() style. So make checkpatch emit a --strict test for that condition. Update the unnecessary parentheses test for dereferencing objects at the same time and create a $fix mechanism too. Signed-off-by: Joe Perches <[email protected]> Cc: Peter Hurley <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: reduce MAINTAINERS update message frequencyJoe Perches1-0/+6
When files are being added/moved/deleted and a patch contains an update to the MAINTAINERS file, assume it's to update the MAINTAINERS file correctly and do not emit the "does MAINTAINERS need updating?" message. Reported by many people. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: try to avoid mask and shift errorsJoe Perches1-0/+8
Shift has a higher precedence that mask so warn when a mask then shift operation is done without parentheses around the mask. This test works well for a right shift, but the left shift is pretty commonly done correctly so only warn on the right shift. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: fix use via symlink, make missing spelling file non-fatalJoe Perches1-17/+21
Commit 66b47b4a9dad ("checkpatch: look for common misspellings") made it difficult to use checkpatch via a symlink. Fix that and make a missing spelling.txt file non-fatal. Emit a warning when the spelling.txt file can not be opened. Reference: http://xkcd.com/1172/ Signed-off-by: Joe Perches <[email protected]> Reported-by: Jani Nikula <[email protected]> Tested-by: Jani Nikula <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Andy Whitcroft <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: improve warning message for "needless if" caseFabio Estevam1-1/+1
Add an 'and' to the sentence so that it looks better: WARNING: debugfs_remove(NULL) is safe and this check is probably not required Signed-off-by: Fabio Estevam <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: improve test for no space after castJoe Perches1-1/+2
sizeof(foo) is not a cast, allow a space after it. Signed-off-by: Joe Perches <[email protected]> Tested-by: Kalle Valo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: add error on use of attribute((weak)) or __weak declarationsJoe Perches1-0/+9
Using weak declarations can have unintended link defects. The __weak on the declaration causes non-weak definitions to become weak. Emit an error on its use. Signed-off-by: Joe Perches <[email protected]> Reported-by: Bjorn Helgaas <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10checkpatch: add an error test for no space before commaJoe Perches1-2/+21
Using code like: int foo , bar; is not preferred to: int foo, bar; so emit an error on this style. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10lib/lcm.c: lcm(n,0)=lcm(0,n) is 0, not nRasmus Villemoes1-4/+2
Return the mathematically correct answer when an argument is 0. Signed-off-by: Rasmus Villemoes <[email protected]> Cc: Martin K. Petersen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10lib/lcm.c: ensure correct result whenever it fitsRasmus Villemoes1-1/+1
Ensure that lcm(a,b) returns the mathematically correct result, provided it fits in an unsigned long. The current version returns garbage if a*b overflows, even if the final result would fit. Signed-off-by: Rasmus Villemoes <[email protected]> Cc: Martin K. Petersen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10MAINTAINERS: update ivtv mailing lists as subscriber-onlyJoe Perches1-2/+2
Mark these as subscriber-only mailing lists. Signed-off-by: Joe Perches <[email protected]> Cc: Andy Walls <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10printk: drop logbuf_cpu volatile qualifierAlex Elder1-1/+1
Pranith Kumar posted a patch in which removed the "volatile" qualifier for the "logbuf_cpu" variable in vprintk_emit(). https://lkml.org/lkml/2014/11/13/894 In his patch, he used ACCESS_ONCE() for all references to that symbol to provide whatever protection was intended. There was some discussion that followed, and in the end Steven Rostedt concluded that not only was "volatile" not needed, neither was it required to use ACCESS_ONCE(). I offered an elaborate description that concluded Steven was right, and Pranith asked me to submit an alternative patch. And this is it. The basic reason "volatile" is not needed is that "logbuf_cpu" has static storage duration, and vprintk_emit() is an exported interface. This means that the value of logbuf_cpu must be read from memory the first time it is used in a particular call of vprintk_emit(). The variable's value is read only once in that function, when it's read it'll be the copy from memory (or cache). In addition, the value of "logbuf_cpu" is only ever written under protection of a spinlock. So the value that is read is the "real" value (and not an out-of-date cached one). If its value is not UINT_MAX, it is the current CPU's processor id, and it will have been last written by the running CPU. Signed-off-by: Alex Elder <[email protected]> Reported-by: Pranith Kumar <[email protected]> Suggested-by: Steven Rostedt <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Luis R. Rodriguez <[email protected]> Cc: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10printk: add and use LOGLEVEL_<level> defines for KERN_<LEVEL> equivalentsJoe Perches4-18/+29
Use #defines instead of magic values. Signed-off-by: Joe Perches <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Cc: Jason Baron <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10tile: use pr_warn instead of pr_warningJoe Perches1-18/+15
Use the more common pr_warn. Coalesce formats, realign arguments. Signed-off-by: Joe Perches <[email protected]> Acked-by: Chris Metcalf <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10tile: neaten early_printk usesJoe Perches1-7/+5
Coalesce the formats and align arguments. Signed-off-by: Joe Perches <[email protected]> Acked-by: Chris Metcalf <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10printk: remove used-once early_vprintkJoe Perches3-18/+21
Eliminate the unlikely possibility of message interleaving for early_printk/early_vprintk use. early_vprintk can be done via the %pV extension so remove this unnecessary function and change early_printk to have the equivalent vprintk code. All uses of early_printk already end with a newline so also remove the unnecessary newline from the early_printk function. Signed-off-by: Joe Perches <[email protected]> Acked-by: Chris Metcalf <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10kernel: add panic_on_warnPrarit Bhargava8-14/+61
There have been several times where I have had to rebuild a kernel to cause a panic when hitting a WARN() in the code in order to get a crash dump from a system. Sometimes this is easy to do, other times (such as in the case of a remote admin) it is not trivial to send new images to the user. A much easier method would be a switch to change the WARN() over to a panic. This makes debugging easier in that I can now test the actual image the WARN() was seen on and I do not have to engage in remote debugging. This patch adds a panic_on_warn kernel parameter and /proc/sys/kernel/panic_on_warn calls panic() in the warn_slowpath_common() path. The function will still print out the location of the warning. An example of the panic_on_warn output: The first line below is from the WARN_ON() to output the WARN_ON()'s location. After that the panic() output is displayed. WARNING: CPU: 30 PID: 11698 at /home/prarit/dummy_module/dummy-module.c:25 init_dummy+0x1f/0x30 [dummy_module]() Kernel panic - not syncing: panic_on_warn set ... CPU: 30 PID: 11698 Comm: insmod Tainted: G W OE 3.17.0+ #57 Hardware name: Intel Corporation S2600CP/S2600CP, BIOS RMLSDP.86I.00.29.D696.1311111329 11/11/2013 0000000000000000 000000008e3f87df ffff88080f093c38 ffffffff81665190 0000000000000000 ffffffff818aea3d ffff88080f093cb8 ffffffff8165e2ec ffffffff00000008 ffff88080f093cc8 ffff88080f093c68 000000008e3f87df Call Trace: [<ffffffff81665190>] dump_stack+0x46/0x58 [<ffffffff8165e2ec>] panic+0xd0/0x204 [<ffffffffa038e05f>] ? init_dummy+0x1f/0x30 [dummy_module] [<ffffffff81076b90>] warn_slowpath_common+0xd0/0xd0 [<ffffffffa038e040>] ? dummy_greetings+0x40/0x40 [dummy_module] [<ffffffff81076c8a>] warn_slowpath_null+0x1a/0x20 [<ffffffffa038e05f>] init_dummy+0x1f/0x30 [dummy_module] [<ffffffff81002144>] do_one_initcall+0xd4/0x210 [<ffffffff811b52c2>] ? __vunmap+0xc2/0x110 [<ffffffff810f8889>] load_module+0x16a9/0x1b30 [<ffffffff810f3d30>] ? store_uevent+0x70/0x70 [<ffffffff810f49b9>] ? copy_module_from_fd.isra.44+0x129/0x180 [<ffffffff810f8ec6>] SyS_finit_module+0xa6/0xd0 [<ffffffff8166cf29>] system_call_fastpath+0x12/0x17 Successfully tested by me. hpa said: There is another very valid use for this: many operators would rather a machine shuts down than being potentially compromised either functionally or security-wise. Signed-off-by: Prarit Bhargava <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Rusty Russell <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Masami Hiramatsu <[email protected]> Acked-by: Yasuaki Ishimatsu <[email protected]> Cc: Fabian Frederick <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10include/linux/file.h: remove get_unused_fd() macroYann Droneaud1-1/+0
Macro get_unused_fd() is used to allocate a file descriptor with default flags. Those default flags (0) don't enable close-on-exec. This can be seen as an unsafe default: in most case close-on-exec should be enabled to not leak file descriptor across exec(). It would be better to have a "safer" default set of flags, eg. O_CLOEXEC must be used to enable close-on-exec. Instead this patch removes get_unused_fd() so that out of tree modules won't be affect by a runtime behavor change which might introduce other kind of bugs: it's better to catch the change at build time, making it easier to fix. Removing the macro will also promote use of get_unused_fd_flags() (or anon_inode_getfd()) with flags provided by userspace. Or, if flags cannot be given by userspace, with flags set to O_CLOEXEC by default. Signed-off-by: Yann Droneaud <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10fs/file.c: replace get_unused_fd() with get_unused_fd_flags(0)Yann Droneaud1-1/+1
This patch replaces calls to get_unused_fd() with equivalent call to get_unused_fd_flags(0) to preserve current behavor for existing code. In a further patch, get_unused_fd() will be removed so that new code start using get_unused_fd_flags(), with the hope O_CLOEXEC could be used, either by default or choosen by userspace. Signed-off-by: Yann Droneaud <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10binfmt_misc: replace get_unused_fd() with get_unused_fd_flags(0)Yann Droneaud1-1/+1
This patch replaces calls to get_unused_fd() with equivalent call to get_unused_fd_flags(0) to preserve current behavor for existing code. In a further patch, get_unused_fd() will be removed so that new code start using get_unused_fd_flags(), with the hope O_CLOEXEC could be used, either by default or choosen by userspace. Signed-off-by: Yann Droneaud <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10ppc/cell: replace get_unused_fd() with get_unused_fd_flags(0)Yann Droneaud1-2/+2
This patch replaces calls to get_unused_fd() with equivalent call to get_unused_fd_flags(0) to preserve current behavor for existing code. In a further patch, get_unused_fd() will be removed so that new code start using get_unused_fd_flags(), with the hope O_CLOEXEC could be used, either by default or choosen by userspace. Signed-off-by: Yann Droneaud <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10ia64: replace get_unused_fd() with get_unused_fd_flags(0)Yann Droneaud1-1/+1
This patch replaces calls to get_unused_fd() with equivalent call to get_unused_fd_flags(0) to preserve current behavor for existing code. In a further patch, get_unused_fd() will be removed so that new code start using get_unused_fd_flags(), with the hope O_CLOEXEC could be used, either by default or choosen by userspace. Signed-off-by: Yann Droneaud <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2014-12-10exit: ptrace: shift "reap dead" code from exit_ptrace() to ↵Oleg Nesterov3-27/+8
forget_original_parent() Now that forget_original_parent() uses ->ptrace_entry for EXIT_DEAD tasks, we can simply pass "dead_children" list to exit_ptrace() and remove another release_task() loop. Plus this way we do not need to drop and reacquire tasklist_lock. Also shift the list_empty(ptraced) check, if we want this optimization it makes sense to eliminate the function call altogether. Signed-off-by: Oleg Nesterov <[email protected]> Cc: Aaron Tomlin <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: "Eric W. Biederman" <[email protected]>, Cc: Sterling Alexander <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Roland McGrath <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>