24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

26 Jul, 2019

1 commit

  • In preparation to enabling -Wimplicit-fallthrough, mark switch
    cases where we are expecting to fall through.

    This patch fixes the following warnings:

    drivers/firewire/core-device.c: In function ‘set_broadcast_channel’:
    drivers/firewire/core-device.c:969:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (data & cpu_to_be32(1 << 31)) {
    ^
    drivers/firewire/core-device.c:974:3: note: here
    case RCODE_ADDRESS_ERROR:
    ^~~~
    drivers/firewire/core-iso.c: In function ‘manage_channel’:
    drivers/firewire/core-iso.c:308:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if ((data[0] & bit) == (data[1] & bit))
    ^
    drivers/firewire/core-iso.c:312:3: note: here
    default:
    ^~~~~~~
    drivers/firewire/core-topology.c: In function ‘count_ports’:
    drivers/firewire/core-topology.c:69:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
    (*child_port_count)++;
    ~~~~~~~~~~~~~~~~~~~^~
    drivers/firewire/core-topology.c:70:3: note: here
    case SELFID_PORT_PARENT:
    ^~~~

    Warning level 3 was used: -Wimplicit-fallthrough=3

    Notice that in some cases, the code comment is modified in
    accordance with what GCC is expecting to find.

    This patch is part of the ongoing efforts to enable
    -Wimplicit-fallthrough.

    Cc: Kees Cook
    Cc: Mathieu Malaterre
    Signed-off-by: Stefan Richter (reworded a comment)
    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

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 this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program if not write to the free software foundation inc
    59 temple place suite 330 boston ma 02111 1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

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

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

    Thomas Gleixner
     

07 Jun, 2018

1 commit

  • 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
     

23 Mar, 2017

1 commit


29 Mar, 2012

1 commit


11 Mar, 2012

1 commit

  • The "skipped bus generations" message was added together with the
    respective fw_device retaining/ reviving code in order to see how it all
    works out. It did well, so don't spam the log anymore.

    The "register access failure" situation still needs an actual handler.
    But at this point it makes less sense to ask folks to send mails about
    it. We now have a pretty good picture of what controllers emit this and
    when:

    Texas Instruments PCIxx21 FireWire + CardBus + flash memory card
    controller:
    https://bugzilla.redhat.com/show_bug.cgi?id=608544

    O2 Micro FireWire + flash memory card controller:
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/801719
    https://bugs.launchpad.net/ubuntu/+source/linux/+bug/881688
    http://marc.info/?l=linux1394-devel&m=132309283531423
    http://marc.info/?l=linux1394-devel&m=132368567907469
    http://marc.info/?l=linux1394-devel&m=132516165727468
    http://marc.info/?l=linux1394-devel&m=133006486927699

    Pinnacle Movieboard:
    commit 7f7e37115a8b6724f26d0637a04e1d35e3c59717
    http://marc.info/?l=linux1394-devel&m=130714243325962

    Signed-off-by: Stefan Richter

    Stefan Richter
     

23 Feb, 2012

1 commit

  • Associate all log messages from firewire-core with the respective card
    because some people have more than one card. E.g.
    firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
    firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
    firewire_core: created device fw0: GUID 0814438400000389, S800
    firewire_core: phy config: new root=ffc1, gap_count=5
    firewire_core: created device fw1: GUID 0814438400000388, S800
    firewire_core: created device fw2: GUID 0001d202e06800d1, S800
    turns into
    firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
    firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
    firewire_core 0000:04:00.0: created device fw0: GUID 0814438400000389, S800
    firewire_core 0000:04:00.0: phy config: new root=ffc1, gap_count=5
    firewire_core 0000:05:00.0: created device fw1: GUID 0814438400000388, S800
    firewire_core 0000:04:00.0: created device fw2: GUID 0001d202e06800d1, S800

    This increases the module size slightly; to keep this in check, turn the
    former printk wrapper macros into functions. Their implementation is
    largely copied from driver core's dev_printk counterparts.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

23 Jan, 2011

1 commit

  • On a 32-bit machine with, e.g., HZ=1000, jiffies will overflow after
    about 50 days, so if there are between 25 and 50 days between bus
    resets, the card->reset_jiffies comparisons can get wrong results.

    To fix this, ensure that this timestamp always uses 64 bits.

    Signed-off-by: Clemens Ladisch
    Signed-off-by: "Stefan Richter"

    Clemens Ladisch
     

13 Jul, 2010

1 commit

  • The present inline documentation of the fw_send_request() in-kernel API
    refers to userland code that is not applicable to kernel drivers at all.

    Reported-by: Ben Gamari

    While we are at fixing the whole documentation of fw_send_request(),
    also improve the rest of firewire-core's kerneldoc comments:
    - Add a bit of text concerning fw_run_transaction()'s call parameters.
    - Append () to function names and tab-align parameter descriptions as
    suggested by the example in Documentation/kernel-doc-nano-HOWTO.txt.
    - Remove kerneldoc markers from comments on static functions.
    - Remove outdated parameter descriptions at build_tree().

    Signed-off-by: Stefan Richter

    Stefan Richter
     

08 Jul, 2010

1 commit


19 Jun, 2010

2 commits

  • Push the maintenance of STATE_CLEAR/SET.abdicate down into the card
    driver. This way, the read/write_csr_reg driver method works uniformly
    across all CSR offsets.

    Signed-off-by: Stefan Richter

    Stefan Richter
     
  • by feature variables in the fw_card struct. The hook appeared to be an
    unnecessary abstraction in the card driver interface.

    Cleaner would be to pass those feature flags as arguments to
    fw_card_initialize() or fw_card_add(), but the FairnessControl register
    is in the SCLK domain and may therefore not be accessible while Link
    Power Status is off, i.e. before the card->driver->enable call from
    fw_card_add().

    Signed-off-by: Stefan Richter

    Stefan Richter
     

10 Jun, 2010

2 commits


10 Dec, 2009

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (42 commits)
    tree-wide: fix misspelling of "definition" in comments
    reiserfs: fix misspelling of "journaled"
    doc: Fix a typo in slub.txt.
    inotify: remove superfluous return code check
    hdlc: spelling fix in find_pvc() comment
    doc: fix regulator docs cut-and-pasteism
    mtd: Fix comment in Kconfig
    doc: Fix IRQ chip docs
    tree-wide: fix assorted typos all over the place
    drivers/ata/libata-sff.c: comment spelling fixes
    fix typos/grammos in Documentation/edac.txt
    sysctl: add missing comments
    fs/debugfs/inode.c: fix comment typos
    sgivwfb: Make use of ARRAY_SIZE.
    sky2: fix sky2_link_down copy/paste comment error
    tree-wide: fix typos "couter" -> "counter"
    tree-wide: fix typos "offest" -> "offset"
    fix kerneldoc for set_irq_msi()
    spidev: fix double "of of" in comment
    comment typo fix: sybsystem -> subsystem
    ...

    Linus Torvalds
     

04 Dec, 2009

1 commit

  • That is "success", "unknown", "through", "performance", "[re|un]mapping"
    , "access", "default", "reasonable", "[con]currently", "temperature"
    , "channel", "[un]used", "application", "example","hierarchy", "therefore"
    , "[over|under]flow", "contiguous", "threshold", "enough" and others.

    Signed-off-by: André Goddard Rosa
    Signed-off-by: Jiri Kosina

    André Goddard Rosa
     

15 Oct, 2009

1 commit

  • The Topology Map of the local node was created in CPU byte order,
    then a temporary big endian copy was created to compute the CRC,
    and when a read request to the Topology Map arrived it had to be
    converted to big endian byte order again.

    We now generate it in big endian byte order in the first place.
    This also rids us of 1000 bytes stack usage in tasklet context.

    Signed-off-by: Stefan Richter

    Stefan Richter
     

05 Jun, 2009

1 commit

  • The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
    "drivers/firewire/fw-*.c"
    are renamed to
    "drivers/firewire/core-*.c",
    "drivers/firewire/ohci.c",
    "drivers/firewire/sbp2.c".

    The old fw- prefix was redundant to the directory name. The new core-
    prefix distinguishes the files according to which driver they belong to.

    This change comes a little late, but still before further firewire
    drivers are added as anticipated RSN.

    Signed-off-by: Stefan Richter

    Stefan Richter