05 Aug, 2021

2 commits

  • The only actual use is to check in zorro_device_probe() that the device
    isn't already bound. The driver core already ensures this however so the
    check can go away which allows to drop the then assigned-only member
    from struct zorro_dev.

    If the value was indeed needed somewhere it can always be calculated by

    to_zorro_driver(z->dev.driver)

    .

    Signed-off-by: Uwe Kleine-König
    Link: https://lore.kernel.org/r/20210730191035.1455248-5-u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Uwe Kleine-König
     
  • The driver core only calls a remove callback when the device was
    successfully bound (aka probed) before. So dev->driver is never NULL.

    (And even if it was NULL, to_zorro_driver(NULL) isn't ...)

    Signed-off-by: Uwe Kleine-König
    Link: https://lore.kernel.org/r/20210730191035.1455248-4-u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Uwe Kleine-König
     

21 Jul, 2021

1 commit

  • The driver core ignores the return value of this callback because there
    is only little it can do when a device disappears.

    This is the final bit of a long lasting cleanup quest where several
    buses were converted to also return void from their remove callback.
    Additionally some resource leaks were fixed that were caused by drivers
    returning an error code in the expectation that the driver won't go
    away.

    With struct bus_type::remove returning void it's prevented that newly
    implemented buses return an ignored error code and so don't anticipate
    wrong expectations for driver authors.

    Reviewed-by: Tom Rix (For fpga)
    Reviewed-by: Mathieu Poirier
    Reviewed-by: Cornelia Huck (For drivers/s390 and drivers/vfio)
    Acked-by: Russell King (Oracle) (For ARM, Amba and related parts)
    Acked-by: Mark Brown
    Acked-by: Chen-Yu Tsai (for sunxi-rsb)
    Acked-by: Pali Rohár
    Acked-by: Mauro Carvalho Chehab (for media)
    Acked-by: Hans de Goede (For drivers/platform)
    Acked-by: Alexandre Belloni
    Acked-By: Vinod Koul
    Acked-by: Juergen Gross (For xen)
    Acked-by: Lee Jones (For mfd)
    Acked-by: Johannes Thumshirn (For mcb)
    Acked-by: Johan Hovold
    Acked-by: Srinivas Kandagatla (For slimbus)
    Acked-by: Kirti Wankhede (For vfio)
    Acked-by: Maximilian Luz
    Acked-by: Heikki Krogerus (For ulpi and typec)
    Acked-by: Samuel Iglesias Gonsálvez (For ipack)
    Acked-by: Geoff Levand (For ps3)
    Acked-by: Yehezkel Bernat (For thunderbolt)
    Acked-by: Alexander Shishkin (For intel_th)
    Acked-by: Dominik Brodowski (For pcmcia)
    Acked-by: Rafael J. Wysocki (For ACPI)
    Acked-by: Bjorn Andersson (rpmsg and apr)
    Acked-by: Srinivas Pandruvada (For intel-ish-hid)
    Acked-by: Dan Williams (For CXL, DAX, and NVDIMM)
    Acked-by: William Breathitt Gray (For isa)
    Acked-by: Stefan Richter (For firewire)
    Acked-by: Benjamin Tissoires (For hid)
    Acked-by: Thorsten Scherer (For siox)
    Acked-by: Sven Van Asbroeck (For anybuss)
    Acked-by: Ulf Hansson (For MMC)
    Acked-by: Wolfram Sang # for I2C
    Acked-by: Sudeep Holla
    Acked-by: Geert Uytterhoeven
    Acked-by: Dmitry Torokhov
    Acked-by: Finn Thain
    Signed-off-by: Uwe Kleine-König
    Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Uwe Kleine-König
     

26 Aug, 2020

1 commit

  • When booting Linux on an Amiga with BigRAMPlus Zorro expansion board:

    zorro: Address space collision on device Zorro device 12128600 (Individual Computers) [??? 0x50000000-]

    This happens because the address space occupied by the BigRAMPlus Zorro
    device is already in use, as it is part of system RAM. Hence the
    message is harmless.

    Zorro memory expansion boards have the ERTF_MEMLIST flag set, which
    tells AmigaOS to link the board's RAM into the free memory list. While
    we could skip registering the board resource if this flag is set, that
    may cause issues with Zorro II RAM excluded in a memfile.

    Hence fix the issue by just ignoring the error if ERTF_MEMLIST is set.

    Reported-by: John Paul Adrian Glaubitz
    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200713072429.6182-1-geert@linux-m68k.org

    Geert Uytterhoeven
     

14 Jun, 2020

1 commit

  • Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over
    '---help---'"), the number of '---help---' has been gradually
    decreasing, but there are still more than 2400 instances.

    This commit finishes the conversion. While I touched the lines,
    I also fixed the indentation.

    There are a variety of indentation styles found.

    a) 4 spaces + '---help---'
    b) 7 spaces + '---help---'
    c) 8 spaces + '---help---'
    d) 1 space + 1 tab + '---help---'
    e) 1 tab + '---help---' (correct indentation)
    f) 1 tab + 1 space + '---help---'
    g) 1 tab + 2 spaces + '---help---'

    In order to convert all of them to 1 tab + 'help', I ran the
    following commend:

    $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/'

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

