10 Jun, 2020

1 commit

  • Patch series "mm: consolidate definitions of page table accessors", v2.

    The low level page table accessors (pXY_index(), pXY_offset()) are
    duplicated across all architectures and sometimes more than once. For
    instance, we have 31 definition of pgd_offset() for 25 supported
    architectures.

    Most of these definitions are actually identical and typically it boils
    down to, e.g.

    static inline unsigned long pmd_index(unsigned long address)
    {
    return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
    }

    static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
    {
    return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
    }

    These definitions can be shared among 90% of the arches provided
    XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.

    For architectures that really need a custom version there is always
    possibility to override the generic version with the usual ifdefs magic.

    These patches introduce include/linux/pgtable.h that replaces
    include/asm-generic/pgtable.h and add the definitions of the page table
    accessors to the new header.

    This patch (of 12):

    The linux/mm.h header includes to allow inlining of the
    functions involving page table manipulations, e.g. pte_alloc() and
    pmd_alloc(). So, there is no point to explicitly include
    in the files that include .

    The include statements in such cases are remove with a simple loop:

    for f in $(git grep -l "include ") ; do
    sed -i -e '/include / d' $f
    done

    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Brian Cain
    Cc: Catalin Marinas
    Cc: Chris Zankel
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Ungerer
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: Ingo Molnar
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Matthew Wilcox
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Mike Rapoport
    Cc: Nick Hu
    Cc: Paul Walmsley
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vincent Chen
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
    Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

27 Mar, 2020

