01 Jun, 2012

15 commits

  • The init/mount.o source files produce a number of sparse warnings of the
    type:

    warning: incorrect type in argument 1 (different address spaces)
    expected char [noderef] *dev_name
    got char *name

    This is due to the syscalls expecting some of the arguments to be user
    pointers but they are being passed as kernel pointers. This is harmless
    but adds a lot of noise to a sparse build.

    To limit the noise just disable the sparse checking in the relevant source
    files, but still display a warning so that the user knows this has been
    done.

    Since the sparse checking has been disabled we can also remove the __user
    __force casts that are scattered thru the source.

    Signed-off-by: H Hartley Sweeten
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    H Hartley Sweeten
     
  • Suggest the shorter pr_ instead of printk(KERN_.

    Prefer to use pr_ over bare printks.
    Prefer to use pr_warn over pr_warning.

    Signed-off-by: Joe Perches
    Cc: Andy Whitcroft
    Cc: Theodore Ts'o
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Requires --strict option during invocation:
    ~/linux$ scripts/checkpatch --strict foo.patch

    This tests for a bad habits of mine like this:

    return 0 ;

    Note that it does allow a special case of a bare semicolon
    for empty loops:

    while (foo())
    ;

    Signed-off-by: Eric Nelson
    Cc: Andy Whitcroft
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Nelson
     
  • Previous code was using optimizations which were developed to work well
    even on narrow-word CPUs (by today's standards). But Linux runs only on
    32-bit and wider CPUs. We can use that.

    First: using 32x32->64 multiply and trivial 32-bit shift, we can correctly
    divide by 10 much larger numbers, and thus we can print groups of 9 digits
    instead of groups of 5 digits.

    Next: there are two algorithms to print larger numbers. One is generic:
    divide by 1000000000 and repeatedly print groups of (up to) 9 digits.
    It's conceptually simple, but requires an (unsigned long long) /
    1000000000 division.

    Second algorithm splits 64-bit unsigned long long into 16-bit chunks,
    manipulates them cleverly and generates groups of 4 decimal digits. It so
    happens that it does NOT require long long division.

    If long is > 32 bits, division of 64-bit values is relatively easy, and we
    will use the first algorithm. If long long is > 64 bits (strange
    architecture with VERY large long long), second algorithm can't be used,
    and we again use the first one.

    Else (if long is 32 bits and long long is 64 bits) we use second one.

    And third: there is a simple optimization which takes fast path not only
    for zero as was done before, but for all one-digit numbers.

    In all tested cases new code is faster than old one, in many cases by 30%,
    in few cases by more than 50% (for example, on x86-32, conversion of
    12345678). Code growth is ~0 in 32-bit case and ~130 bytes in 64-bit
    case.

    This patch is based upon an original from Michal Nazarewicz.

    [akpm@linux-foundation.org: checkpatch fixes]
    Signed-off-by: Michal Nazarewicz
    Signed-off-by: Denys Vlasenko
    Cc: Douglas W Jones
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Denys Vlasenko
     
  • The '%p' output of the kernel's vsprintf() uses spec.field_width to
    determine how many digits to output based on 2 * sizeof(void*) so that all
    digits of a pointer are shown. ie. a pointer will be output as
    "001A2B3C" instead of "1A2B3C". However, if the '#' flag is used in the
    format (%#p), then the code doesn't take into account the width of the
    '0x' prefix and will end up outputing "0x1A2B3C" instead of "0x001A2B3C".

    This patch reworks the "pointer()" format hook to include 2 characters for
    the '0x' prefix if the '#' flag is included.

    [akpm@linux-foundation.org: checkpatch fixes]
    Signed-off-by: Grant Likely
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Grant Likely
     
  • Signed-off-by: Nicolas Pitre
    Acked-by: Colin Cross
    Acked-by: Santosh Shilimkar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicolas Pitre
     
  • Use the module-wide pr_fmt() mechanism rather than open-coding "genirq: "
    everywhere.

    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • sethostname() and setdomainname() notify userspace on failure (without
    modifying uts_kern_table). Change things so that we only notify userspace
    on success, when uts_kern_table was actually modified.

    Signed-off-by: Sasikantha babu
    Cc: Paul Gortmaker
    Cc: Greg Kroah-Hartman
    Cc: WANG Cong
    Reviewed-by: Cyrill Gorcunov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sasikantha babu
     
  • Signed-off-by: Gustavo Padovan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Gustavo Padovan
     
  • This driver uses PCI_CLASS_REVISION instead of PCI_REVISION_ID, so it
    wasn't converted by 44c10138fd4bbc ("PCI: Change all drivers to use
    pci_device->revision").

    In one case, it even reads PCI revision ID without using it -- that code
    is now removed...

    Signed-off-by: Sergei Shtylyov
    Acked-by: "Nandigama, Nagalakshmi"
    Cc: Eric Moore
    Acked-by: Auke Kok
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergei Shtylyov
     
  • In the comment of allocate_resource(), the explanation of parameter max
    and min is not correct.

    Actually, these two parameters are used to specify the range of the
    resource that will be allocated, not the min/max size that will be
    allocated.

    Signed-off-by: Wei Yang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wei Yang
     
  • ULONG_MAX is often used to check for integer overflow when calculating
    allocation size. While ULONG_MAX happens to work on most systems, there
    is no guarantee that `size_t' must be the same size as `long'.

    This patch introduces SIZE_MAX, the maximum value of `size_t', to improve
    portability and readability for allocation size validation.

    Signed-off-by: Xi Wang
    Acked-by: Alex Elder
    Cc: David Airlie
    Cc: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xi Wang
     
  • Add the new kmalloc_array() to the list of general-purpose memory
    allocators in chapter 14.

    Signed-off-by: Xi Wang
    Acked-by: Jesper Juhl
    Acked-by: Pekka Enberg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xi Wang
     
  • Commit d065bd810b6d ("mm: retry page fault when blocking on disk
    transfer") and commit 37b23e0525d3 ("x86,mm: make pagefault killable")
    introduced changes into the x86 pagefault handler for making the page
    fault handler retryable as well as killable.

    These changes reduce the mmap_sem hold time, which is crucial during OOM
    killer invocation.

    Port these changes to um.

    Signed-off-by: Kautuk Consul
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kautuk Consul
     
  • This allocation may be large. The code is probing to see if it will
    succeed and if not, it falls back to vmalloc(). We should suppress any
    page-allocation failure messages when the fallback happens.

    Reported-by: Dave Jones
    Acked-by: David Howells
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

30 May, 2012

25 commits

  • rtc-s3c.c:673:32: warning: `s3c_rtc_drv_data_array' defined but not used [-Wunused-variable]

    Signed-off-by: Sachin Kamat
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sachin Kamat
     
  • Use the devres managed resource functions in the probe routine. Also
    affects the remove routine where the previously used free and release
    functions are not needed.

    The devm_* functions eliminate the need for manual resource releasing and
    simplify error handling. Resources allocated by devm_* are freed
    automatically on driver detach.

    Signed-off-by: Hannu Heikkinen
    Acked-by: Stephen Warren
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hannu Heikkinen
     
  • Remove RTT interrupt handling, since PIE mode interrupts are now better
    emulated in generic code via an hrtimer we have no need for this, and
    there is no codepath in the driver that enables these periodic interrupts
    anyway.

    Signed-off-by: Rajkumar Kasirajan
    Signed-off-by: Linus Walleij
    Cc: Mattias Wallin
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rajkumar Kasirajan
     
  • Adds device tree support for rtc-lpc32xx.c

    Signed-off-by: Roland Stigge
    Acked-by: Rob Herring
    Acked-by: Arnd Bergmann
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roland Stigge
     
  • If the rtc reports the time might be invalid due to oscillator failure,
    M41T93_FLAG_OF flag must not be reset by get_time() as the read operation
    doesn't make the time valid.

    Without this patch, only the first get_time() reported an invalid time,
    the second get_time() reported a valid time althought the reported time is
    probably wrong due to oscillator failure.

    Instead of resetting in get_time(), with this patch M41T93_FLAG_OF is
    reset in set_time() when a valid time is to be written.

    Signed-off-by: Nikolaus Voss
    Cc: Alessandro Zummo
    Cc: Grant Likely
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nikolaus Voss
     
  • Some DS13XX devices have "trickle chargers". Its configuration register
    is at different locations, the setup is the same, though. Since the
    configuration is board specific, introduce a platform_data to this driver.
    Tested with a DS1339 on a custom board.

    Signed-off-by: Wolfram Sang
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wolfram Sang
     
  • ds1307 was kzalloced, so no need to zero members of the struct.

    Signed-off-by: Wolfram Sang
    Acked-by: Joakim Tjernlund
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wolfram Sang
     
  • In order to keep consistency with other rtc drivers,rename CONFIG_RTC_MXC
    to CONFIG_RTC_DRV_MXC.

    Signed-off-by: Fabio Estevam
    Acked-by: Wolfram Sang
    Cc: Alessandro Zummo
    [akpm@linux-foundation.org: fix missed arch/arm/configs/imx_v6_v7_defconfig]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabio Estevam
     
  • RTC_DRV_IMXDI and RTC_MXC are on-chip RTC modules, so move them under
    "on-CPU RTC drivers" selection menu.

    While at it change the dependency of RTC_DRV_IMXDI from ARCH_MX25 to
    SOC_IMX25.

    Signed-off-by: Fabio Estevam
    Acked-by: Wolfram Sang
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabio Estevam
     
  • Changes are based on arch/cris/arch-v10/drivers/pcf8563.c

    [akpm@linux-foundation.org: fix sparse warning]
    Signed-off-by: Alexander Stein
    Cc: Alessandro Zummo
    Cc: Mikael Starvik
    Acked-by: Jesper Nilsson
    Cc: Wu Fengguang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Stein
     
  • Currently there is no generic way to get the RTC battery status within an
    application. So add an ioctl to read the status bit. The idea is that
    the bit is set once a low voltage is detected. It stays there until it is
    reset using the RTC_VL_CLR ioctl.

    Signed-off-by: Alexander Stein
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Stein
     
  • Use module_platform_driver() to remove the boilerplate code.

    Also, change the probe and remove functions to __devinit/__devexit.

    Signed-off-by: H Hartley Sweeten
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    H Hartley Sweeten
     
  • SPEAr platforms now support DT and so must convert all drivers support DT.
    This patch adds DT probing support for rtc and updates its documentation
    too.

    Signed-off-by: Viresh Kumar
    Cc: Stefan Roese
    Cc: Arnd Bergmann
    Cc: Alessandro Zummo
    Cc: Rajeev Kumar
    Cc: Rob Herring
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Viresh Kumar
     
  • number()'s behaviour is slighly changed: 0 becomes "0" instead of "00"
    when using the flag SPECIAL and base 8.

    Before:
    Number\Format %o %#o %x %#x
    0 0 00 0 0x0
    1 1 01 1 0x1
    16 20 020 10 0x10

    After:
    Number\Format %o %#o %x %#x
    0 0 0 0 0x0
    1 1 01 1 0x1
    16 20 020 10 0x10

    Signed-off-by: Pierre Carrier
    Acked-by: Stephen Rothwell
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pierre Carrier
     
  • We are not preallocating a sufficient number of nodes.

    Signed-off-by: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     
  • When a spinlock warning is printed we usually get

    BUG: spinlock bad magic on CPU#0, modprobe/111
    lock: 0xdff09f38, .magic: 00000000, .owner: /0, .owner_cpu: 0

    but it's nicer to print the symbol for the lock if we have it so that we
    can avoid 'grep dff09f38 /proc/kallsyms' to find out which lock it was.
    Use kallsyms to print the symbol name so we get something a bit easier to
    read

    BUG: spinlock bad magic on CPU#0, modprobe/112
    lock: test_lock, .magic: 00000000, .owner: /-1, .owner_cpu: 0

    If the lock is not in kallsyms %ps will fall back to printing the address
    directly.

    Signed-off-by: Stephen Boyd
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • Using %ps in a printk format will sometimes fail silently and print the
    empty string if the address passed in does not match a symbol that
    kallsyms knows about. But using %pS will fall back to printing the full
    address if kallsyms can't find the symbol. Make %ps act the same as %pS
    by falling back to printing the address.

    While we're here also make %ps print the module that a symbol comes from
    so that it matches what %pS already does. Take this simple function for
    example (in a module):

    static void test_printk(void)
    {
    int test;
    pr_info("with pS: %pS\n", &test);
    pr_info("with ps: %ps\n", &test);
    }

    Before this patch:

    with pS: 0xdff7df44
    with ps:

    After this patch:

    with pS: 0xdff7df44
    with ps: 0xdff7df44

    Signed-off-by: Stephen Boyd
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • The code comments for bscnl_emit() and bitmap_scnlistprintf() are
    describing snprintf() return semantics, but these functions use
    scnprintf() return semantics. Fix that, and document the
    bitmap_scnprintf() return value as well.

    Cc: Ryota Ozaki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • Moving these arrays into static storage shrinks the kernel a bit:

    text data bss dec hex filename
    723 112 64 899 383 lib/string_helpers.o
    516 272 64 852 354 lib/string_helpers.o

    Cc: James Bottomley
    Cc: "Aneesh Kumar K.V"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     
  • As long as there is no other non-const variable marked __initdata in the
    same compilation unit it doesn't hurt. If there were one however
    compilation would fail with

    error: $variablename causes a section type conflict

    because a section containing const variables is marked read only and so
    cannot contain non-const variables.

    Signed-off-by: Uwe Kleine-König
    Cc: Alexey Dobriyan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     
  • We were bitten by this at one point and added an additional sanity test
    for DEBUG_LIST. You can't validly add a list_head to a list where either
    prev or next is the same as the thing you're adding.

    Signed-off-by: Chris Metcalf
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chris Metcalf
     
  • Add sub-driver for the LEDs on National Semiconductor / TI LM3533 lighting
    power chips.

    The chip provides 256 brightness levels, hardware accelerated blinking as
    well as ambient-light-sensor and pwm input control.

    Signed-off-by: Johan Hovold
    Cc: Richard Purdie
    Cc: Rob Landley
    Cc: Samuel Ortiz
    Cc: Jonathan Cameron
    Cc: Greg Kroah-Hartman
    Cc: Florian Tobias Schandinat
    Cc: Arnd Bergmann
    Cc: Mark Brown
    Cc: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johan Hovold
     
  • When issuing the following command:

    for I in 0 1 2 3 4 5 6 7; do
    echo 0 > /sys/class/leds/pca955x\:${I}/brightness;
    done

    It is possible that all the pca955x_read_ls calls are done sequentially
    before any pca955x_write_ls call is done. This updates the LS only to
    the last LED update in its set.

    Fix this by using a global lock for the pca995x device during
    pca955x_led_work. Also used a struct for shared data betreen all LEDs.

    [akpm@linux-foundation.org: revert unintentional rename of pca955x_ledsel()]
    Signed-off-by: Alexander Stein
    Cc: Richard Purdie
    Cc: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Stein
     
  • The leds timer trigger does not currently have an interface to activate a
    one shot timer. The current support allows for setting two timers, one
    for specifying how long a state to be on, and the second for how long the
    state to be off. The delay_on value specifies the time period an LED
    should stay in on state, followed by a delay_off value that specifies how
    long the LED should stay in off state. The on and off cycle repeats until
    the trigger gets deactivated. There is no provision for one time
    activation to implement features that require an on or off state to be
    held just once and then stay in the original state forever.

    Without one shot timer interface, user space can still use timer trigger
    to set a timer to hold a state, however when user space application
    crashes or goes away without deactivating the timer, the hardware will be
    left in that state permanently.

    As a specific example of this use-case, let's look at vibrate feature on
    phones. Vibrate function on phones is implemented using PWM pins on SoC
    or PMIC. There is a need to activate one shot timer to control the
    vibrate feature, to prevent user space crashes leaving the phone in
    vibrate mode permanently causing the battery to drain.

    This trigger exports three properties, activate, state, and duration When
    transient trigger is activated these properties are set to default values.

    - duration allows setting timer value in msecs. The initial value is 0.
    - activate allows activating and deactivating the timer specified by
    duration as needed. The initial and default value is 0. This will allow
    duration to be set after trigger activation.
    - state allows user to specify a transient state to be held for the specified
    duration.

    Signed-off-by: Shuah Khan
    Cc: Jonas Bonn
    Cc: Richard Purdie
    Cc: NeilBrown
    Cc: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shuah Khan
     
  • A halted kernel should not show a heartbeat.

    [akpm@linux-foundation.org: checkpatch fixes]
    Signed-off-by: Alexander Holler
    Cc: Shuah Khan
    Cc: Richard Purdie
    Cc: Bryan Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexander Holler