04 Apr, 2020

1 commit

  • Pull SPDX updates from Greg KH:
    "Here are three SPDX patches for 5.7-rc1.

    One fixes up the SPDX tag for a single driver, while the other two go
    through the tree and add SPDX tags for all of the .gitignore files as
    needed.

    Nothing too complex, but you will get a merge conflict with your
    current tree, that should be trivial to handle (one file modified by
    two things, one file deleted.)

    All three of these have been in linux-next for a while, with no
    reported issues other than the merge conflict"

    * tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
    ASoC: MT6660: make spdxcheck.py happy
    .gitignore: add SPDX License Identifier
    .gitignore: remove too obvious comments

    Linus Torvalds
     

25 Mar, 2020

1 commit


09 Mar, 2020

5 commits

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Signed-off-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20200227183748.GA31018@embeddedor
    Signed-off-by: Geert Uytterhoeven

    Gustavo A. R. Silva
     
  • zorro_bus_type was never used outside the Zorro bus code. Hence move it
    from the public to the bus-private header file.

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200112164949.20196-6-geert@linux-m68k.org

    Geert Uytterhoeven
     
  • Make zorro_bus_match() use the existing zorro_match_device() helper,
    instead of open-coding the same operation.

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200112164949.20196-4-geert@linux-m68k.org

    Geert Uytterhoeven
     
  • The kerneldoc for zorro_bus_match() was obviously copied from
    zorro_match_device(), but wasnt't updated for the different calling
    context and semantics.

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200112164949.20196-3-geert@linux-m68k.org

    Geert Uytterhoeven
     
  • Unlike its PCI counterpart, zorro_match_device() was never used outside
    the Zorro bus code.

    Signed-off-by: Geert Uytterhoeven
    Link: https://lore.kernel.org/r/20200112164949.20196-2-geert@linux-m68k.org

    Geert Uytterhoeven
     

10 Feb, 2020

1 commit

  • Pull more Kbuild updates from Masahiro Yamada:

    - fix randconfig to generate a sane .config

    - rename hostprogs-y / always to hostprogs / always-y, which are more
    natual syntax.

    - optimize scripts/kallsyms

    - fix yes2modconfig and mod2yesconfig

    - make multiple directory targets ('make foo/ bar/') work

    * tag 'kbuild-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kbuild: make multiple directory targets work
    kconfig: Invalidate all symbols after changing to y or m.
    kallsyms: fix type of kallsyms_token_table[]
    scripts/kallsyms: change table to store (strcut sym_entry *)
    scripts/kallsyms: rename local variables in read_symbol()
    kbuild: rename hostprogs-y/always to hostprogs/always-y
    kbuild: fix the document to use extra-y for vmlinux.lds
    kconfig: fix broken dependency in randconfig-generated .config

    Linus Torvalds
     

