09 Jun, 2019

1 commit

  • Pull MIPS fixes from Paul Burton:

    - Declare ginvt() __always_inline due to its use of an argument as an
    inline asm immediate.

    - A VDSO build fix following Kbuild changes made this cycle.

    - A fix for boot failures on txx9 systems following memory
    initialization changes made this cycle.

    - Bounds check virt_addr_valid() to prevent it spuriously indicating
    that bogus addresses are valid, in turn fixing hardened usercopy
    failures that have been present since v4.12.

    - Build uImage.gz for pistachio systems by default, since this is the
    image we need in order to actually boot on a board.

    - Remove an unused variable in our uprobes code.

    * tag 'mips_fixes_5.2_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
    MIPS: uprobes: remove set but not used variable 'epc'
    MIPS: pistachio: Build uImage.gz by default
    MIPS: Make virt_addr_valid() return bool
    MIPS: Bounds check virt_addr_valid
    MIPS: TXx9: Fix boot crash in free_initmem()
    MIPS: remove a space after -I to cope with header search paths for VDSO
    MIPS: mark ginvt() as __always_inline

    Linus Torvalds
     

23 May, 2019

1 commit

  • On rbtx4927:

    BUG: Bad page state in process swapper pfn:00001
    page:804b7820 refcount:0 mapcount:-128 mapping:00000000 index:0x1
    flags: 0x0()
    raw: 00000000 00000100 00000200 00000000 00000001 00000000 ffffff7f 00000000
    page dumped because: nonzero mapcount
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 5.2.0-rc1-rbtx4927-00468-g3c05ea3d4077b756 #141
    Stack : 00000000 10008400 8040dc4c 87c1b974 8044af63 8040dc4c 00000001 804a3490
    00000001 81000000 0030f231 80148558 00000003 10008400 87c1dd80 3d0f9a2c
    00000000 00000000 804b0000 00000000 00000007 00000000 00000081 00000000
    62722d31 00000080 804b0000 39347874 00000000 804b7820 8040ce18 81000010
    00000001 00000007 00000001 81000000 00000018 8021de24 00000000 804a0000
    ...
    Call Trace:
    [] show_stack+0x74/0x104
    [] bad_page+0x130/0x138
    [] free_pcppages_bulk+0x17c/0x3b0
    [] free_unref_page+0x40/0x68
    [] free_init_pages+0xec/0x104
    [] free_initmem+0x10/0x58
    [] kernel_init+0x20/0x100
    [] ret_from_kernel_thread+0x14/0x1c

    As of commit b93ddc4f9156205e ("mips: Reserve memory for the kernel
    image resources"), bootmem_init() no longer reserves the memory below
    the kernel, while prom_free_prom_memory() still frees it.

    Fix this by reverting commit b6263ff2d6e58cc2 ("MIPS: TXx9: Implement
    prom_free_prom_memory").

    Suggested-by: Serge Semin
    Fixes: b93ddc4f9156205e ("mips: Reserve memory for the kernel image resources")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Atsushi Nemoto
    Signed-off-by: Paul Burton
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: Mike Rapoport
    Cc: Maciej W . Rozycki
    Cc: linux-mips@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org

    Geert Uytterhoeven
     

21 May, 2019

1 commit


16 May, 2019

1 commit

  • Now that we've gotten rid of clk_readl() we can remove io.h from the
    clk-provider header and push out the io.h include to any code that isn't
    already including the io.h header but using things like readl/writel,
    etc.

    Found with this grep:

    git grep -l clk-provider.h | grep '.c$' | xargs git grep -L 'linux/io.h' | \
    xargs git grep -l \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\' --or \
    -e '\'

    I also reordered a couple includes when they weren't alphabetical and
    removed clk.h from kona, replacing it with clk-provider.h because
    that driver doesn't use clk consumer APIs.

    Acked-by: Geert Uytterhoeven
    Cc: Chen-Yu Tsai
    Acked-by: Maxime Ripard
    Acked-by: Tero Kristo
    Acked-by: Sekhar Nori
    Cc: Krzysztof Kozlowski
    Acked-by: Mark Brown
    Cc: Chris Zankel
    Acked-by: Max Filippov
    Acked-by: John Crispin
    Acked-by: Heiko Stuebner
    Signed-off-by: Stephen Boyd

    Stephen Boyd
     

23 Nov, 2018

1 commit

  • There is no good reason to duplicate the PCI menu in every architecture.
    Instead provide a selectable HAVE_PCI symbol that indicates availability
    of PCI support, and a FORCE_PCI symbol to for PCI on and the handle the
    rest in drivers/pci.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Palmer Dabbelt
    Acked-by: Max Filippov
    Acked-by: Thomas Gleixner
    Acked-by: Bjorn Helgaas
    Acked-by: Geert Uytterhoeven
    Acked-by: Paul Burton
    Signed-off-by: Masahiro Yamada

    Christoph Hellwig
     

31 Oct, 2018

1 commit

  • Move remaining definitions and declarations from include/linux/bootmem.h
    into include/linux/memblock.h and remove the redundant header.

    The includes were replaced with the semantic patch below and then
    semi-automated removal of duplicated '#include

    @@
    @@
    - #include
    + #include

    [sfr@canb.auug.org.au: dma-direct: fix up for the removal of linux/bootmem.h]
    Link: http://lkml.kernel.org/r/20181002185342.133d1680@canb.auug.org.au
    [sfr@canb.auug.org.au: powerpc: fix up for removal of linux/bootmem.h]
    Link: http://lkml.kernel.org/r/20181005161406.73ef8727@canb.auug.org.au
    [sfr@canb.auug.org.au: x86/kaslr, ACPI/NUMA: fix for linux/bootmem.h removal]
    Link: http://lkml.kernel.org/r/20181008190341.5e396491@canb.auug.org.au
    Link: http://lkml.kernel.org/r/1536927045-23536-30-git-send-email-rppt@linux.vnet.ibm.com
    Signed-off-by: Mike Rapoport
    Signed-off-by: Stephen Rothwell
    Acked-by: Michal Hocko
    Cc: Catalin Marinas
    Cc: Chris Zankel
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Ingo Molnar
    Cc: "James E.J. Bottomley"
    Cc: Jonas Bonn
    Cc: Jonathan Corbet
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Martin Schwidefsky
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Palmer Dabbelt
    Cc: Paul Burton
    Cc: Richard Kuo
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Serge Semin
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

07 Sep, 2018

1 commit

  • if device_register return error, iounmap should be called, also iounmap
    need to call before put_device.

    Signed-off-by: Ding Xiang
    Reviewed-by: Atsushi Nemoto
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/20476/
    Cc: ralf@linux-mips.org
    Cc: jhogan@kernel.org
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org

    Ding Xiang
     

15 Aug, 2018

1 commit

  • Pull mtd updates from Boris Brezillon:
    "JFFS2 changes:
    - Support 64-bit timestamps

    MTD core changes:
    - Support sub-partitions
    - Clarify mtd_oob_ops documentation
    - Make Kconfig formatting consistent
    - Fix potential overflows in mtdchar_{write,read}()
    - Fallback to ->_{read,write}() when ->_{read,write}_oob() is missing
    and no OOB data were requested
    - Remove VLA usage in the bch lib

    MTD driver changes:
    - Use mtd_device_register() instead of mtd_device_parse_register()
    where applicable
    - Use proper printk format to print physical addresses in the
    solutionengine driver
    - Add missing mtd_set_of_node() call in the powernv driver
    - Remove unneeded variables in a few drivers
    - Plug the TRX part parser to the DT partition parsers logic
    - Check ioremap_cache() return code in the gpio-addr-flash driver
    - Stop using VMLINUX_SYMBOL_STR() in gen_probe.c

    SPI NOR core changes:
    - Apply reset hacks only when reset is explicitly marked as broken in
    the DT

    SPI NOR driver changes:
    - Minor cleanup/fixes in the m25p80 driver
    - Release flash_np in the nxp-spifi driver
    - Add suspend/resume hooks to the atmel-quadspi driver
    - Include gpio/consumer.h instead of gpio.h in the atmel-quadspi
    driver
    - Use %pK instead of %p in the stm32-quadspi driver
    - Improve timeout handling in the cadence-quadspi driver
    - Use mtd_device_register() instead of mtd_device_parse_register() in
    the intel-spi driver

    NAND core changes:
    - Add the SPI-NAND framework.
    - Create a helper to find the best ECC configuration.
    - Create NAND controller operations.
    - Allocate dynamically ONFI parameters structure.
    - Add defines for ONFI version bits.
    - Add manufacturer fixup for ONFI parameter page.
    - Add an option to specify NAND chip as a boot device.
    - Add Reed-Solomon error correction algorithm.
    - Better name for the controller structure.
    - Remove unused caller_is_module() definition.
    - Make subop helpers return unsigned values.
    - Expose _notsupp() helpers for raw page accessors.
    - Add default values for dynamic timings.
    - Kill the chip->scan_bbt() hook.
    - Rename nand_default_bbt() into nand_create_bbt().
    - Start to clean the nand_chip structure.
    - Remove stale prototype from rawnand.h.

    Raw NAND controllers drivers changes:
    - Qcom: structuring cleanup.
    - Denali: use core helper to find the best ECC configuration.
    - Possible build of almost all drivers by adding a dependency on
    COMPILE_TEST for almost all of them in Kconfig, implies various
    fixes, Kconfig cleanup, GPIO headers inclusion cleanup, and even
    changes in sparc64 and ia64 architectures.
    - Clean the ->probe() functions error path of a lot of drivers.
    - Migrate all drivers to use nand_scan() instead of
    nand_scan_ident()/nand_scan_tail() pair.
    - Use mtd_device_register() where applicable to simplify the code.
    - Marvell:
    * Handle on-die ECC.
    * Better clocks handling.
    * Remove bogus comment.
    * Add suspend and resume support.
    - Tegra: add NAND controller driver.
    - Atmel:
    * Add module param to avoid using dma.
    * Drop Wenyou Yang from MAINTAINERS.
    - Denali: optimize timings handling.
    - FSMC: Stop using chip->read_buf().
    - FSL:
    * Switch to SPDX license tag identifiers.
    * Fix qualifiers in MXC init functions.

    Raw NAND chip drivers changes:
    - Micron:
    * Add fixup for ONFI revision.
    * Update ecc_stats.corrected.
    * Make ECC activation stateful.
    * Avoid enabling/disabling ECC when it can't be disabled.
    * Get the actual number of bitflips.
    * Allow forced on-die ECC.
    * Support 8/512 on-die ECC.
    * Fix on-die ECC detection logic.
    - Hynix:
    * Fix decoding the OOB size on H27UCG8T2BTR.
    * Use ->exec_op() in hynix_nand_reg_write_op()"

    * tag 'mtd/for-4.19' of git://git.infradead.org/linux-mtd: (188 commits)
    mtd: rawnand: atmel: Select GENERIC_ALLOCATOR
    MAINTAINERS: drop Wenyou Yang from Atmel NAND driver support
    mtd: rawnand: allocate dynamically ONFI parameters during detection
    mtd: spi-nor: only apply reset hacks to broken hardware
    mtd: spi-nor: cadence-quadspi: fix timeout handling
    mtd: spi-nor: atmel-quadspi: Include gpio/consumer.h instead of gpio.h
    mtd: spi-nor: intel-spi: use mtd_device_register()
    mtd: spi-nor: stm32-quadspi: replace "%p" with "%pK"
    mtd: spi-nor: atmel-quadspi: add suspend/resume hooks
    mtd: rawnand: allocate model parameter dynamically
    mtd: rawnand: do not export nand_scan_[ident|tail]() anymore
    mtd: rawnand: txx9ndfmc: convert driver to nand_scan()
    mtd: rawnand: txx9ndfmc: clarify ECC parameters assignation
    mtd: rawnand: tegra: convert driver to nand_scan()
    mtd: rawnand: jz4740: convert driver to nand_scan()
    mtd: rawnand: jz4740: group nand_scan_{ident, tail} calls
    mtd: rawnand: jz4740: fix probe function error path
    mtd: rawnand: docg4: convert driver to nand_scan()
    mtd: rawnand: do not execute nand_scan_ident() if maxchips is zero
    mtd: rawnand: atmel: convert driver to nand_scan()
    ...

    Linus Torvalds
     

18 Jul, 2018

2 commits

  • This way we will be able to compile the ndfmc driver when
    COMPILE_TEST=y.

    Signed-off-by: Boris Brezillon
    Acked-by: Paul Burton
    Signed-off-by: Miquel Raynal

    Boris Brezillon
     
  • prom_putchar() is used centrally in early printk infrastructure therefore
    at least MIPS should agree on the function return type.

    [paul.burton@mips.com:
    - Include linux/types.h in asm/setup.h to gain the bool typedef before
    we start include asm/setup.h elsewhere.
    - Include asm/setup.h in all files that use or define prom_putchar().
    - Also standardise on signed rather than unsigned char argument.]

    Signed-off-by: Alexander Sverdlin
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/19842/
    Cc: linux-mips@linux-mips.org
    Cc: Ralf Baechle
    Cc: James Hogan
    Cc: Jonas Gorski
    Cc: Florian Fainelli
    Cc: Kate Stewart
    Cc: Philippe Ombredanne

    Alexander Sverdlin
     

25 Jun, 2018

2 commits

  • Convert everything not overriding dma-coherence.h to the generic
    noncoherent ops. The new dma-noncoherent.c file duplicates a lot of
    the code in dma-default.c, but that file will be gone by the end of
    this series.

    Signed-off-by: Christoph Hellwig
    Patchwork: https://patchwork.linux-mips.org/patch/19544/
    Signed-off-by: Paul Burton
    Cc: Florian Fainelli
    Cc: David Daney
    Cc: Kevin Cernekee
    Cc: Jiaxun Yang
    Cc: Tom Bogendoerfer
    Cc: Huacai Chen
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-mips@linux-mips.org

    Christoph Hellwig
     
  • Octeon and loonson64 already don't use it at all, and we're going to
    migrate more plaforms away from it.

    Signed-off-by: Christoph Hellwig
    Patchwork: https://patchwork.linux-mips.org/patch/19536/
    Signed-off-by: Paul Burton
    Cc: Florian Fainelli
    Cc: David Daney
    Cc: Kevin Cernekee
    Cc: Jiaxun Yang
    Cc: Tom Bogendoerfer
    Cc: Huacai Chen
    Cc: iommu@lists.linux-foundation.org
    Cc: linux-mips@linux-mips.org

    Christoph Hellwig
     

13 Jun, 2018

1 commit

  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

19 Feb, 2018

1 commit

  • gpio_leds are not supposed to change at runtime. struct
    gpio_led_platform_data contains a const struct gpio_led pointer since
    v2.6.39, so mark the gpio_led structures const too.

    Signed-off-by: Arvind Yadav
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/18008/
    [jhogan@kernel.org: improve commit message]
    Signed-off-by: James Hogan

    Arvind Yadav
     

05 Feb, 2018

1 commit

  • When commit b27311e1cace ("MIPS: TXx9: Add RBTX4939 board support")
    added board support for the RBTX4939, it added a call to
    led_classdev_register even if the LED class is built as a module.
    Built-in arch code cannot call module code directly like this. Commit
    b33b44073734 ("MIPS: TXX9: use IS_ENABLED() macro") subsequently
    changed the inclusion of this code to a single check that
    CONFIG_LEDS_CLASS is either builtin or a module, but the same issue
    remains.

    This leads to MIPS allmodconfig builds failing when CONFIG_MACH_TX49XX=y
    is set:

    arch/mips/txx9/rbtx4939/setup.o: In function `rbtx4939_led_probe':
    setup.c:(.init.text+0xc0): undefined reference to `of_led_classdev_register'
    make: *** [Makefile:999: vmlinux] Error 1

    Fix this by using the IS_BUILTIN() macro instead.

    Fixes: b27311e1cace ("MIPS: TXx9: Add RBTX4939 board support")
    Signed-off-by: Matt Redfearn
    Reviewed-by: James Hogan
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/18544/
    Signed-off-by: James Hogan

    Matt Redfearn
     

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
     

20 Sep, 2017

1 commit

  • 04c81c7293df ("MIPS: PCI: Replace pci_fixup_irqs() call with host bridge
    IRQ mapping hooks") moved the PCI IRQ fixup to the new host bridge
    map/swizzle_irq() hooks mechanism. Those hooks can also be called after
    boot, when all the __init/__initdata/__initconst sections have been freed.
    Therefore, functions called by them (and the data they refer to) must not
    be marked as __init/__initdata/__initconst lest compilation trigger section
    mismatch warnings.

    Fix all the board files map_irq() hooks by simply removing the respective
    __init/__initdata/__initconst section markers and by adding another
    persistent hook IRQ map for the txx9 board files.

    Fixes: 04c81c7293df ("MIPS: PCI: Replace pci_fixup_irqs() call with host bridge IRQ mapping hooks")
    Signed-off-by: Lorenzo Pieralisi
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Arnd Bergmann
    Cc: Ralf Baechle
    Cc: Steve French

    Lorenzo Pieralisi
     

14 Feb, 2017

1 commit

  • Historically a lot of these existed because we did not have
    a distinction between what was modular code and what was providing
    support to modules via EXPORT_SYMBOL and friends. That changed
    when we forked out support for the latter into the export.h file.

    This means we should be able to reduce the usage of module.h
    in code that is obj-y Makefile or bool Kconfig. In the case of
    some code where it is modular, we can extend that to also include
    files that are building basic support functionality but not related
    to loading or registering the final module; such files also have
    no need whatsoever for module.h

    The advantage in removing such instances is that module.h itself
    sources about 15 other headers; adding significantly to what we feed
    cpp, and it can obscure what headers we are effectively using.

    Since module.h might have been the implicit source for init.h
    (for __init) and for export.h (for EXPORT_SYMBOL) we consider each
    instance for the presence of either and replace/add as needed.

    Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

    Build coverage of all the mips defconfigs revealed the module.h
    header was masking a couple of implicit include instances, so
    we add the appropriate headers there.

    Signed-off-by: Paul Gortmaker
    Cc: David Daney
    Cc: John Crispin
    Cc: Ralf Baechle
    Cc: "Steven J. Hill"
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/15131/
    [james.hogan@imgtec.com: Preserve sort order where it already exists]
    Signed-off-by: James Hogan

    Paul Gortmaker
     

03 Jan, 2017

2 commits

  • - Convert from printk() to pr_*(),
    - Add missing continuations, to fix user-visible breakage,
    - Drop superfluous casts (u64 has been unsigned long long on all
    architectures for many years).

    On rbtx4927, this restores the kernel output like:

    -TX4927 SDRAMC --
    - CR0:0000007e00000544
    - TR:32800030e
    +TX4927 SDRAMC -- CR0:0000007e00000544 TR:32800030e

    and:

    -PCIC -- PCICLK:
    -Internal(33.3MHz)
    -
    +PCIC -- PCICLK:Internal(33.3MHz)

    Fixes: 4bcc595ccd80decb ("printk: reinstate KERN_CONT for printing continuation lines")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Atsushi Nemoto
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/14646/
    Signed-off-by: Ralf Baechle

    Geert Uytterhoeven
     
  • Use DEVICE_ATTR_WO for write only attributes. This simplifies the
    source code, improves readbility, and reduces the chance of
    inconsistencies.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @wo@
    declarer name DEVICE_ATTR;
    identifier x,x_store;
    @@

    DEVICE_ATTR(x, \(0200\|S_IWUSR\), NULL, x_store);

    @script:ocaml@
    x << wo.x;
    x_store << wo.x_store;
    @@

    if not (x^"_store" = x_store) then Coccilib.include_match false

    @@
    declarer name DEVICE_ATTR_WO;
    identifier wo.x,wo.x_store;
    @@

    - DEVICE_ATTR(x, \(0200\|S_IWUSR\), NULL, x_store);
    + DEVICE_ATTR_WO(x);
    //

    Signed-off-by: Julia Lawall
    Cc: kernel-janitors@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Cc: linux-kernel@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/14463/
    Signed-off-by: Ralf Baechle

    Julia Lawall
     

04 Oct, 2016

4 commits

  • This patch removes creating a fake pci device in MIPS early config
    access and instead just uses the pci bus to get the same functionality.
    The struct pci_dev is too large to allocate on the stack, and was relying
    on compiler optimizations to remove its usage.

    Signed-off-by: Keith Busch
    Reviewed-by: Atsushi Nemoto
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/14253/
    Signed-off-by: Ralf Baechle

    Keith Busch
     
  • Replace the custom minimal clock implementation for Toshiba TXx9 by a
    basic implementation using the Common Clock Framework.

    The only clocks that are provided are those needed by TXx9-specific
    drivers ("imbus" and "spi" (TX4938 only)), and their common parent
    clock "gbus". Other clocks can be added when needed.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Stephen Boyd
    Reviewed-by: Atsushi Nemoto
    Cc: Wim Van Sebroeck
    Cc: Guenter Roeck
    Cc: linux-clk@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Cc: linux-watchdog@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/14239/
    Signed-off-by: Ralf Baechle

    Geert Uytterhoeven
     
  • txx9_gpio_init() calls gpiochip_add_data(), which fails with -ENOMEM as
    it is called too early in the boot process. This causes all subsequent
    GPIO operations to fail silently (before commit 54d77198fdfbc4f0 ("gpio:
    bail out silently on NULL descriptors") it printed the error message
    "gpiod_direction_output_raw: invalid GPIO" on RBTX49[23]7).

    Postpone all GPIO setup to .arch_init() time to fix this.

    Suggested-by: Atsushi Nemoto
    Signed-off-by: Geert Uytterhoeven
    Acked-by: Linus Walleij
    Cc: linux-mips@linux-mips.org
    Cc: linux-gpio@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/14237/
    Signed-off-by: Ralf Baechle

    Geert Uytterhoeven
     
  • txx9_gpio_init() calls gpiochip_add_data(), which fails with -ENOMEM as
    it is called too early in the boot process. This causes all subsequent
    GPIO operations to fail silently.

    Postpone all GPIO setup to .arch_init() time to fix this.

    Suggested-by: Atsushi Nemoto
    Signed-off-by: Geert Uytterhoeven
    Acked-by: Linus Walleij
    Cc: linux-mips@linux-mips.org
    Cc: linux-gpio@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/13967/
    Signed-off-by: Ralf Baechle

    Geert Uytterhoeven
     

03 Aug, 2016

1 commit

  • There was only one use of __initdata_refok and __exit_refok

    __init_refok was used 46 times against 82 for __ref.

    Those definitions are obsolete since commit 312b1485fb50 ("Introduce new
    section reference annotations tags: __ref, __refdata, __refconst")

    This patch removes the following compatibility definitions and replaces
    them treewide.

    /* compatibility defines */
    #define __init_refok __ref
    #define __initdata_refok __refdata
    #define __exit_refok __ref

    I can also provide separate patches if necessary.
    (One patch per tree and check in 1 month or 2 to remove old definitions)

    [akpm@linux-foundation.org: coding-style fixes]
    Link: http://lkml.kernel.org/r/1466796271-3043-1-git-send-email-fabf@skynet.be
    Signed-off-by: Fabian Frederick
    Cc: Ingo Molnar
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

27 Jun, 2016

1 commit


20 Mar, 2016

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Support more Realtek wireless chips, from Jes Sorenson.

    2) New BPF types for per-cpu hash and arrap maps, from Alexei
    Starovoitov.

    3) Make several TCP sysctls per-namespace, from Nikolay Borisov.

    4) Allow the use of SO_REUSEPORT in order to do per-thread processing
    of incoming TCP/UDP connections. The muxing can be done using a
    BPF program which hashes the incoming packet. From Craig Gallek.

    5) Add a multiplexer for TCP streams, to provide a messaged based
    interface. BPF programs can be used to determine the message
    boundaries. From Tom Herbert.

    6) Add 802.1AE MACSEC support, from Sabrina Dubroca.

    7) Avoid factorial complexity when taking down an inetdev interface
    with lots of configured addresses. We were doing things like
    traversing the entire address less for each address removed, and
    flushing the entire netfilter conntrack table for every address as
    well.

    8) Add and use SKB bulk free infrastructure, from Jesper Brouer.

    9) Allow offloading u32 classifiers to hardware, and implement for
    ixgbe, from John Fastabend.

    10) Allow configuring IRQ coalescing parameters on a per-queue basis,
    from Kan Liang.

    11) Extend ethtool so that larger link mode masks can be supported.
    From David Decotigny.

    12) Introduce devlink, which can be used to configure port link types
    (ethernet vs Infiniband, etc.), port splitting, and switch device
    level attributes as a whole. From Jiri Pirko.

    13) Hardware offload support for flower classifiers, from Amir Vadai.

    14) Add "Local Checksum Offload". Basically, for a tunneled packet
    the checksum of the outer header is 'constant' (because with the
    checksum field filled into the inner protocol header, the payload
    of the outer frame checksums to 'zero'), and we can take advantage
    of that in various ways. From Edward Cree"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits)
    bonding: fix bond_get_stats()
    net: bcmgenet: fix dma api length mismatch
    net/mlx4_core: Fix backward compatibility on VFs
    phy: mdio-thunder: Fix some Kconfig typos
    lan78xx: add ndo_get_stats64
    lan78xx: handle statistics counter rollover
    RDS: TCP: Remove unused constant
    RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
    net: smc911x: convert pxa dma to dmaengine
    team: remove duplicate set of flag IFF_MULTICAST
    bonding: remove duplicate set of flag IFF_MULTICAST
    net: fix a comment typo
    ethernet: micrel: fix some error codes
    ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it
    bpf, dst: add and use dst_tclassid helper
    bpf: make skb->tc_classid also readable
    net: mvneta: bm: clarify dependencies
    cls_bpf: reset class and reuse major in da
    ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c
    ldmvsw: Add ldmvsw.c driver code
    ...

    Linus Torvalds
     