1 commit

  • request_irq() is preferred over setup_irq(). Invocations of setup_irq()
    occur after memory allocators are ready.

    Per tglx[1], setup_irq() existed in olden days when allocators were not
    ready by the time early interrupts were initialized.

    Hence replace setup_irq() by request_irq().

    [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos

    Link: https://lore.kernel.org/r/20200327124451.4298-1-afzal.mohd.ma@gmail.com
    Signed-off-by: afzal mohammed
    Signed-off-by: Arnd Bergmann

    afzal mohammed
     

14 Aug, 2019

3 commits

  • Various bits of iop32x are now in their traditional locations in plat-iop,
    mach-iop/include/mach/ and in include/asm/mach/hardware. As nothing
    outside of the iop32x mach code references these any more, this can all
    be moved into one place now.

    The only remaining things in the include/mach/ directory are now the
    NR_IRQS definition, the entry-macros.S file and the the decompressor
    uart access. After the irqchip code has been converted to SPARSE_IRQ
    and GENERIC_IRQ_MULTI_HANDLER, it can be moved to ARCH_MULTIPLATFORM.

    Link: https://lore.kernel.org/r/20190809163334.489360-7-arnd@arndb.de
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • All supported uarts use the same address: IQ80321_UART and IQ31244_UART
    are both defined to the default value of 0xfe800000. By using that as
    the address unconditionally, all dependencies on other machine headers
    can be avoided.

    Link: https://lore.kernel.org/r/20190809163334.489360-6-arnd@arndb.de
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • Now that iop3xx and iop13xx are gone, the iop-adma driver no
    longer needs to deal with incompatible register layout defined
    in machine specific header files.

    Move the iop32x specific definitions into drivers/dma/iop-adma.h
    and the platform_data into include/linux/platform_data/dma-iop32x.h,
    and change the machine code to no longer reference those.

    The DMA0_ID/DMA1_ID/AAU_ID macros are required as part of the
    platform data interface and still need to be visible, so move
    those from one header to the other.

    Link: https://lore.kernel.org/r/20190809163334.489360-4-arnd@arndb.de
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

16 Jul, 2019

1 commit

  • Pull i2c updates from Wolfram Sang:
    "New stuff from the I2C world:

    - in the core, getting irqs from ACPI is now similar to OF

    - new driver for MediaTek MT7621/7628/7688 SoCs

    - bcm2835, i801, and tegra drivers got some more attention

    - GPIO API cleanups

    - cleanups in the core headers

    - lots of usual driver updates"

    * 'i2c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (74 commits)
    i2c: mt7621: Fix platform_no_drv_owner.cocci warnings
    i2c: cpm: remove casting dma_alloc
    dt-bindings: i2c: sun6i-p2wi: Fix the binding example
    dt-bindings: i2c: mv64xxx: Fix the example compatible
    i2c: i801: Documentation update
    i2c: i801: Add support for Intel Tiger Lake
    i2c: i801: Fix PCI ID sorting
    dt-bindings: i2c-stm32: document optional dmas
    i2c: i2c-stm32f7: Add I2C_SMBUS_I2C_BLOCK_DATA support
    i2c: core: Tidy up handling of init_irq
    i2c: core: Move ACPI gpio IRQ handling into i2c_acpi_get_irq
    i2c: core: Move ACPI IRQ handling to probe time
    i2c: acpi: Factor out getting the IRQ from ACPI
    i2c: acpi: Use available IRQ helper functions
    i2c: core: Allow whole core to use i2c_dev_irq_from_resources
    eeprom: at24: modify a comment referring to platform data
    dt-bindings: i2c: omap: Add new compatible for J721E SoCs
    dt-bindings: i2c: mv64xxx: Add YAML schemas
    dt-bindings: i2c: sun6i-p2wi: Add YAML schemas
    i2c: mt7621: Add MediaTek MT7621/7628/7688 I2C driver
    ...

    Linus Torvalds
     

19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    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 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 #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

12 Jun, 2019

1 commit

  • The IOP3xx has some elaborate code to directly slam the
    GPIO lines multiplexed with I2C down low before enablement,
    apparently a workaround for a hardware bug found in the
    early chips.

    After consulting the developer documentation for IOP80321
    and IOP80331 I can clearly see that this may be useful for
    IOP80321 family (mach-iop32x) but it is highly dubious for
    any 80331 series or later chip: in these chips the lines
    are not multiplexed for UARTs.

    We convert the code to pass optional GPIO descriptors
    and register these only on the 80321-based boards where
    it makes sense, optionally obtain them in the driver and
    use the gpiod_set_raw_value() to ascertain the line gets
    driven low when needed.

    The GPIO driver does not give the GPIO chip a reasonable
    label so the patch also adds that so that these machine
    descriptor tables can be used.

    Signed-off-by: Linus Walleij
    Acked-by: Arnd Bergmann
    Acked-by: Dan Williams
    Signed-off-by: Wolfram Sang

    Linus Walleij
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

1 commit


30 Jan, 2019

1 commit


22 Nov, 2017

2 commits

  • This converts all remaining cases of the old setup_timer() API into using
    timer_setup(), where the callback argument is the structure already
    holding the struct timer_list. These should have no behavioral changes,
    since they just change which pointer is passed into the callback with
    the same available pointers after conversion. It handles the following
    examples, in addition to some other variations.

    Casting from unsigned long:

    void my_callback(unsigned long data)
    {
    struct something *ptr = (struct something *)data;
    ...
    }
    ...
    setup_timer(&ptr->my_timer, my_callback, ptr);

    and forced object casts:

    void my_callback(struct something *ptr)
    {
    ...
    }
    ...
    setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);

    become:

    void my_callback(struct timer_list *t)
    {
    struct something *ptr = from_timer(ptr, t, my_timer);
    ...
    }
    ...
    timer_setup(&ptr->my_timer, my_callback, 0);

    Direct function assignments:

    void my_callback(unsigned long data)
    {
    struct something *ptr = (struct something *)data;
    ...
    }
    ...
    ptr->my_timer.function = my_callback;

    have a temporary cast added, along with converting the args:

    void my_callback(struct timer_list *t)
    {
    struct something *ptr = from_timer(ptr, t, my_timer);
    ...
    }
    ...
    ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;

    And finally, callbacks without a data assignment:

    void my_callback(unsigned long data)
    {
    ...
    }
    ...
    setup_timer(&ptr->my_timer, my_callback, 0);

    have their argument renamed to verify they're unused during conversion:

    void my_callback(struct timer_list *unused)
    {
    ...
    }
    ...
    timer_setup(&ptr->my_timer, my_callback, 0);

    The conversion is done with the following Coccinelle script:

    spatch --very-quiet --all-includes --include-headers \
    -I ./arch/x86/include -I ./arch/x86/include/generated \
    -I ./include -I ./arch/x86/include/uapi \
    -I ./arch/x86/include/generated/uapi -I ./include/uapi \
    -I ./include/generated/uapi --include ./include/linux/kconfig.h \
    --dir . \
    --cocci-file ~/src/data/timer_setup.cocci

    @fix_address_of@
    expression e;
    @@

    setup_timer(
    -&(e)
    +&e
    , ...)

    // Update any raw setup_timer() usages that have a NULL callback, but
    // would otherwise match change_timer_function_usage, since the latter
    // will update all function assignments done in the face of a NULL
    // function initialization in setup_timer().
    @change_timer_function_usage_NULL@
    expression _E;
    identifier _timer;
    type _cast_data;
    @@

    (
    -setup_timer(&_E->_timer, NULL, _E);
    +timer_setup(&_E->_timer, NULL, 0);
    |
    -setup_timer(&_E->_timer, NULL, (_cast_data)_E);
    +timer_setup(&_E->_timer, NULL, 0);
    |
    -setup_timer(&_E._timer, NULL, &_E);
    +timer_setup(&_E._timer, NULL, 0);
    |
    -setup_timer(&_E._timer, NULL, (_cast_data)&_E);
    +timer_setup(&_E._timer, NULL, 0);
    )

    @change_timer_function_usage@
    expression _E;
    identifier _timer;
    struct timer_list _stl;
    identifier _callback;
    type _cast_func, _cast_data;
    @@

    (
    -setup_timer(&_E->_timer, _callback, _E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, &_callback, _E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, _callback, (_cast_data)_E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, (_cast_func)_callback, _E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E._timer, _callback, (_cast_data)_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, _callback, (_cast_data)&_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, &_callback, (_cast_data)_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
    +timer_setup(&_E._timer, _callback, 0);
    |
    _E->_timer@_stl.function = _callback;
    |
    _E->_timer@_stl.function = &_callback;
    |
    _E->_timer@_stl.function = (_cast_func)_callback;
    |
    _E->_timer@_stl.function = (_cast_func)&_callback;
    |
    _E._timer@_stl.function = _callback;
    |
    _E._timer@_stl.function = &_callback;
    |
    _E._timer@_stl.function = (_cast_func)_callback;
    |
    _E._timer@_stl.function = (_cast_func)&_callback;
    )

    // callback(unsigned long arg)
    @change_callback_handle_cast
    depends on change_timer_function_usage@
    identifier change_timer_function_usage._callback;
    identifier change_timer_function_usage._timer;
    type _origtype;
    identifier _origarg;
    type _handletype;
    identifier _handle;
    @@

    void _callback(
    -_origtype _origarg
    +struct timer_list *t
    )
    {
    (
    ... when != _origarg
    _handletype *_handle =
    -(_handletype *)_origarg;
    +from_timer(_handle, t, _timer);
    ... when != _origarg
    |
    ... when != _origarg
    _handletype *_handle =
    -(void *)_origarg;
    +from_timer(_handle, t, _timer);
    ... when != _origarg
    |
    ... when != _origarg
    _handletype *_handle;
    ... when != _handle
    _handle =
    -(_handletype *)_origarg;
    +from_timer(_handle, t, _timer);
    ... when != _origarg
    |
    ... when != _origarg
    _handletype *_handle;
    ... when != _handle
    _handle =
    -(void *)_origarg;
    +from_timer(_handle, t, _timer);
    ... when != _origarg
    )
    }

    // callback(unsigned long arg) without existing variable
    @change_callback_handle_cast_no_arg
    depends on change_timer_function_usage &&
    !change_callback_handle_cast@
    identifier change_timer_function_usage._callback;
    identifier change_timer_function_usage._timer;
    type _origtype;
    identifier _origarg;
    type _handletype;
    @@

    void _callback(
    -_origtype _origarg
    +struct timer_list *t
    )
    {
    + _handletype *_origarg = from_timer(_origarg, t, _timer);
    +
    ... when != _origarg
    - (_handletype *)_origarg
    + _origarg
    ... when != _origarg
    }

    // Avoid already converted callbacks.
    @match_callback_converted
    depends on change_timer_function_usage &&
    !change_callback_handle_cast &&
    !change_callback_handle_cast_no_arg@
    identifier change_timer_function_usage._callback;
    identifier t;
    @@

    void _callback(struct timer_list *t)
    { ... }

    // callback(struct something *handle)
    @change_callback_handle_arg
    depends on change_timer_function_usage &&
    !match_callback_converted &&
    !change_callback_handle_cast &&
    !change_callback_handle_cast_no_arg@
    identifier change_timer_function_usage._callback;
    identifier change_timer_function_usage._timer;
    type _handletype;
    identifier _handle;
    @@

    void _callback(
    -_handletype *_handle
    +struct timer_list *t
    )
    {
    + _handletype *_handle = from_timer(_handle, t, _timer);
    ...
    }

    // If change_callback_handle_arg ran on an empty function, remove
    // the added handler.
    @unchange_callback_handle_arg
    depends on change_timer_function_usage &&
    change_callback_handle_arg@
    identifier change_timer_function_usage._callback;
    identifier change_timer_function_usage._timer;
    type _handletype;
    identifier _handle;
    identifier t;
    @@

    void _callback(struct timer_list *t)
    {
    - _handletype *_handle = from_timer(_handle, t, _timer);
    }

    // We only want to refactor the setup_timer() data argument if we've found
    // the matching callback. This undoes changes in change_timer_function_usage.
    @unchange_timer_function_usage
    depends on change_timer_function_usage &&
    !change_callback_handle_cast &&
    !change_callback_handle_cast_no_arg &&
    !change_callback_handle_arg@
    expression change_timer_function_usage._E;
    identifier change_timer_function_usage._timer;
    identifier change_timer_function_usage._callback;
    type change_timer_function_usage._cast_data;
    @@

    (
    -timer_setup(&_E->_timer, _callback, 0);
    +setup_timer(&_E->_timer, _callback, (_cast_data)_E);
    |
    -timer_setup(&_E._timer, _callback, 0);
    +setup_timer(&_E._timer, _callback, (_cast_data)&_E);
    )

    // If we fixed a callback from a .function assignment, fix the
    // assignment cast now.
    @change_timer_function_assignment
    depends on change_timer_function_usage &&
    (change_callback_handle_cast ||
    change_callback_handle_cast_no_arg ||
    change_callback_handle_arg)@
    expression change_timer_function_usage._E;
    identifier change_timer_function_usage._timer;
    identifier change_timer_function_usage._callback;
    type _cast_func;
    typedef TIMER_FUNC_TYPE;
    @@

    (
    _E->_timer.function =
    -_callback
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E->_timer.function =
    -&_callback
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E->_timer.function =
    -(_cast_func)_callback;
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E->_timer.function =
    -(_cast_func)&_callback
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E._timer.function =
    -_callback
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E._timer.function =
    -&_callback;
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E._timer.function =
    -(_cast_func)_callback
    +(TIMER_FUNC_TYPE)_callback
    ;
    |
    _E._timer.function =
    -(_cast_func)&_callback
    +(TIMER_FUNC_TYPE)_callback
    ;
    )

    // Sometimes timer functions are called directly. Replace matched args.
    @change_timer_function_calls
    depends on change_timer_function_usage &&
    (change_callback_handle_cast ||
    change_callback_handle_cast_no_arg ||
    change_callback_handle_arg)@
    expression _E;
    identifier change_timer_function_usage._timer;
    identifier change_timer_function_usage._callback;
    type _cast_data;
    @@

    _callback(
    (
    -(_cast_data)_E
    +&_E->_timer
    |
    -(_cast_data)&_E
    +&_E._timer
    |
    -_E
    +&_E->_timer
    )
    )

    // If a timer has been configured without a data argument, it can be
    // converted without regard to the callback argument, since it is unused.
    @match_timer_function_unused_data@
    expression _E;
    identifier _timer;
    identifier _callback;
    @@

    (
    -setup_timer(&_E->_timer, _callback, 0);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, _callback, 0L);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E->_timer, _callback, 0UL);
    +timer_setup(&_E->_timer, _callback, 0);
    |
    -setup_timer(&_E._timer, _callback, 0);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, _callback, 0L);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_E._timer, _callback, 0UL);
    +timer_setup(&_E._timer, _callback, 0);
    |
    -setup_timer(&_timer, _callback, 0);
    +timer_setup(&_timer, _callback, 0);
    |
    -setup_timer(&_timer, _callback, 0L);
    +timer_setup(&_timer, _callback, 0);
    |
    -setup_timer(&_timer, _callback, 0UL);
    +timer_setup(&_timer, _callback, 0);
    |
    -setup_timer(_timer, _callback, 0);
    +timer_setup(_timer, _callback, 0);
    |
    -setup_timer(_timer, _callback, 0L);
    +timer_setup(_timer, _callback, 0);
    |
    -setup_timer(_timer, _callback, 0UL);
    +timer_setup(_timer, _callback, 0);
    )

    @change_callback_unused_data
    depends on match_timer_function_unused_data@
    identifier match_timer_function_unused_data._callback;
    type _origtype;
    identifier _origarg;
    @@

    void _callback(
    -_origtype _origarg
    +struct timer_list *unused
    )
    {
    ... when != _origarg
    }

    Signed-off-by: Kees Cook

    Kees Cook
     
  • This mechanically converts all remaining cases of ancient open-coded timer
    setup with the old setup_timer() API, which is the first step in timer
    conversions. This has no behavioral changes, since it ultimately just
    changes the order of assignment to fields of struct timer_list when
    finding variations of:

    init_timer(&t);
    f.function = timer_callback;
    t.data = timer_callback_arg;

    to be converted into:

    setup_timer(&t, timer_callback, timer_callback_arg);

    The conversion is done with the following Coccinelle script, which
    is an improved version of scripts/cocci/api/setup_timer.cocci, in the
    following ways:
    - assignments-before-init_timer() cases
    - limit the .data case removal to the specific struct timer_list instance
    - handling calls by dereference (timer->field vs timer.field)

    spatch --very-quiet --all-includes --include-headers \
    -I ./arch/x86/include -I ./arch/x86/include/generated \
    -I ./include -I ./arch/x86/include/uapi \
    -I ./arch/x86/include/generated/uapi -I ./include/uapi \
    -I ./include/generated/uapi --include ./include/linux/kconfig.h \
    --dir . \
    --cocci-file ~/src/data/setup_timer.cocci

    @fix_address_of@
    expression e;
    @@

    init_timer(
    -&(e)
    +&e
    , ...)

    // Match the common cases first to avoid Coccinelle parsing loops with
    // "... when" clauses.

    @match_immediate_function_data_after_init_timer@
    expression e, func, da;
    @@

    -init_timer
    +setup_timer
    ( \(&e\|e\)
    +, func, da
    );
    (
    -\(e.function\|e->function\) = func;
    -\(e.data\|e->data\) = da;
    |
    -\(e.data\|e->data\) = da;
    -\(e.function\|e->function\) = func;
    )

    @match_immediate_function_data_before_init_timer@
    expression e, func, da;
    @@

    (
    -\(e.function\|e->function\) = func;
    -\(e.data\|e->data\) = da;
    |
    -\(e.data\|e->data\) = da;
    -\(e.function\|e->function\) = func;
    )
    -init_timer
    +setup_timer
    ( \(&e\|e\)
    +, func, da
    );

    @match_function_and_data_after_init_timer@
    expression e, e2, e3, e4, e5, func, da;
    @@

    -init_timer
    +setup_timer
    ( \(&e\|e\)
    +, func, da
    );
    ... when != func = e2
    when != da = e3
    (
    -e.function = func;
    ... when != da = e4
    -e.data = da;
    |
    -e->function = func;
    ... when != da = e4
    -e->data = da;
    |
    -e.data = da;
    ... when != func = e5
    -e.function = func;
    |
    -e->data = da;
    ... when != func = e5
    -e->function = func;
    )

    @match_function_and_data_before_init_timer@
    expression e, e2, e3, e4, e5, func, da;
    @@
    (
    -e.function = func;
    ... when != da = e4
    -e.data = da;
    |
    -e->function = func;
    ... when != da = e4
    -e->data = da;
    |
    -e.data = da;
    ... when != func = e5
    -e.function = func;
    |
    -e->data = da;
    ... when != func = e5
    -e->function = func;
    )
    ... when != func = e2
    when != da = e3
    -init_timer
    +setup_timer
    ( \(&e\|e\)
    +, func, da
    );

    @r1 exists@
    expression t;
    identifier f;
    position p;
    @@

    f(...) { ... when any
    init_timer@p(\(&t\|t\))
    ... when any
    }

    @r2 exists@
    expression r1.t;
    identifier g != r1.f;
    expression e8;
    @@

    g(...) { ... when any
    \(t.data\|t->data\) = e8
    ... when any
    }

    // It is dangerous to use setup_timer if data field is initialized
    // in another function.
    @script:python depends on r2@
    p << r1.p;
    @@

    cocci.include_match(False)

    @r3@
    expression r1.t, func, e7;
    position r1.p;
    @@

    (
    -init_timer@p(&t);
    +setup_timer(&t, func, 0UL);
    ... when != func = e7
    -t.function = func;
    |
    -t.function = func;
    ... when != func = e7
    -init_timer@p(&t);
    +setup_timer(&t, func, 0UL);
    |
    -init_timer@p(t);
    +setup_timer(t, func, 0UL);
    ... when != func = e7
    -t->function = func;
    |
    -t->function = func;
    ... when != func = e7
    -init_timer@p(t);
    +setup_timer(t, func, 0UL);
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

28 Jul, 2015

1 commit

  • set_irq_flags is ARM specific with custom flags which have genirq
    equivalents. Convert drivers to use the genirq interfaces directly, so we
    can kill off set_irq_flags. The translation of flags is as follows:

    IRQF_VALID -> !IRQ_NOREQUEST
    IRQF_PROBE -> !IRQ_NOPROBE
    IRQF_NOAUTOEN -> IRQ_NOAUTOEN

    For IRQs managed by an irqdomain, the irqdomain core code handles clearing
    and setting IRQ_NOREQUEST already, so there is no need to do this in
    .map() functions and we can simply remove the set_irq_flags calls. Some
    users also modify IRQ_NOPROBE and this has been maintained although it
    is not clear that is really needed. There appears to be a great deal of
    blind copy and paste of this code.

    Signed-off-by: Rob Herring
    Cc: Russell King
    Cc: Sekhar Nori
    Cc: Kevin Hilman
    Cc: Jason Cooper
    Cc: Andrew Lunn
    Cc: Sebastian Hesselbarth
    Cc: Gregory Clement
    Acked-by: Hans Ulli Kroll
    Acked-by: Shawn Guo
    Cc: Sascha Hauer
    Cc: Imre Kaloz
    Acked-by: Krzysztof Halasa
    Cc: Greg Ungerer
    Cc: Roland Stigge
    Cc: Tony Lindgren
    Cc: Daniel Mack
    Cc: Haojian Zhuang
    Cc: Robert Jarzmik
    Cc: Simtec Linux Team
    Cc: Kukjin Kim
    Cc: Krzysztof Kozlowski
    Acked-by: Wan ZongShun
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-omap@vger.kernel.org
    Cc: linux-samsung-soc@vger.kernel.org
    Tested-by: Kevin Hilman
    Signed-off-by: Olof Johansson

    Rob Herring
     

02 Oct, 2014

1 commit

  • Clearing obj-y, obj-m, obj-n, obj- in each Makefile is
    a useless habit.

    They are non-exported variables; therefore they are always empty
    whenever descending into each subdirectory.
    (Moreorver, obj-y and obj-m are also set to empty at the beginning
    of scripts/Makefile.build)

    Signed-off-by: Masahiro Yamada
    Acked-by: Nicolas Ferre
    Acked-by: Peter Foley
    Acked-by: Linus Walleij
    Signed-off-by: Michal Marek

    Masahiro Yamada
     

19 Feb, 2014

1 commit

  • This cleanup series gets rid of for platforms not using
    ARCH_MULTIPLATFORM. (For multi-platform code it's already unused since
    387798b (ARM: initial multiplatform support).)

    To make this work some code out of arch/arm needed to be adapted. The
    respective changes got acks by their maintainers to be taken via armsoc
    (with Andrew Morton substituting for Alessandro Zummo as rtc maintainer).

    Compared to the previous pull request there was another patch added that
    fixes a (non-critical) regression on ixp4xx. Olof Johansson asked to not
    squash this fix into the original commit to save him from the need to
    reverify the series.

    * tag 'dropmachtimexh-v2' of git://git.pengutronix.de/git/ukl/linux:
    ARM: ixp4xx: fix timer latch calculation
    ARM: drop for !ARCH_MULTIPLATFORM, too
    ARM: rpc: stop using
    ARM: ixp4xx: stop using
    input: ixp4xx-beeper: don't use symbols from
    ARM: at91: don't use
    ARM: ep93xx: stop using mach/timex.h
    ARM: mmp: stop using mach/timex.h
    ARM: netx: stop using mach/timex.h
    ARM: sa1100: stop using mach/timex.h
    clocksource: sirf/marco+prima2: drop usage of CLOCK_TICK_RATE
    rtc: pxa: drop unused #define TIMER_FREQ
    rtc: at91sam9: include explicitly
    ARM/serial: at91: switch atmel serial to use gpiolib

    Signed-off-by: Olof Johansson

    Olof Johansson
     

01 Feb, 2014

1 commit

  • This board was missed when converting all the others to proper
    abstracted GPIO handling. Fix it up the right way by requesting
    and driving GPIO line 0 high through gpiolib to power off the
    machine.

    Cc: Arnaud Patard
    Reported-by: Arnd Bergmann
    Signed-off-by: Linus Walleij
    Acked-by: Arnd Bergmann
    Signed-off-by: Kevin Hilman
    Signed-off-by: Olof Johansson

    Linus Walleij
     

21 Dec, 2013

1 commit

  • While isn't used for multi-platform builds since long it
    still is for "normal" builds. As the previous patches fix all sites to
    not make use of this per-platform file, it can go now for good also for
    platforms that are not (yet) converted to multi-platform.

    While at it there are no users of CLOCK_TICK_RATE any more, so also drop
    the dummy #define.

    Signed-off-by: Uwe Kleine-König

    Uwe Kleine-König
     

21 Sep, 2013

4 commits

  • This alters the IOP platforms to pass a physical base for their
    GPIO blocks and alters the driver to remap it when probing
    instead of relying on the virtual addresses to be used.

    Cc: Lennert Buytenhek
    Cc: Dan Williams
    Cc: Mikael Pettersson
    Tested-by: Aaro Koskinen
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • This converts the IOP32x and IOP33x platforms to pass their
    base address offset by a resource attached to a platform device
    instead of using static offset macros implicitly passed
    through including . Delete the
    local and headers
    and remove the selection of NEED_MACH_GPIO_H.

    Pass the virtual address as a resource in the platform device
    at this point for bisectability, next patch will pass the
    physical address as is custom.

    Cc: Lennert Buytenhek
    Cc: Dan Williams
    Cc: Mikael Pettersson
    Tested-by: Aaro Koskinen
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • Refrain from using the custom gpio_line_get() to read the power
    key on the N2100, use the gpiolib function gpio_get() instead.
    Also request the line in the GPIOs initicall, and move the poll
    timer setup to that inicall so the gpio chip is available before
    we request this GPIO and start to poll it.

    Cc: Lennert Buytenhek
    Cc: Dan Williams
    Cc: Mikael Pettersson
    Tested-by: Aaro Koskinen
    Signed-off-by: Linus Walleij

    Linus Walleij
     
  • As the IOP GPIO driver supports gpiolib we can use the standard
    GPIO calls to issue a reset of the machine instead of using the
    custom gpio_line_set/config calls. Also request the GPIO when
    initializing the machine.

    Cc: Lennert Buytenhek
    Cc: Dan Williams
    Cc: Mikael Pettersson
    Tested-by: Aaro Koskinen
    Signed-off-by: Linus Walleij

    Linus Walleij
     

26 Aug, 2013

3 commits


10 Jul, 2013

1 commit

  • Preparing to move the parsing of reboot= to generic kernel code forces
    the change in reboot_mode handling to use the enum.

    [akpm@linux-foundation.org: fix arch/arm/mach-socfpga/socfpga.c]
    Signed-off-by: Robin Holt
    Cc: Russell King
    Cc: Russ Anderson
    Cc: Robin Holt
    Cc: H. Peter Anvin
    Cc: Guan Xuetao
    Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robin Holt
     

06 Feb, 2013

1 commit

  • …-2.6 into next/cleanup

    From Shawn Guo:
    The series cleans up ARCH_HAS_DECOMP_WDOG and arch_decomp_wdog which
    are unused on ARM architecure. Samsung has some code setting up wdog
    in arch_decomp_wdog(). But since CONFIG_S3C_BOOT_WATCHDOG is defined
    nowhere, it will not run. Otherwise, system can not boot at all when
    wdog is set up but no one pats it.

    * tag 'cleanup-decompwdog-3.9' of git://git.linaro.org/people/shawnguo/linux-2.6:
    ARM: samsung: remove unused arch_decomp_wdog() code
    ARM: remove unused arch_decomp_wdog()
    ARM: decompress: remove unused ARCH_HAS_DECOMP_WDOG

    Signed-off-by: Olof Johansson <olof@lixom.net>

    Olof Johansson
     

11 Jan, 2013

1 commit

  • With ARCH_HAS_DECOMP_WDOG removed from arch/arm/boot/compressed/decompress.c,
    all the arch_decomp_wdog() definition at platform level is unneeded.
    Remmove it.

    Signed-off-by: Shawn Guo
    Acked-by: Nicolas Pitre
    Acked-by: Jason Cooper

    Shawn Guo
     

25 Dec, 2012

1 commit

  • Now that the only field in struct sys_timer is .init, delete the struct,
    and replace the machine descriptor .timer field with the initialization
    function itself.

    This will enable moving timer drivers into drivers/clocksource without
    having to place a public prototype of each struct sys_timer object into
    include/linux; the intent is to create a single of_clocksource_init()
    function that determines which timer driver to initialize by scanning
    the device dtree, much like the proposed irqchip_init() at:
    http://www.spinics.net/lists/arm-kernel/msg203686.html

    Includes mach-omap2 fixes from Igor Grinberg.

    Tested-by: Robert Jarzmik
    Signed-off-by: Stephen Warren

    Stephen Warren
     

23 Sep, 2012

1 commit

  • __iomem annotation cleanup branch from Arnd.

    * cleanup/__iomem: (21 commits)
    net: seeq: use __iomem pointers for MMIO
    video: da8xx-fb: use __iomem pointers for MMIO
    scsi: eesox: use __iomem pointers for MMIO
    serial: ks8695: use __iomem pointers for MMIO
    input: rpcmouse: use __iomem pointers for MMIO
    ARM: samsung: use __iomem pointers for MMIO
    ARM: spear13xx: use __iomem pointers for MMIO
    ARM: sa1100: use __iomem pointers for MMIO
    ARM: prima2: use __iomem pointers for MMIO
    ARM: nomadik: use __iomem pointers for MMIO
    ARM: msm: use __iomem pointers for MMIO
    ARM: lpc32xx: use __iomem pointers for MMIO
    ARM: ks8695: use __iomem pointers for MMIO
    ARM: ixp4xx: use __iomem pointers for MMIO
    ARM: iop32x: use __iomem pointers for MMIO
    ARM: iop13xx: use __iomem pointers for MMIO
    ARM: integrator: use __iomem pointers for MMIO
    ARM: imx: use __iomem pointers for MMIO
    ARM: ebsa110: use __iomem pointers for MMIO
    ARM: at91: use __iomem pointers for MMIO
    ...

    Signed-off-by: Olof Johansson

    Olof Johansson
     

19 Sep, 2012

1 commit


26 Jul, 2012

1 commit

  • Move iop33x and iop32x PCI to fixed i/o mapping and remove io.h. This
    changes the PCI bus addresses from the cpu address to 0 based. It appears
    that there is translation h/w for this, but its untested.

    Not sure what to do with io_offset. I think it should always be 0.
    AFAICT, PCI setup is skipped if the ATU is already setup.

    Signed-off-by: Rob Herring
    Reviewed-by: Arnd Bergmann

    Rob Herring
     

14 May, 2012

2 commits

  • Most PCI implementations perform simple root bus scanning. Rather than
    having each group of platforms provide a duplicated bus scan function,
    provide the PCI configuration ops structure via the hw_pci structure,
    and call the root bus scanning function from core ARM PCI code.

    Acked-by: Krzysztof Hałasa
    Signed-off-by: Russell King

    Russell King
     
  • Most PCI implementations use the standard PCI swizzle function, which
    handles the well defined behaviour of PCI-to-PCI bridges which can be
    found on cards (eg, four port ethernet cards.)

    Rather than having almost every platform specify the standard swizzle
    function, make this the default when no swizzle function is supplied.
    Therefore, a swizzle function only needs to be provided when there is
    something exceptional which needs to be handled.

    This gets rid of the swizzle initializer from 47 files, and leaves us
    with just two platforms specifying a swizzle function: ARM Integrator
    and Chalice CATS.

    Acked-by: Krzysztof Hałasa
    Signed-off-by: Russell King

    Russell King
     

07 Mar, 2012

1 commit

  • __mem_pci is only used to enable readl/writel and friends. Just condition
    this on readl being defined and remove all the __mem_pci defines.

    Signed-off-by: Rob Herring
    Cc: Russell King
    Cc: Lennert Buytenhek
    Cc: Imre Kaloz
    Cc: Krzysztof Halasa
    Cc: Nicolas Pitre
    Cc: Ben Dooks
    Cc: Kukjin Kim
    Cc: Colin Cross
    Cc: Olof Johansson
    Cc: Stephen Warren

    Rob Herring
     

23 Feb, 2012

1 commit


22 Feb, 2012

1 commit

  • Now that most platforms don't need disable_fiq and arch_ret_to_user
    macros, we can remove the empty macros or empty entry-macro.S files.

    Signed-off-by: Rob Herring
    Acked-by: Jamie Iles
    Acked-by: Nicolas Pitre
    Acked-by: Tony Lindgren
    Acked-by: Linus Walleij
    Acked-by: Ryan Mallon
    Acked-by: Nicolas Ferre
    Acked-by: H Hartley Sweeten
    Acked-by: Shawn Guo

    Rob Herring
     

21 Jan, 2012

1 commit

  • When this is the only content remaining in mach/system.h then the
    whole file is removed.

    Signed-off-by: Nicolas Pitre
    Acked-by: H Hartley Sweeten
    Acked-and-tested-by: Jamie Iles
    Acked-by: Tony Lindgren
    Acked-by: David Brown
    Acked-by: Stephen Warren
    Acked-by: Linus Walleij

    Nicolas Pitre
     

05 Jan, 2012

1 commit