22 Nov, 2019

1 commit


20 Aug, 2019

1 commit


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
     

13 Jun, 2018

1 commit

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

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

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

    as it's slightly less ugly than:

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

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

    kmalloc(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 tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

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

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

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

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

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

    - kmalloc
    + kmalloc_array
    (
    - 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;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - 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;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - 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;
    @@

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

    Signed-off-by: Kees Cook

    Kees Cook
     

04 Oct, 2017

1 commit

  • Make this const as it is only passed to the const arguments of the
    functions sysfs_remove_bin_file and sysfs_create_bin_file. Make the
    declaration const too.

    Structure found using Coccinelle and changes done by hand.

    Signed-off-by: Bhumika Goyal
    Signed-off-by: Greg Kroah-Hartman

    Bhumika Goyal
     

16 Jun, 2015

1 commit

  • Patch 1c6c9b1d9d25 caused a regression for rsrc_nonstatic: It relies
    on pccard_validate_cis() to determine whether an iomem resource can
    be used for PCMCIA cards. This override, however, lead invalid iomem
    resources to be accepted -- and lead to a fake CIS being used instead
    of the original CIS.

    To fix this issue, move the override for anonymous cards to the one
    place where it is needed -- when adding a PCMCIA device.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

30 May, 2015

2 commits

  • Reduce object size a little by using dev_
    calls instead of dev_printk(KERN_.

    Other miscellanea:

    o Coalesce formats
    o Realign arguments
    o Use pr_cont instead of naked printk
    reorder test to use "%s\n"

    Signed-off-by: Joe Perches
    Signed-off-by: Dominik Brodowski

    Joe Perches
     
  • The Linux kernel coding style guidelines suggest not using typedefs
    for structure types. This patch gets rid of the typedef for tuple_flags.

    The following Coccinelle semantic patch makes the transformation.

    @tn@
    identifier i;
    type td;
    @@

    -typedef
    struct i { ... }
    -td
    ;

    @@
    type tn.td;
    identifier tn.i;
    @@

    -td
    + struct i

    Signed-off-by: Himangi Saraogi
    Acked-by: Julia Lawall
    Signed-off-by: Dominik Brodowski

    Himangi Saraogi
     

12 Jan, 2015

3 commits

  • The core pcmcia code blows up all over the place if it allowed a card without
    a valid CIS. We need to allow such cards as the CIS stuff is not on the older
    flash, ROM and SRAM cards.

    In order to minimise the risk of misidentifying junk and feeding it to the
    wrong thing we only fix up apparently anonymous cards if the driver for them
    has been enabled.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The requery logic goes off and attempts to read the CIS of empty slots. In
    most cases this happens not to do any harm - but not all!

    Add the missing check and also a WARN() to catch any other offenders.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     
  • The current code displays warnings but then proceeds to try and reference
    the data through the PCMCIA window. Instead return 0xff. This prevents bogus
    CIS data sending us off into hyperspace.

    Signed-off-by: Alan Cox
    Signed-off-by: Greg Kroah-Hartman

    Alan Cox
     

29 Sep, 2010

1 commit

  • pcmcia_enable_device() now replaces pcmcia_request_configuration().
    Instead of config_req_t, all necessary flags are either passed as
    a parameter to pcmcia_enable_device(), or (in rare circumstances)
    set in struct pcmcia_device -> flags.

    With the last remaining user of include/pcmcia/cs.h gone, remove
    all references.

    CC: netdev@vger.kernel.org
    CC: linux-wireless@vger.kernel.org
    CC: linux-ide@vger.kernel.org
    CC: linux-usb@vger.kernel.org
    CC: laforge@gnumonks.org
    CC: linux-mtd@lists.infradead.org
    CC: alsa-devel@alsa-project.org
    CC: linux-serial@vger.kernel.org
    CC: Jiri Kosina
    CC: linux-scsi@vger.kernel.org
    Acked-by: Gustavo F. Padovan (for drivers/bluetooth)
    Tested-by: Wolfram Sang
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

03 Aug, 2010

2 commits


31 Jul, 2010

1 commit

  • Remove cs_types.h which is no longer needed: Most definitions aren't
    used at all, a few can be made away with, and two remaining definitions
    (typedefs, unfortunatley) may be moved to more specific places.

    CC: linux-ide@vger.kernel.org
    CC: linux-usb@vger.kernel.org
    CC: laforge@gnumonks.org
    CC: linux-mtd@lists.infradead.org
    CC: alsa-devel@alsa-project.org
    CC: linux-serial@vger.kernel.org
    Acked-by: Marcel Holtmann (for drivers/bluetooth/)
    Acked-by: David S. Miller
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

22 May, 2010

1 commit


10 May, 2010

2 commits


17 Apr, 2010

1 commit


03 Mar, 2010

1 commit

  • Fix most of the remaining CodingStyle issues in drivers/pcmcia , which
    related to wrong indent -- PCMCIA historically used 4 spaces. Also, remove
    a custom min() implementation with the generic one.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

18 Feb, 2010

6 commits


18 Jan, 2010

4 commits

  • At least no in-kernel CardBus-capable PCI driver makes use of the CIS
    access functions. Therefore, it seems sensible to remove this unused
    code, and cleanup cardbus.c a lot.

    CC: Jesse Barnes
    CC: Linus Torvalds
    Tested-by: Wolfram Sang
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • During a suspend/resume cycle, an user may change the card in the
    PCMCIA/CardBus slot. The pcmcia_core can at least look at the
    socket state to check whether it is the same.

    For PCMCIA devices, move the detection and handling of such a
    change to ds.c.

    For CardBus devices, the PCI hotplug interface doesn't offer a "rescan"
    facility which also _removes_ devices no longer to be found behind a
    bridge. Therefore, remove and re-add all devices unconditionally.

    CC: Jesse Barnes
    CC: Linus Torvalds
    Tested-by: Wolfram Sang
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • Cleanup pccard_validate_cis() and make it return an error code on
    all failures, not merely on some failures.

    Tested-by: Wolfram Sang
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • In pccard_validate_cis(), validate the card CIS, not the CIS cache.
    Also, destroy the CIS cache if pccard_validate_cis fails.

    Furthermore, do not remove the fake CIS in destroy_cis_cache() but
    do so explicitely in the code paths where it makes sense.

    Tested-by: Wolfram Sang
    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

08 Dec, 2009

1 commit

  • Fix several CodingStyle issues in drivers/pcmcia/ . checkpatch.pl no longer
    reports errors in the PCMCIA core. The remaining warnings mostly relate to
    wrong indent -- PCMCIA historically used 4 spaces --, to lines over 80
    characters and to hundreds of typedefs. The cleanup of those will follow
    in the future.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

09 Nov, 2009

2 commits

  • Use the generic "dynamic debug" infrastructure instead of
    CONIG_PCMCIA_DEBUG in the PCMCIA core (pcmcia.ko and pcmcia_core.ko). To
    enable debugging, enable CONFIG_DYNAMIC_DEBUG, mount debugfs and

    $ echo -n 'module pcmcia_core +p' > /sys/kernel/debug/dynamic_debug/control

    for the complete module "pcmcia_core", for example. For more detailled
    instructions, please see Documentation/dynamic-debug-howto.txt

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     
  • As a replacement to pcmcia_get_{first,next}_tuple() and
    pcmcia_get_tuple_data(), three new -- and easier to use --
    functions are added:

    - pcmcia_get_tuple() to get the very first CIS entry of one
    type.

    - pcmcia_loop_tuple() to loop over all CIS entries of one type.

    - pcmcia_get_mac_from_cis() to read out the hardware MAC address
    from CISTPL_FUNCE.

    Only a handful of drivers need these functions anyway, as most
    CIS access is already handled by pcmcia_loop_config(), which
    now shares the same backed (pccard_loop_tuple()) with
    pcmcia_loop_tuple().

    A pcmcia_get_mac_from_cis() bug noted by Komuro
    has been fixed in this revision.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

19 Oct, 2009

1 commit

  • pccard_read_tuple(), which is only used by the PCMCIA core, should
    handle TUPLE_RETURN_COMMON more sensibly: If a specific function (which
    may be 0) is requested, set tuple.Attributes = 0 as was done in all
    PCMCIA drivers. If, however, BIND_FN_ALL is requested, return the
    "common" tuple. As to the callers of pccard_read_tuple():

    - All calls to pcmcia_validate_cis() had set the "function" parameter to
    BIND_FN_ALL. Therefore, remove the "function" parameter and make the
    parameter to pccard_read_tuple explicit.

    - Calls to CISTPL_VERS_1 and CISTPL_MANFID now set BIND_FN_ALL. This was
    already the case for calls to CISTPL_LONGLINK_MFC.

    Signed-off-by: Dominik Brodowski

    Dominik Brodowski
     

03 Nov, 2008

1 commit


31 Aug, 2008

1 commit


23 Aug, 2008

4 commits