04 Feb, 2020

2 commits

  • The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
    seq_file.h.

    Conversion rule is:

    llseek => proc_lseek
    unlocked_ioctl => proc_ioctl

    xxx => proc_xxx

    delete ".owner = THIS_MODULE" line

    [akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c]
    [sfr@canb.auug.org.au: fix kernel/sched/psi.c]
    Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au
    Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2
    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     
  • In old days, the "host-progs" syntax was used for specifying host
    programs. It was renamed to the current "hostprogs-y" in 2004.

    It is typically useful in scripts/Makefile because it allows Kbuild to
    selectively compile host programs based on the kernel configuration.

    This commit renames like follows:

    always -> always-y
    hostprogs-y -> hostprogs

    So, scripts/Makefile will look like this:

    always-$(CONFIG_BUILD_BIN2C) += ...
    always-$(CONFIG_KALLSYMS) += ...
    ...
    hostprogs := $(always-y) $(always-m)

    I think this makes more sense because a host program is always a host
    program, irrespective of the kernel configuration. We want to specify
    which ones to compile by CONFIG options, so always-y will be handier.

    The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
    compatibility for a while.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

21 May, 2019

1 commit


07 Jun, 2018

2 commits

  • Pull overflow updates from Kees Cook:
    "This adds the new overflow checking helpers and adds them to the
    2-factor argument allocators. And this adds the saturating size
    helpers and does a treewide replacement for the struct_size() usage.
    Additionally this adds the overflow testing modules to make sure
    everything works.

    I'm still working on the treewide replacements for allocators with
    "simple" multiplied arguments:

    *alloc(a * b, ...) -> *alloc_array(a, b, ...)

    and

    *zalloc(a * b, ...) -> *calloc(a, b, ...)

    as well as the more complex cases, but that's separable from this
    portion of the series. I expect to have the rest sent before -rc1
    closes; there are a lot of messy cases to clean up.

    Summary:

    - Introduce arithmetic overflow test helper functions (Rasmus)

    - Use overflow helpers in 2-factor allocators (Kees, Rasmus)

    - Introduce overflow test module (Rasmus, Kees)

    - Introduce saturating size helper functions (Matthew, Kees)

    - Treewide use of struct_size() for allocators (Kees)"

    * tag 'overflow-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    treewide: Use struct_size() for devm_kmalloc() and friends
    treewide: Use struct_size() for vmalloc()-family
    treewide: Use struct_size() for kmalloc()-family
    device: Use overflow helpers for devm_kmalloc()
    mm: Use overflow helpers in kvmalloc()
    mm: Use overflow helpers in kmalloc_array*()
    test_overflow: Add memory allocation overflow tests
    overflow.h: Add allocation size calculation helpers
    test_overflow: Report test failures
    test_overflow: macrofy some more, do more tests for free
    lib: add runtime test of check_*_overflow functions
    compiler.h: enable builtin overflow checkers and add fallback code

    Linus Torvalds
     
  • One of the more common cases of allocation size calculations is finding
    the size of a structure that has a zero-sized array at the end, along
    with memory for some number of elements for that array. For example:

    struct foo {
    int stuff;
    void *entry[];
    };

    instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

    Instead of leaving these open-coded and prone to type mistakes, we can
    now use the new struct_size() helper:

    instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);

    This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
    uses. It was done via automatic conversion with manual review for the
    "CHECKME" non-standard cases noted below, using the following Coccinelle
    script:

    // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
    // sizeof *pkey_cache->table, GFP_KERNEL);
    @@
    identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
    expression GFP;
    identifier VAR, ELEMENT;
    expression COUNT;
    @@

    - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
    + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)

    // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
    @@
    identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
    expression GFP;
    identifier VAR, ELEMENT;
    expression COUNT;
    @@

    - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
    + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)

    // Same pattern, but can't trivially locate the trailing element name,
    // or variable name.
    @@
    identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
    expression GFP;
    expression SOMETHING, COUNT, ELEMENT;
    @@

    - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
    + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)

    Signed-off-by: Kees Cook

    Kees Cook
     