26 Feb, 2016

1 commit


19 Feb, 2016

2 commits


24 Jan, 2016

1 commit

  • As we want gpio_chip .get() calls to be able to return negative
    error codes and propagate to drivers, we need to go over all
    drivers and make sure their return values are clamped to [0,1].
    We do this by using the ret = !!(val) design pattern.

    Signed-off-by: Linus Walleij
    Cc: linux-mips@linux-mips.org
    Cc: linux-gpio@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/11925/
    Signed-off-by: Ralf Baechle

    Linus Walleij
     

28 Oct, 2015

1 commit


03 Sep, 2015

1 commit

  • Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS
    machines, and each machine type provides its own gpio.h. However
    only a handful really implement the GPIO API, most just forward
    everythings to gpiolib.

    The Alchemy machine is notable as it provides a system to allow
    implementing the GPIO API at the board level. But it is not used by
    any board currently supported, so it can also be removed.

    For most machine types we can just remove the custom gpio.h, as well
    as the custom wrappers if some exists. Some of the code found in
    the wrappers must be moved to the respective GPIO driver.

    A few more fixes are need in some drivers as they rely on linux/gpio.h
    to provides some machine specific definitions, or used asm/gpio.h
    instead of linux/gpio.h for the gpio API.

    Signed-off-by: Alban Bedel
    Reviewed-by: Linus Walleij
    Cc: linux-mips@linux-mips.org
    Cc: Hauke Mehrtens
    Cc: Rafał Miłecki
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Tejun Heo
    Cc: Alexandre Courbot
    Cc: Dmitry Torokhov
    Cc: Florian Fainelli
    Cc: Manuel Lauss
    Cc: Joe Perches
    Cc: Daniel Walter
    Cc: Sergey Ryazanov
    Cc: Huacai Chen
    Cc: James Hartley
    Cc: Andrew Bresticker
    Cc: Paul Burton
    Cc: Jiri Kosina
    Cc: Bjorn Helgaas
    Cc: Wolfram Sang
    Cc: Randy Dunlap
    Cc: Varka Bhadram
    Cc: Masanari Iida
    Cc: Tomi Valkeinen
    Cc: Michael Buesch
    Cc: abdoulaye berthe
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-ide@vger.kernel.org
    Cc: linux-gpio@vger.kernel.org
    Cc: linux-input@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Patchwork: https://patchwork.linux-mips.org/patch/10828/
    Signed-off-by: Ralf Baechle

    Alban Bedel
     

