06 Sep, 2019

1 commit


07 Jan, 2019

1 commit

  • add_mtd_device() can fail. We should always check its return value
    and gracefully handle the failure case. Fix the call sites where this
    not done (in mtdpart.c) and add a __must_check attribute to the
    prototype to avoid this kind of mistakes.

    Signed-off-by: Boris Brezillon

    Boris Brezillon
     

07 May, 2018

1 commit

  • This commit slightly simplifies the code. Every parse_mtd_partitions()
    caller (out of two existing ones) had to add partitions & cleanup parser
    on its own. This moves that responsibility into the function.

    That change also allows dropping struct mtd_partitions argument.

    There is one minor behavior change caused by this cleanup. If
    parse_mtd_partitions() fails to add partitions (add_mtd_partitions()
    return an error) then mtd_device_parse_register() will still try to
    add (register) fallback partitions. It's a real corner case affecting
    one of uncommon error paths and shouldn't cause any harm.

    Signed-off-by: Rafał Miłecki
    Signed-off-by: Boris Brezillon

    Rafał Miłecki
     

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
     

10 Dec, 2015

3 commits

  • If partition parsers need to clean up their resources, we shouldn't
    assume that all memory will fit in a single kmalloc() that the caller
    can kfree(). We should allow the parser to provide a proper cleanup
    routine.

    Note that this means we need to keep a hold on the parser's module for a
    bit longer, and release it later with mtd_part_parser_put().

    Alongside this, define a default callback that we'll automatically use
    if the parser doesn't provide one, so we can still retain the old
    behavior.

    Signed-off-by: Brian Norris
    Reviewed-by: Boris Brezillon

    Brian Norris
     
  • For some of the core partitioning code, it helps to keep info about the
    parsed partition (and who parsed them) together in one place.

    Signed-off-by: Brian Norris

    Brian Norris
     
  • The use of kmemdup() complicates the error handling a bit. We don't
    actually need to allocate new memory, since this reference is treated as
    const, and it is copied into new memory by the partition registration
    code anyway. So remove it.

    Signed-off-by: Brian Norris
    Reviewed-by: Boris Brezillon

    Brian Norris
     

05 Apr, 2013

3 commits

  • The MTD subsystem has historically tried to be as configurable as possible. The
    side-effect of this is that its configuration menu is rather large, and we are
    gradually shrinking it. For example, we recently merged partitions support with
    the mtdcore.

    This patch does the next step - it merges the mtdchar module to mtdcore. And in
    this case this is not only about eliminating too fine-grained separation and
    simplifying the configuration menu. This is also about eliminating seemingly
    useless kernel module.

    Indeed, mtdchar is a module that allows user-space making use of MTD devices
    via /dev/mtd* character devices. If users do not enable it, they simply cannot
    use MTD devices at all. They cannot read or write the flash contents. Is it a
    sane and useful setup? I believe not. And everyone just enables mtdchar.

    Having mtdchar separate is also a little bit harmful. People sometimes miss the
    fact that they need to enable an additional configuration option to have
    user-space MTD interfaces, and then they wonder why on earth the kernel does
    not allow using the flash? They spend time asking around.

    Thus, let's just get rid of this module and make it part of mtd core.

    Note, mtdchar had additional configuration option to enable OTP interfaces,
    which are present on some flashes. I removed that option as well - it saves a
    really tiny amount space.

    [dwmw2: Strictly speaking, you can mount file systems on MTD devices just
    fine without the mtdchar (or mtdblock) devices; you just can't do
    other manipulations directly on the underlying device. But still I
    agree that it makes sense to make this unconditional. And Yay! we
    get to kill off an instance of checking CONFIG_foo_MODULE, which is
    an abomination that should never happen.]

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Artem Bityutskiy
     
  • Remove useless extern qualifiers. Not that this is a problem, but we more often
    declare function prototypes without 'extern', so this is just about being more
    consistent. And I am going to add a couple more prototypes here.

    Additionally, remove a useless comment.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Artem Bityutskiy
     
  • 'mtd_device_parse_register()' and 'parse_mtd_partitions()' functions accept a
    an array of character pointers. These functions modify neither the pointers nor
    the characters they point to. The characters are actually names of the MTD
    parsers.

    At the moment, the argument type is 'const char **', which means that only the
    names of the parsers are constant. Let's turn the argument type into 'const
    char * const *', which means that both names and the pointers which point to
    them are constant.

    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Artem Bityutskiy
     

11 Sep, 2011

1 commit

  • There is no need to export parse_mtd_partitions() now , as it's fully handled
    by registration functions. So move the definition to private header and
    remove respective EXPORT_SYMBOL_GPL.

    Signed-off-by: Dmitry Eremin-Solenikov
    Signed-off-by: Artem Bityutskiy

    Dmitry Eremin-Solenikov
     

25 May, 2011

1 commit


25 Feb, 2010

2 commits


29 Jun, 2007

1 commit

  • Fix the sparse warnings generated by the implicit
    dependency of mtd_blkdevs.c and mtd_core.c for the
    two symbols mtd_table and mtd_table_mutex. This is
    done by adding an local header file mtdcore.h to
    define these (including the warning about the
    non-proliferation of these symbols).

    Signed-off-by: Ben Dooks
    Signed-off-by: David Woodhouse

    Ben Dooks