05 Jun, 2018

1 commit

  • Pull m68k updates from Geert Uytterhoeven:

    - a few time-related fixes:
    - off-by-one calendar month on some classes of machines
    - Y2038 preparation

    - build fix for ndelay() being called with a 64-bit type

    - revive 64-bit get_user(), which is used by some Android code

    - defconfig updates

    - fix for a long-standing fatal bug in iounmap() on '020/030, which was
    actually fixed in 2.4.23, but never in 2.5.x and later

    - default DMA mask to avoid warning splats

    - minor fixes and cleanups

    * tag 'm68k-for-v4.18-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
    m68k: Set default dma mask for platform devices
    m68k/mm: Adjust VM area to be unmapped by gap size for __iounmap()
    m68k/defconfig: Update defconfigs for v4.17-rc3
    m68k/uaccess: Revive 64-bit get_user()
    m68k: Implement ndelay() as an inline function to force type checking/casting
    zorro: Add a blank line after declarations
    m68k: Use read_persistent_clock64() consistently
    m68k: Fix off-by-one calendar month
    m68k: Fix style, spelling, and grammar in siginfo_build_tests()
    m68k/mac: Fix SWIM memory resource end address

    Linus Torvalds
     

22 May, 2018

1 commit


16 May, 2018

1 commit


19 Mar, 2018

1 commit

  • The generic DMA API uses dev->dma_mask to check the DMA addressable
    memory bitmask, and warns if no mask is set or even allocated.

    Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
    to point to z->dev.dma_coherent_mask so device drivers that need DMA have
    everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
    still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.

    Signed-off-by: Michael Schmitz
    [geert: Handle Zorro II with 24-bit address space]
    Acked-by: Christoph Hellwig
    Signed-off-by: Geert Uytterhoeven

    Michael Schmitz
     

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
     

17 Mar, 2017

1 commit

  • Instead of creating attributes one by one, define attribute_group array
    and attach it to bus->dev_groups, so that all needed attributes are created
    automatically when a new device is registered on the bus.

    Also switch to using standard DEVICE_ATTR_RO() macros.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Torokhov
     

25 Dec, 2016

1 commit


25 Jan, 2016

1 commit


20 Oct, 2014

1 commit


11 Jul, 2014

1 commit

  • ARRAY_SIZE is more concise to use when the size of an array is divided
    by the size of its type or the size of its first element.

    The Coccinelle semantic patch that makes this change is as follows:

    //
    @@
    type T;
    T[] E;
    @@

    - (sizeof(E)/sizeof(T))
    + ARRAY_SIZE(E)
    //

    Signed-off-by: Himangi Saraogi
    [Geert: Also convert the MANUF definition]
    Signed-off-by: Geert Uytterhoeven

    Himangi Saraogi
     

26 Nov, 2013

5 commits


29 Jun, 2013

1 commit


02 May, 2013

1 commit

  • Supply accessor functions to set attributes in proc_dir_entry structs.

    The following are supplied: proc_set_size() and proc_set_user().

    Signed-off-by: David Howells
    Acked-by: Mauro Carvalho Chehab
    cc: linuxppc-dev@lists.ozlabs.org
    cc: linux-media@vger.kernel.org
    cc: netdev@vger.kernel.org
    cc: linux-wireless@vger.kernel.org
    cc: linux-pci@vger.kernel.org
    cc: netfilter-devel@vger.kernel.org
    cc: alsa-devel@alsa-project.org
    Signed-off-by: Al Viro

    David Howells
     

10 Apr, 2013

1 commit

  • The only part of proc_dir_entry the code outside of fs/proc
    really cares about is PDE(inode)->data. Provide a helper
    for that; static inline for now, eventually will be moved
    to fs/proc, along with the knowledge of struct proc_dir_entry
    layout.

    Signed-off-by: Al Viro

    Al Viro
     

23 Feb, 2013

1 commit


04 Jan, 2013

1 commit


16 Jul, 2012

1 commit


02 Jan, 2012

1 commit