22 Jun, 2015

1 commit


15 Dec, 2014

1 commit

  • Pull driver core update from Greg KH:
    "Here's the set of driver core patches for 3.19-rc1.

    They are dominated by the removal of the .owner field in platform
    drivers. They touch a lot of files, but they are "simple" changes,
    just removing a line in a structure.

    Other than that, a few minor driver core and debugfs changes. There
    are some ath9k patches coming in through this tree that have been
    acked by the wireless maintainers as they relied on the debugfs
    changes.

    Everything has been in linux-next for a while"

    * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
    Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
    fs: debugfs: add forward declaration for struct device type
    firmware class: Deletion of an unnecessary check before the function call "vunmap"
    firmware loader: fix hung task warning dump
    devcoredump: provide a one-way disable function
    device: Add dev__once variants
    ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
    ath: use seq_file api for ath9k debugfs files
    debugfs: add helper function to create device related seq_file
    drivers/base: cacheinfo: remove noisy error boot message
    Revert "core: platform: add warning if driver has no owner"
    drivers: base: support cpu cache information interface to userspace via sysfs
    drivers: base: add cpu_device_create to support per-cpu devices
    topology: replace custom attribute macros with standard DEVICE_ATTR*
    cpumask: factor out show_cpumap into separate helper function
    driver core: Fix unbalanced device reference in drivers_probe
    driver core: fix race with userland in device_add()
    sysfs/kernfs: make read requests on pre-alloc files use the buffer.
    sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
    fs: sysfs: return EGBIG on write if offset is larger than file size
    ...

    Linus Torvalds
     

24 Nov, 2014

1 commit

  • Use the much more common pr_warn instead of pr_warning
    with the goal of removing pr_warning eventually.

    Other miscellanea:

    o Coalesce formats
    o Realign arguments

    Signed-off-by: Joe Perches
    Cc: linux-mips
    Cc: LKML
    Patchwork: https://patchwork.linux-mips.org/patch/7935/
    Signed-off-by: Ralf Baechle

    Joe Perches
     

20 Oct, 2014

1 commit


19 Sep, 2014

1 commit


02 Aug, 2014

1 commit


30 Jul, 2014

1 commit