An error occurred fetching the project authors.
- 02 Dec, 2018 1 commit
-
-
Miquel Raynal authored
A Coverity robot reported an integer handling issue (OVERFLOW_BEFORE_WIDEN) in the potentially overflowing expression: (mtd_div_by_ws(mtd->size, mtd) - mtd_div_by_ws(offs, mtd)) * mtd_oobavail(mtd, ops) While such overflow will certainly never happen due to the numbers handled, it is cleaner to fix this operation anyway. The problem is that all the maths include 32-bit quantities, while the result is stored in an explicit 64-bit value. As maxooblen will just be compared with a size_t, let's change the type of the variable to a size_t. This will not fix anything but will clarify a bit the situation. Then, do an explicit cast to fix Coverity warning. Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
- 18 Jul, 2018 1 commit
-
-
Miquel Raynal authored
Some MTD sublayers/drivers are implementing ->_read/write() and not ->_read/write_oob(). While for NAND devices both are usually valid, for NOR devices, using the _oob variant has no real meaning. But, as the MTD layer is supposed to hide as much as possible the flash complexity to the user, there is no reason to error out while it is just a matter of rewritting things internally. Add a fallback on mtd->_read() (resp. mtd->_write()) when the user calls mtd_read_oob() (resp. mtd_write_oob()) while mtd->_read_oob() (resp. mtd->_write_oob) is not implemented. There is already a fallback on the _oob variant if the former is used. Signed-off-by:
Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
- 16 May, 2018 1 commit
-
-
Christoph Hellwig authored
Variants of proc_create{,_data} that directly take a seq_file show callback and drastically reduces the boilerplate code in the callers. All trivial callers converted over. Signed-off-by:
Christoph Hellwig <hch@lst.de>
-
- 07 May, 2018 1 commit
-
-
Rafał Miłecki authored
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 <rafal@milecki.pl> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
- 22 Apr, 2018 1 commit
-
-
Xiaolei Li authored
Expose mtd OOB available size by sysfs file. Then users can get available OOB size by accessing /sys/class/mtd/mtdX/oobavail. Signed-off-by:
Xiaolei Li <xiaolei.li@mediatek.com> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
- 29 Mar, 2018 2 commits
-
-
Xiaolei Li authored
In mtdcore.c, some function descriptions do not match function definitions. Just fix these mismatches. Signed-off-by:
Xiaolei Li <xiaolei.li@mediatek.com> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
Rafał Miłecki authored
In the commit 2c77c57d ("mtd: move code adding master MTD out of mtd_add_device_partitions()") behavior of mtd_device_parse_register() has very slightly changed. It's a pretty non-significant order change to match updated function behavior. Signed-off-by:
Rafał Miłecki <rafal@milecki.pl> Reviewed-by:
Richard Weinberger <richard@nod.at> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
- 21 Mar, 2018 1 commit
-
-
Boris Brezillon authored
MTD users are no longer checking erase_info->state to determine if the erase operation failed or succeeded. Moreover, mtd_erase_callback() is now a NOP. We can safely get rid of all mtd_erase_callback() calls and all erase_info->state assignments. While at it, get rid of the erase_info->state field, all MTD_ERASE_XXX definitions and the mtd_erase_callback() function. Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by:
Richard Weinberger <richard@nod.at> Reviewed-by:
Miquel Raynal <miquel.raynal@bootlin.com> Acked-by:
Bert Kenward <bkenward@solarflare.com> --- Changes in v2: - Address a few coding style issues (reported by Miquel) - Remove comments that are no longer valid (reported by Miquel)
-
- 15 Mar, 2018 2 commits
-
-
Boris Brezillon authored
None of the mtd->_erase() implementations work in an asynchronous manner, so let's simplify MTD users that call mtd_erase(). All they need to do is check the value returned by mtd_erase() and assume that != 0 means failure. Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by:
Richard Weinberger <richard@nod.at>
-
Boris Brezillon authored
mtd_erase() can return an error before ->fail_addr is initialized to MTD_FAIL_ADDR_UNKNOWN. Move this initialization at the very beginning of the function. Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by:
Richard Weinberger <richard@nod.at>
-
- 12 Feb, 2018 3 commits
-
-
Rafał Miłecki authored
This simplifies code a bit by: 1) Avoiding an extra (tiny) function 2) Checking for amount of parsed (found) partitions just once 3) Avoiding clearing/filling struct mtd_partitions manually With this commit proper functions are called directly from the mtd_device_parse_register(). It doesn't need to use minor tricks like memsetting struct to 0 to trigger an expected mtd_add_device_partitions() behavior. Signed-off-by:
Rafał Miłecki <rafal@milecki.pl> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
Rafał Miłecki authored
This change is a small cleanup of mtd_device_parse_register(). When using MTD_PARTITIONED_MASTER it makes sure a master MTD is registered before dealing with partitions. The advantage of this is not mixing code handling master MTD with code handling partitions. This commit doesn't change any behavior except from a slightly different failure code path. The new code may need to call del_mtd_device when something goes wrong. Signed-off-by:
Rafał Miłecki <rafal@milecki.pl> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
Boris Brezillon authored
Some devices do not implement ->_erase() or have an invalid ->erasesize value. In this case, mtd_erase() should return -ENOTSUPP. Note that the test is not done on the MTD_NO_ERASE flag because this flag means 'erasing a block before writing to it is unnecessary', not 'the erase operation is not supported'. Actually, some drivers are setting the MTD_NO_ERASE flag but still implementing the ->_erase() hook and setting a valid ->erasesize value. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by:
Miquel Raynal <miquel.raynal@free-electrons.com> Signed-off-by:
Boris Brezillon <boris.brezillon@bootlin.com>
-
- 16 Jan, 2018 1 commit
-
-
Boris Brezillon authored
Some MTD sublayers/drivers are implementing ->_read/write_oob() and provide dummy wrappers for their ->_read/write() implementations. Let the core handle this case instead of duplicating the logic. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by:
Robert Jarzmik <robert.jarzmik@free.fr> Acked-by:
Brian Norris <computersforpeace@gmail.com> Reviewed-by:
Miquel Raynal <miquel.raynal@free-electrons.com> Tested-by:
Ladislav Michl <ladis@linux-mips.org>
-
- 06 Jan, 2018 1 commit
-
-
Boris Brezillon authored
When mtd->erasesize is 0 or mtd->_erase is NULL, that means the device does not support the erase operation, which in turn means it should have the MTD_NO_ERASE flag set. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by:
Miquel Raynal <miquel.raynal@free-electrons.com>
-
- 18 Dec, 2017 1 commit
-
-
Miquel Raynal authored
The mtd_check_oob_ops() helper verifies if the operation defined by the user is correct. Fix the check that verifies if the entire requested area exists. This check is too restrictive and will fail anytime the last data byte of the very last page is included in an operation. Fixes: 5cdd929d ("mtd: Add sanity checks in mtd_write/read_oob()") Signed-off-by:
Miquel Raynal <miquel.raynal@free-electrons.com> Acked-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Richard Weinberger <richard@nod.at>
-
- 13 Nov, 2017 2 commits
-
-
Boris Brezillon authored
Unlike what's done in mtd_read/write(), there are no checks to make sure the parameters passed to mtd_read/write_oob() are consistent, which forces implementers of ->_read/write_oob() to do it, which in turn leads to code duplication and possibly errors in the logic. Do general sanity checks, like ops fields consistency and range checking. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Cc: Peter Pan <peterpandong@micron.com> Signed-off-by:
Richard Weinberger <richard@nod.at>
-
Nicolas Pitre authored
The mtd->_point method is a superset of mtd->_get_unmapped_area. Especially in the NOR flash case, the point method ensures the flash memory is in array (data) mode and that it will stay that way which is precisely what callers of mtd_get_unmapped_area() would expect. Implement mtd_get_unmapped_area() in terms of mtd->_point now that all drivers that provided a _get_unmapped_area method also have the _point method implemented. Signed-off-by:
Nicolas Pitre <nico@linaro.org> Reviewed-by:
Richard Weinberger <richard@nod.at> Acked-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Richard Weinberger <richard@nod.at>
-
- 21 Aug, 2017 1 commit
-
-
Bhumika Goyal authored
Make this const as it is only stored in the type field of a device structure, which is const. Done using Coccinelle. Signed-off-by:
Bhumika Goyal <bhumirks@gmail.com> Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
- 21 Jul, 2017 1 commit
-
-
Mario Rugiero authored
Several MTD devices are using debugfs entries created in the root. This commit provides the means for a standardized subtree, creating one "mtd" entry at root, and one entry per device inside it, named after the device. The tree is registered in add_mtd_device, and released in del_mtd_device. Devices docg3, mtdswap and nandsim were updated to use this subtree instead of custom ones, and their entries were prefixed with the drivers' names. Signed-off-by:
Mario J. Rugiero <mrugiero@gmail.com> Acked-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Brian Norris <computersforpeace@gmail.com>
-
- 08 Jul, 2017 1 commit
-
-
Boris Brezillon authored
The code checks that ->_point is not NULL, but we should actually check ->_unpoint value which is dereferenced a few lines after the check. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Brian Norris <computersforpeace@gmail.com>
-
- 20 Apr, 2017 2 commits
-
-
Jan Kara authored
Drop 'parent' argument of bdi_register() and bdi_register_va(). It is always NULL. Reviewed-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jan Kara <jack@suse.cz> Signed-off-by:
Jens Axboe <axboe@fb.com>
-
Jan Kara authored
MTD already allocates backing_dev_info dynamically. Convert it to use generic infrastructure for this including proper refcounting. We drop mtd->backing_dev_info as its only use was to pass mtd_bdi pointer from one file into another and if we wanted to keep that in a clean way, we'd have to make mtd hold and drop bdi reference as needed which seems pointless for passing one global pointer... CC: David Woodhouse <dwmw2@infradead.org> CC: Brian Norris <computersforpeace@gmail.com> CC: linux-mtd@lists.infradead.org Reviewed-by:
Christoph Hellwig <hch@lst.de> Signed-off-by:
Jan Kara <jack@suse.cz> Signed-off-by:
Jens Axboe <axboe@fb.com>
-
- 08 Feb, 2017 1 commit
-
-
Masahiro Yamada authored
- "This functions return ..." -> "This function returns ..." - "I you want ..." -> "If you want ..." Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Brian Norris <computersforpeace@gmail.com>
-
- 01 Dec, 2016 1 commit
-
-
Steve Longerbeam authored
The MTD backing dev info objects mtd_bdi was statically allocated. So when MTD is built as a loadable module, this object fall in the vmalloc address space. The problem with that, is that the BDI APIs use wake_up_bit(), which calls virt_to_page() to retrieve the memory zone of the page containing the wait_queue to wake up, and virt_to_page() is not valid for vmalloc or highmem addresses. Fix this by allocating the BDI objects dynamically with kmalloc. The objects now fall in the logical address space so that BDI APIs will work in all cases (mtd builtin or module). Signed-off-by:
Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by:
Jim Baxter <jim_baxter@mentor.com> Signed-off-by:
Sandeep Jain <Sandeep_Jain@mentor.com> Reviewed-by:
Richard Weinberger <richard@nod.at> Reviewed-by:
Marek Vasut <marek.vasut@gmail.com> Signed-off-by:
Brian Norris <computersforpeace@gmail.com>
-
- 19 Nov, 2016 3 commits
-
-
Masahiro Yamada authored
There is no need to initialize oobregion since it will be filled by the iterator. This function is called with mtd_ooblayout_free or mtd_ooblayout_ecc for the iterator; both of them calls memset() to clear the oobregion. Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by:
Marek Vasut <marek.vasut@gmail.com> Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
Masahiro Yamada authored
I hope this will make the code a little more readable. Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by:
Marek Vasut <marek.vasut@gmail.com> Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
Masahiro Yamada authored
There is no need to initialize oobregion and section since they will be filled by mtd_ooblayout_find_region(). Signed-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by:
Marek Vasut <marek.vasut@gmail.com> Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
- 11 Oct, 2016 1 commit
-
-
Masahiro Yamada authored
Kernel source files need not include <linux/kconfig.h> explicitly because the top Makefile forces to include it with: -include $(srctree)/include/linux/kconfig.h This commit removes explicit includes except the following: * arch/s390/include/asm/facilities_src.h * tools/testing/radix-tree/linux/kernel.h These two are used for host programs. Link: http://lkml.kernel.org/r/1473656164-11929-1-git-send-email-yamada.masahiro@socionext.comSigned-off-by:
Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
-
- 15 Sep, 2016 1 commit
-
-
Boris Brezillon authored
MLC and TLC NAND devices are using NAND cells exposing more than one bit, but instead of attaching all the bits in a given cell to a single NAND page, each bit is usually attached to a different page. This concept is called 'page pairing', and has significant impacts on the flash storage usage. The main problem showed by these devices is that interrupting a page program operation may not only corrupt the page we are programming but also the page it is paired with, hence the need to expose to MTD users the pairing scheme information. The pairing APIs allows one to query pairing information attached to a given page (here called wunit), or the other way around (the wunit pointed by pairing information). It also provides several helpers to help the conversion between absolute offsets and wunits, and query the number of pairing groups. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by:
Brian Norris <computersforpeace@gmail.com>
-
- 05 May, 2016 1 commit
-
-
Boris Brezillon authored
Now that all MTD drivers have moved to the mtd_ooblayout_ops model we can safely remove the struct nand_ecclayout definition, and all the remaining places where it was still used. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
- 19 Apr, 2016 2 commits
-
-
Boris Brezillon authored
ECC layout definitions are currently exposed using the nand_ecclayout struct which embeds oobfree and eccpos arrays with predefined size. This approach was acceptable when NAND chips were providing relatively small OOB regions, but MLC and TLC now provide OOB regions of several hundreds of bytes, which implies a non negligible overhead for everybody even those who only need to support legacy NANDs. Create an mtd_ooblayout_ops interface providing the same functionality (expose the ECC and oobfree layout) without the need for this huge structure. The mtd->ecclayout is now deprecated and should be replaced by the equivalent mtd_ooblayout_ops. In the meantime we provide a wrapper around the ->ecclayout field to ease migration to this new model. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
Boris Brezillon authored
In order to make the ecclayout definition completely dynamic we need to rework the way the OOB layout are defined and iterated. Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation and hide ecclayout internals to their users. Signed-off-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
- 13 Apr, 2016 2 commits
-
-
Ezequiel Garcia authored
Now that we've added the MTD LED trigger, we need to call each I/O path to ledtrig_mtd_activity. Signed-off-by:
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Jacek Anaszewski <j.anaszewski@samsung.com>
-
Ezequiel Garcia authored
There's no reason for having mtd_write_oob inlined in mtd.h header. Move it to mtdcore.c where it belongs. Signed-off-by:
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Acked-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Jacek Anaszewski <j.anaszewski@samsung.com>
-
- 04 Jan, 2016 1 commit
-
-
Brian Norris authored
Commit 807f16d4 ("mtd: core: set some defaults when dev.parent is set") attempted to provide some default settings for MTDs that (a) assign the parent device and (b) don't provide their own name or owner However, this isn't a perfect drop-in replacement for the boilerplate found in some drivers, because the MTD name is used by partition parsers like cmdlinepart, but the name isn't set until add_mtd_device(), after the parsing is completed. This means cmdlinepart sees a NULL name and therefore will not work properly. Fix this by moving the default name and owner assignment to be first in the MTD registration process. [Note: this does not fix all reported issues, particularly with NAND drivers. Will require an additional fix for drivers/mtd/nand/] Fixes: 807f16d4 ("mtd: core: set some defaults when dev.parent is set") Reported-by:
Heiko Schocher <hs@denx.de> Signed-off-by:
Brian Norris <computersforpeace@gmail.com> Cc: Heiko Schocher <hs@denx.de> Cc: Frans Klaver <fransklaver@gmail.com>
-
- 09 Dec, 2015 3 commits
-
-
Brian Norris authored
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 <computersforpeace@gmail.com> Reviewed-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
Brian Norris authored
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 <computersforpeace@gmail.com>
-
Brian Norris authored
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 <computersforpeace@gmail.com> Reviewed-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-
- 12 Nov, 2015 1 commit
-
-
Brian Norris authored
We now stick the device node representing the current MTD (if any) into sysfs, so let's make sure we have a reference to it before doing that. Suggested-by:
Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by:
Brian Norris <computersforpeace@gmail.com> Reviewed-by:
Boris Brezillon <boris.brezillon@free-electrons.com>
-