Skip to contentSkip to conversation

mtd, ubi, ubifs: resync with Linux-3.14

PATCH Superseded Heiko Schocher 5 participants 30 messages Jun 17, 2014 – Jul 7, 2014

Subsystems (10)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

resync mtd, ubi and ubifs subsystem with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

Main reason for this sync is, we now have UBI fastmap support in U-Boot.

Tested it on am33xx, imx6 and mpc83xx boards. MAKEALL for arm, mips and powerpc compiles clean.

Tested UBI fastmap on a board with 512 MiB nand flash. Attach time from old U-Boot was 2 seconds, reduced with UBI fastmap to 0.2 seconds.

Please test this patchserie!

The patches

lib, rbtree: resync with Linux-3.14
lib, list_sort: add list_sort from linux 3.14
mtd, ubi, ubifs: resync with Linux-3.14

are not checkpatch clean, as they use code from Linux and I do not want to change this.

Remarks:
- UBI Fastmap is now availiable in U-Boot
activate it with CONFIG_MTD_UBI_FASTMAP

- replace UBI_LINUX in current UBI code from U-Boot with __UBOOT__ as this define is used in other places in U-Boot where code from other projects is used.

- move a lot of defines from include/ubi_uboot.h to include/linux/compat.h, as this is the correcter place for it.

- add usb device to linux device, so usb uses "struct device" from "linux/compat.h"

- onenand changes only compile tested.

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

+#ifndef __UBOOT__

        /* Reject writes, which are not page aligned */
        if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {

+else
+ /* Reject writes, which are not page aligned */
+ if (NOTALIGNED(to)) {
+endif

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code (only compile tested)

- Documented the config defines in README

- kmalloc now uses memalign for allocating memory. This prevented crashes when tested ubi/ubifs on imx6 board.

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

Then squashed this three patches to this patch, to not break bisectability. To make further sync with linux easier, the above three patches can be found in:

http://git.denx.de/?p=u-boot/u-boot-testing.git;a=shortlog;h=refs/heads/update-mtd%2Bubi-linux-v3.14

This branch is only thought for further linux syncs! Please do not use this branch for testing this patchseries!

- Hope I get all U-Boot specific changes ... so please, test, test, test ...

- changes for v2:
- add lib/linux_compat.c as Joerg Krause detected

- changes for v3:
- patch:
Patchwork [U-Boot,RFC,v2,1/4] dm: rename device struct to udevice
http://patchwork.ozlabs.org/patch/351422/
not longer needed, as it found its way into mainline
- add in the commit message the description, how this sync patch with linux was done, as Marek and Tom suggested.
- rebase with current U-Boot commit

    61e76f53708cf082ef9061a140b57df3513b8ba1

- changes for v4:
- rebase with commit d8a97f934c64a7ba6f11da5e4cc7f3be57fcb82d
- remove compile error for mips, as Tom Rini suggested check "MAKEALL mips" compiles clean
- fix blackfin and microblaze compile
add fix for blackfin from Trom Rini also add his Signed-off-by

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Joerg Krause <[email protected]>

Heiko Schocher (3):
lib, rbtree: resync with Linux-3.14
lib, list_sort: add list_sort from linux 3.14
mtd, ubi, ubifs: resync with Linux-3.14

 README                              |   61 +
 board/prodrive/alpr/nand.c          |    4 +
 board/socrates/nand.c               |    6 +
 board/tqc/tqm8272/nand.c            |    4 +
 common/cmd_ubi.c                    |   29 +-
 common/cmd_ubifs.c                  |    2 +-
 drivers/mtd/mtdconcat.c             |  230 ++-
 drivers/mtd/mtdcore.c               | 1112 ++++++++++++-
 drivers/mtd/mtdcore.h               |   23 +
 drivers/mtd/mtdpart.c               |  521 +++++-
 drivers/mtd/nand/fsl_elbc_nand.c    |    4 +
 drivers/mtd/nand/fsl_ifc_nand.c     |    4 +
 drivers/mtd/nand/fsl_upm.c          |    4 +
 drivers/mtd/nand/mpc5121_nfc.c      |    4 +
 drivers/mtd/nand/mxc_nand.c         |    8 +
 drivers/mtd/nand/nand_base.c        | 1897 +++++++++++++++------
 drivers/mtd/nand/nand_bbt.c         |  296 ++--
 drivers/mtd/nand/nand_ids.c         |  256 +--
 drivers/mtd/nand/nand_util.c        |    3 +
 drivers/mtd/nand/ndfc.c             |    4 +
 drivers/mtd/onenand/onenand_base.c  |    1 +
 drivers/mtd/onenand/onenand_bbt.c   |    1 -
 drivers/mtd/onenand/samsung.c       |   10 +-
 drivers/mtd/ubi/Makefile            |    3 +-
 drivers/mtd/ubi/attach.c            | 1754 ++++++++++++++++++++
 drivers/mtd/ubi/build.c             |  812 ++++++---
 drivers/mtd/ubi/crc32.c             |   13 +-
 drivers/mtd/ubi/crc32table.h        |    2 +-
 drivers/mtd/ubi/debug.c             |  482 ++++--
 drivers/mtd/ubi/debug.h             |  178 +-
 drivers/mtd/ubi/eba.c               |  474 ++++--
 drivers/mtd/ubi/fastmap.c           | 1584 ++++++++++++++++++
 drivers/mtd/ubi/io.c                |  788 +++++----
 drivers/mtd/ubi/kapi.c              |  276 ++-
 drivers/mtd/ubi/misc.c              |   58 +-
 drivers/mtd/ubi/scan.c              | 1348 ---------------
 drivers/mtd/ubi/scan.h              |  153 --
 drivers/mtd/ubi/ubi-media.h         |  205 ++-
 drivers/mtd/ubi/ubi.h               |  626 +++++--
 drivers/mtd/ubi/upd.c               |  104 +-
 drivers/mtd/ubi/vmt.c               |  283 ++--
 drivers/mtd/ubi/vtbl.c              |  359 ++--
 drivers/mtd/ubi/wl.c                | 1590 +++++++++++-------
 drivers/usb/gadget/ether.c          |    5 -
 drivers/usb/gadget/storage_common.c |    5 -
 drivers/usb/musb-new/linux-compat.h |   58 -
 drivers/video/exynos_dp.c           |    1 +
 drivers/video/exynos_mipi_dsi.c     |    1 +
 fs/ubifs/budget.c                   |  662 +++++++-
 fs/ubifs/debug.c                    | 3132 ++++++++++++++++++++++++++++++++++-
 fs/ubifs/debug.h                    |  578 ++++---
 fs/ubifs/io.c                       |  897 +++++++++-
 fs/ubifs/key.h                      |   68 +-
 fs/ubifs/log.c                      |  663 +++++++-
 fs/ubifs/lprops.c                   |  538 +++++-
 fs/ubifs/lpt.c                      | 1242 +++++++++++++-
 fs/ubifs/lpt_commit.c               | 1903 ++++++++++++++++++++-
 fs/ubifs/master.c                   |  102 +-
 fs/ubifs/misc.h                     |  159 +-
 fs/ubifs/orphan.c                   |  671 +++++++-
 fs/ubifs/recovery.c                 |  738 ++++++---
 fs/ubifs/replay.c                   |  573 ++++---
 fs/ubifs/sb.c                       |  547 +++++-
 fs/ubifs/scan.c                     |  102 +-
 fs/ubifs/super.c                    | 2173 ++++++++++++++++++++----
 fs/ubifs/tnc.c                      |  742 ++++++++-
 fs/ubifs/tnc_misc.c                 |  124 +-
 fs/ubifs/ubifs-media.h              |   62 +-
 fs/ubifs/ubifs.c                    |  115 +-
 fs/ubifs/ubifs.h                    |  708 +++++---
 fs/yaffs2/ydirectenv.h              |    2 -
 include/linux/compat.h              |  324 +++-
 include/linux/err.h                 |   15 +-
 include/linux/list_sort.h           |   11 +
 include/linux/mtd/bbm.h             |   73 +-
 include/linux/mtd/concat.h          |    4 +
 include/linux/mtd/flashchip.h       |  105 ++
 include/linux/mtd/mtd.h             |  272 ++-
 include/linux/mtd/nand.h            |  351 +++-
 include/linux/mtd/partitions.h      |   60 +-
 include/linux/mtd/ubi.h             |  120 +-
 include/linux/rbtree.h              |  147 +-
 include/linux/rbtree_augmented.h    |  220 +++
 include/linux/usb/gadget.h          |    6 +-
 include/mtd/mtd-abi.h               |  195 ++-
 include/mtd/ubi-user.h              |  305 +++-
 include/ubi_uboot.h                 |  164 +-
 include/usb/lin_gadget_compat.h     |   16 -
 lib/Makefile                        |    2 +
 lib/linux_compat.c                  |   42 +
 lib/list_sort.c                     |  298 ++++
 lib/rbtree.c                        |  684 +++++---
 92 files changed, 28065 insertions(+), 7496 deletions(-)
 create mode 100644 drivers/mtd/mtdcore.h
 create mode 100644 drivers/mtd/ubi/attach.c
 create mode 100644 drivers/mtd/ubi/fastmap.c
 delete mode 100644 drivers/mtd/ubi/scan.c
 delete mode 100644 drivers/mtd/ubi/scan.h
 create mode 100644 include/linux/list_sort.h
 create mode 100644 include/linux/mtd/flashchip.h
 create mode 100644 include/linux/rbtree_augmented.h
 create mode 100644 lib/linux_compat.c
 create mode 100644 lib/list_sort.c
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v4 1/3 lib, rbtree: resync with Linux-3.14

resync with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

Needed for the MTD/UBI/UBIFS resync

Just copied the files from Linux, changed the license file header, and add in the c-file:

+#define __UBOOT__
#include <linux/rbtree_augmented.h>
+#ifndef __UBOOT__
#include <linux/export.h>
+#else
+#include <ubi_uboot.h>
+#endif

so, it compiles for U-Boot.

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Tom Rini <[email protected]>

---
- changes for v2:
- none
- changes for v3:
- add in the commit message the description, how this sync patch with linux was done, as Marek and Tom suggested.
- changes for v4:
- none

 include/linux/rbtree.h           | 147 +++------
 include/linux/rbtree_augmented.h | 220 +++++++++++++
 lib/rbtree.c                     | 684 ++++++++++++++++++++++++---------------
 3 files changed, 698 insertions(+), 353 deletions(-)
 create mode 100644 include/linux/rbtree_augmented.h
include/linux/rbtree.h +49 -98
index ad892d1..b5994e3 100644
@@ -1,7 +1,7 @@
 /*
   Red Black Trees
   (C) 1999  Andrea Arcangeli <[email protected]>
-
+  
  * SPDX-License-Identifier:	GPL-2.0+
 
   linux/include/linux/rbtree.h
@@ -11,138 +11,89 @@
   I know it's not the cleaner way,  but in C (not in C++) to get
   performances and genericity...
 
-  Some example of insert and search follows here. The search is a plain
-  normal search over an ordered tree. The insert instead must be implemented
-  int two steps: as first thing the code must insert the element in
-  order as a red leaf in the tree, then the support library function
-  rb_insert_color() must be called. Such function will do the
-  not trivial work to rebalance the rbtree if necessary.
-
------------------------------------------------------------------------
-static inline struct page * rb_search_page_cache(struct inode * inode,
-						 unsigned long offset)
-{
-	struct rb_node * n = inode->i_rb_page_cache.rb_node;
-	struct page * page;
-
-	while (n)
-	{
-		page = rb_entry(n, struct page, rb_page_cache);
-
-		if (offset < page->offset)
-			n = n->rb_left;
-		else if (offset > page->offset)
-			n = n->rb_right;
-		else
-			return page;
-	}
-	return NULL;
-}
-
-static inline struct page * __rb_insert_page_cache(struct inode * inode,
-						   unsigned long offset,
-						   struct rb_node * node)
-{
-	struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
-	struct rb_node * parent = NULL;
-	struct page * page;
-
-	while (*p)
-	{
-		parent = *p;
-		page = rb_entry(parent, struct page, rb_page_cache);
-
-		if (offset < page->offset)
-			p = &(*p)->rb_left;
-		else if (offset > page->offset)
-			p = &(*p)->rb_right;
-		else
-			return page;
-	}
-
-	rb_link_node(node, parent, p);
-
-	return NULL;
-}
-
-static inline struct page * rb_insert_page_cache(struct inode * inode,
-						 unsigned long offset,
-						 struct rb_node * node)
-{
-	struct page * ret;
-	if ((ret = __rb_insert_page_cache(inode, offset, node)))
-		goto out;
-	rb_insert_color(node, &inode->i_rb_page_cache);
- out:
-	return ret;
-}
------------------------------------------------------------------------
+  See Documentation/rbtree.txt for documentation and samples.
 */
 
 #ifndef	_LINUX_RBTREE_H
 #define	_LINUX_RBTREE_H
 
+#define __UBOOT__
+#ifndef __UBOOT__
+#include <linux/kernel.h>
+#endif
 #include <linux/stddef.h>
 
-struct rb_node
-{
-	unsigned long  rb_parent_color;
-#define	RB_RED		0
-#define	RB_BLACK	1
+struct rb_node {
+	unsigned long  __rb_parent_color;
 	struct rb_node *rb_right;
 	struct rb_node *rb_left;
 } __attribute__((aligned(sizeof(long))));
     /* The alignment might seem pointless, but allegedly CRIS needs it */
 
-struct rb_root
-{
+struct rb_root {
 	struct rb_node *rb_node;
 };
 
 
-#define rb_parent(r)   ((struct rb_node *)((r)->rb_parent_color & ~3))
-#define rb_color(r)   ((r)->rb_parent_color & 1)
-#define rb_is_red(r)   (!rb_color(r))
-#define rb_is_black(r) rb_color(r)
-#define rb_set_red(r)  do { (r)->rb_parent_color &= ~1; } while (0)
-#define rb_set_black(r)  do { (r)->rb_parent_color |= 1; } while (0)
-
-static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
-{
-	rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
-}
-static inline void rb_set_color(struct rb_node *rb, int color)
-{
-	rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
-}
+#define rb_parent(r)   ((struct rb_node *)((r)->__rb_parent_color & ~3))
 
 #define RB_ROOT	(struct rb_root) { NULL, }
 #define	rb_entry(ptr, type, member) container_of(ptr, type, member)
 
-#define RB_EMPTY_ROOT(root)	((root)->rb_node == NULL)
-#define RB_EMPTY_NODE(node)	(rb_parent(node) == node)
-#define RB_CLEAR_NODE(node)	(rb_set_parent(node, node))
+#define RB_EMPTY_ROOT(root)  ((root)->rb_node == NULL)
+
+/* 'empty' nodes are nodes that are known not to be inserted in an rbree */
+#define RB_EMPTY_NODE(node)  \
+	((node)->__rb_parent_color == (unsigned long)(node))
+#define RB_CLEAR_NODE(node)  \
+	((node)->__rb_parent_color = (unsigned long)(node))
+
 
 extern void rb_insert_color(struct rb_node *, struct rb_root *);
 extern void rb_erase(struct rb_node *, struct rb_root *);
 
+
 /* Find logical next and previous nodes in a tree */
-extern struct rb_node *rb_next(struct rb_node *);
-extern struct rb_node *rb_prev(struct rb_node *);
-extern struct rb_node *rb_first(struct rb_root *);
-extern struct rb_node *rb_last(struct rb_root *);
+extern struct rb_node *rb_next(const struct rb_node *);
+extern struct rb_node *rb_prev(const struct rb_node *);
+extern struct rb_node *rb_first(const struct rb_root *);
+extern struct rb_node *rb_last(const struct rb_root *);
+
+/* Postorder iteration - always visit the parent after its children */
+extern struct rb_node *rb_first_postorder(const struct rb_root *);
+extern struct rb_node *rb_next_postorder(const struct rb_node *);
 
 /* Fast replacement of a single node without remove/rebalance/add/rebalance */
-extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
+extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 
 			    struct rb_root *root);
 
 static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
 				struct rb_node ** rb_link)
 {
-	node->rb_parent_color = (unsigned long )parent;
+	node->__rb_parent_color = (unsigned long)parent;
 	node->rb_left = node->rb_right = NULL;
 
 	*rb_link = node;
 }
 
+#define rb_entry_safe(ptr, type, member) \
+	({ typeof(ptr) ____ptr = (ptr); \
+	   ____ptr ? rb_entry(____ptr, type, member) : NULL; \
+	})
+
+/**
+ * rbtree_postorder_for_each_entry_safe - iterate over rb_root in post order of
+ * given type safe against removal of rb_node entry
+ *
+ * @pos:	the 'type *' to use as a loop cursor.
+ * @n:		another 'type *' to use as temporary storage
+ * @root:	'rb_root *' of the rbtree.
+ * @field:	the name of the rb_node field within 'type'.
+ */
+#define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \
+	for (pos = rb_entry_safe(rb_first_postorder(root), typeof(*pos), field); \
+	     pos && ({ n = rb_entry_safe(rb_next_postorder(&pos->field), \
+			typeof(*pos), field); 1; }); \
+	     pos = n)
+
 #endif	/* _LINUX_RBTREE_H */
include/linux/rbtree_augmented.h new file +220 -0

220 lines not on this page · raw message

lib/rbtree.c +429 -255

795 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v4 2/3 lib, list_sort: add list_sort from linux 3.14

In reply to Heiko Schocher

from linux 3.14:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

Needed for the MTD/UBI/UBIFS resync

Just copied the files from Linux, and added in the c-file the "#define __UBOOT__" for adding U-Boot special code. In this case we use this just for adding including U-Boot headers.

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Tom Rini <[email protected]>

---
- changes for v2:
- none
- changes for v3:
- add in the commit message the description, how this sync with linux patch was done, as Marek and Tom suggested.
- changes for v4:
- none

 include/linux/list_sort.h |  11 ++
 lib/Makefile              |   1 +
 lib/list_sort.c           | 298 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 310 insertions(+)
 create mode 100644 include/linux/list_sort.h
 create mode 100644 lib/list_sort.c
include/linux/list_sort.h new file +11 -0
new file mode 100644
index 0000000..1a2df2e
@@ -0,0 +1,11 @@
+#ifndef _LINUX_LIST_SORT_H
+#define _LINUX_LIST_SORT_H
+
+#include <linux/types.h>
+
+struct list_head;
+
+void list_sort(void *priv, struct list_head *head,
+	       int (*cmp)(void *priv, struct list_head *a,
+			  struct list_head *b));
+#endif
lib/Makefile +1 -0
index 377ab13..37030a4 100644
@@ -41,6 +41,7 @@ obj-y	+= strmhz.o
 obj-$(CONFIG_TPM) += tpm.o
 obj-$(CONFIG_RBTREE)	+= rbtree.o
 obj-$(CONFIG_BITREVERSE) += bitrev.o
+obj-y += list_sort.o
 endif
 
 ifdef CONFIG_SPL_BUILD
lib/list_sort.c new file +298 -0

298 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v4 3/3 mtd, ubi, ubifs: resync with Linux-3.14

In reply to Heiko Schocher

resync ubi subsystem with linux:

commit 455c6fdbd219161bd09b1165f11699d6d73de11c

Author: Linus Torvalds <[email protected]>
Date:   Sun Mar 30 20:40:15 2014 -0700
    Linux 3.14

A nice side effect of this, is we introduce UBI Fastmap support to U-Boot.

- adapt the Linux code to compile and work with U-Boot.

- replace UBI_LINUX in current UBI code from U-Boot with __UBOOT__ as this define is used in other places in U-Boot where code from other projects is used.

- move a lot of defines from include/ubi_uboot.h to include/linux/compat.h, as this is the correct place for it.

- UBI Fastmap is now availiable in U-Boot
activate it with CONFIG_MTD_UBI_FASTMAP

- add usb device to linux device, so usb uses "struct device" from "linux/compat.h"

- onenand changes only compile tested.

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

+#ifndef __UBOOT__

        /* Reject writes, which are not page aligned */
        if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {

+else
+ /* Reject writes, which are not page aligned */
+ if (NOTALIGNED(to)) {
+endif

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code

- Documented the config defines in README

- kmalloc now uses memalign for allocating memory

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

Then squash this three patches to this patch, to not break bisectability. To make further sync with linux easier, the above three patches can be found in:

http://git.denx.de/?p=u-boot/u-boot-testing.git;a=shortlog;h=refs/heads/update-mtd%2Bubi-linux-v3.14

Please do not use this branch for testing this patchserie!

Cc Marek Vasut <[email protected]>
Cc Sergey Lapin <[email protected]>
Cc Scott Wood <[email protected]>
Cc Joerg Krause <[email protected]>
Cc Wolfgang Denk <[email protected]>

---

Tested it on am33xx, imx6 and mpc83xx boards. MAKEALL for arm and powerpc and mips, compiles clean.

Tested UBI fastmap on a board with 512 MiB nand flash. Attach time from old U-Boot was 2 seconds, reduced with UBI fastmap to 0.2 seconds.

- changes for v2:
- add lib/linux_compat.c as Joerg Krause detected

- changes for v3:
rebase with current U-Boot commit
61e76f53708cf082ef9061a140b57df3513b8ba1

- changes for v4:
- rebase with commit d8a97f934c64a7ba6f11da5e4cc7f3be57fcb82d
- remove compile error for mips, as Tom Rini suggested check "MAKEALL mips" compiles clean
- fix blackfin and microblaze compile
add fix for blackfin from Trom Rini also add his Signed-off-by

 README                              |   61 +
 board/prodrive/alpr/nand.c          |    4 +
 board/socrates/nand.c               |    6 +
 board/tqc/tqm8272/nand.c            |    4 +
 common/cmd_ubi.c                    |   29 +-
 common/cmd_ubifs.c                  |    2 +-
 drivers/mtd/mtdconcat.c             |  230 ++-
 drivers/mtd/mtdcore.c               | 1112 ++++++++++++-
 drivers/mtd/mtdcore.h               |   23 +
 drivers/mtd/mtdpart.c               |  521 +++++-
 drivers/mtd/nand/fsl_elbc_nand.c    |    4 +
 drivers/mtd/nand/fsl_ifc_nand.c     |    4 +
 drivers/mtd/nand/fsl_upm.c          |    4 +
 drivers/mtd/nand/mpc5121_nfc.c      |    4 +
 drivers/mtd/nand/mxc_nand.c         |    8 +
 drivers/mtd/nand/nand_base.c        | 1897 +++++++++++++++------
 drivers/mtd/nand/nand_bbt.c         |  296 ++--
 drivers/mtd/nand/nand_ids.c         |  256 +--
 drivers/mtd/nand/nand_util.c        |    3 +
 drivers/mtd/nand/ndfc.c             |    4 +
 drivers/mtd/onenand/onenand_base.c  |    1 +
 drivers/mtd/onenand/onenand_bbt.c   |    1 -
 drivers/mtd/onenand/samsung.c       |   10 +-
 drivers/mtd/ubi/Makefile            |    3 +-
 drivers/mtd/ubi/attach.c            | 1754 ++++++++++++++++++++
 drivers/mtd/ubi/build.c             |  812 ++++++---
 drivers/mtd/ubi/crc32.c             |   13 +-
 drivers/mtd/ubi/crc32table.h        |    2 +-
 drivers/mtd/ubi/debug.c             |  482 ++++--
 drivers/mtd/ubi/debug.h             |  178 +-
 drivers/mtd/ubi/eba.c               |  474 ++++--
 drivers/mtd/ubi/fastmap.c           | 1584 ++++++++++++++++++
 drivers/mtd/ubi/io.c                |  788 +++++----
 drivers/mtd/ubi/kapi.c              |  276 ++-
 drivers/mtd/ubi/misc.c              |   58 +-
 drivers/mtd/ubi/scan.c              | 1348 ---------------
 drivers/mtd/ubi/scan.h              |  153 --
 drivers/mtd/ubi/ubi-media.h         |  205 ++-
 drivers/mtd/ubi/ubi.h               |  626 +++++--
 drivers/mtd/ubi/upd.c               |  104 +-
 drivers/mtd/ubi/vmt.c               |  283 ++--
 drivers/mtd/ubi/vtbl.c              |  359 ++--
 drivers/mtd/ubi/wl.c                | 1590 +++++++++++-------
 drivers/usb/gadget/ether.c          |    5 -
 drivers/usb/gadget/storage_common.c |    5 -
 drivers/usb/musb-new/linux-compat.h |   58 -
 drivers/video/exynos_dp.c           |    1 +
 drivers/video/exynos_mipi_dsi.c     |    1 +
 fs/ubifs/budget.c                   |  662 +++++++-
 fs/ubifs/debug.c                    | 3132 ++++++++++++++++++++++++++++++++++-
 fs/ubifs/debug.h                    |  578 ++++---
 fs/ubifs/io.c                       |  897 +++++++++-
 fs/ubifs/key.h                      |   68 +-
 fs/ubifs/log.c                      |  663 +++++++-
 fs/ubifs/lprops.c                   |  538 +++++-
 fs/ubifs/lpt.c                      | 1242 +++++++++++++-
 fs/ubifs/lpt_commit.c               | 1903 ++++++++++++++++++++-
 fs/ubifs/master.c                   |  102 +-
 fs/ubifs/misc.h                     |  159 +-
 fs/ubifs/orphan.c                   |  671 +++++++-
 fs/ubifs/recovery.c                 |  738 ++++++---
 fs/ubifs/replay.c                   |  573 ++++---
 fs/ubifs/sb.c                       |  547 +++++-
 fs/ubifs/scan.c                     |  102 +-
 fs/ubifs/super.c                    | 2173 ++++++++++++++++++++----
 fs/ubifs/tnc.c                      |  742 ++++++++-
 fs/ubifs/tnc_misc.c                 |  124 +-
 fs/ubifs/ubifs-media.h              |   62 +-
 fs/ubifs/ubifs.c                    |  115 +-
 fs/ubifs/ubifs.h                    |  708 +++++---
 fs/yaffs2/ydirectenv.h              |    2 -
 include/linux/compat.h              |  324 +++-
 include/linux/err.h                 |   15 +-
 include/linux/mtd/bbm.h             |   73 +-
 include/linux/mtd/concat.h          |    4 +
 include/linux/mtd/flashchip.h       |  105 ++
 include/linux/mtd/mtd.h             |  272 ++-
 include/linux/mtd/nand.h            |  351 +++-
 include/linux/mtd/partitions.h      |   60 +-
 include/linux/mtd/ubi.h             |  120 +-
 include/linux/usb/gadget.h          |    6 +-
 include/mtd/mtd-abi.h               |  195 ++-
 include/mtd/ubi-user.h              |  305 +++-
 include/ubi_uboot.h                 |  164 +-
 include/usb/lin_gadget_compat.h     |   16 -
 lib/Makefile                        |    1 +
 lib/linux_compat.c                  |   42 +
 87 files changed, 27057 insertions(+), 7143 deletions(-)
 create mode 100644 drivers/mtd/mtdcore.h
 create mode 100644 drivers/mtd/ubi/attach.c
 create mode 100644 drivers/mtd/ubi/fastmap.c
 delete mode 100644 drivers/mtd/ubi/scan.c
 delete mode 100644 drivers/mtd/ubi/scan.h
 create mode 100644 include/linux/mtd/flashchip.h
 create mode 100644 lib/linux_compat.c
README +61 -0
index 02f47a7..b94a19b 100644
@@ -3276,6 +3276,9 @@ FIT uImage format:
 		Adds the MTD partitioning infrastructure from the Linux
 		kernel. Needed for UBI support.
 
+		CONFIG_MTD_NAND_VERIFY_WRITE
+		verify if the written data is correct reread.
+
 - UBI support
 		CONFIG_CMD_UBI
 
@@ -3289,6 +3292,64 @@ FIT uImage format:
 		Make the verbose messages from UBI stop printing.  This leaves
 		warnings and errors enabled.
 
+
+		CONFIG_MTD_UBI_WL_THRESHOLD
+		This parameter defines the maximum difference between the highest
+		erase counter value and the lowest erase counter value of eraseblocks
+		of UBI devices. When this threshold is exceeded, UBI starts performing
+		wear leveling by means of moving data from eraseblock with low erase
+		counter to eraseblocks with high erase counter.
+
+		The default value should be OK for SLC NAND flashes, NOR flashes and
+		other flashes which have eraseblock life-cycle 100000 or more.
+		However, in case of MLC NAND flashes which typically have eraseblock
+		life-cycle less than 10000, the threshold should be lessened (e.g.,
+		to 128 or 256, although it does not have to be power of 2).
+
+		default: 4096
+		
+		CONFIG_MTD_UBI_BEB_LIMIT
+		This option specifies the maximum bad physical eraseblocks UBI
+		expects on the MTD device (per 1024 eraseblocks). If the
+		underlying flash does not admit of bad eraseblocks (e.g. NOR
+		flash), this value is ignored.
+
+		NAND datasheets often specify the minimum and maximum NVM
+		(Number of Valid Blocks) for the flashes' endurance lifetime.
+		The maximum expected bad eraseblocks per 1024 eraseblocks
+		then can be calculated as "1024 * (1 - MinNVB / MaxNVB)",
+		which gives 20 for most NANDs (MaxNVB is basically the total
+		count of eraseblocks on the chip).
+
+		To put it differently, if this value is 20, UBI will try to
+		reserve about 1.9% of physical eraseblocks for bad blocks
+		handling. And that will be 1.9% of eraseblocks on the entire
+		NAND chip, not just the MTD partition UBI attaches. This means
+		that if you have, say, a NAND flash chip admits maximum 40 bad
+		eraseblocks, and it is split on two MTD partitions of the same
+		size, UBI will reserve 40 eraseblocks when attaching a
+		partition.
+
+		default: 20
+
+		CONFIG_MTD_UBI_FASTMAP
+		Fastmap is a mechanism which allows attaching an UBI device
+		in nearly constant time. Instead of scanning the whole MTD device it
+		only has to locate a checkpoint (called fastmap) on the device.
+		The on-flash fastmap contains all information needed to attach
+		the device. Using fastmap makes only sense on large devices where
+		attaching by scanning takes long. UBI will not automatically install
+		a fastmap on old images, but you can set the UBI parameter
+		CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT to 1 if you want so. Please note
+		that fastmap-enabled images are still usable with UBI implementations
+		without	fastmap support. On typical flash devices the whole fastmap
+		fits into one PEB. UBI will reserve PEBs to hold two fastmaps.
+
+		CONFIG_MTD_UBI_FASTMAP_AUTOCONVERT
+		Set this parameter to enable fastmap automatically on images
+		without a fastmap.
+		default: 0
+
 - UBIFS support
 		CONFIG_CMD_UBIFS
 
board/prodrive/alpr/nand.c +4 -0
index 50e8d82..5427de5 100644
@@ -93,6 +93,7 @@ static void alpr_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	}
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int alpr_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -103,6 +104,7 @@ static int alpr_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len
 
 	return 0;
 }
+#endif
 
 static int alpr_nand_dev_ready(struct mtd_info *mtd)
 {
@@ -128,7 +130,9 @@ int board_nand_init(struct nand_chip *nand)
 	nand->read_byte  = alpr_nand_read_byte;
 	nand->write_buf  = alpr_nand_write_buf;
 	nand->read_buf   = alpr_nand_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = alpr_nand_verify_buf;
+#endif
 	nand->dev_ready  = alpr_nand_dev_ready;
 
 	return 0;
board/socrates/nand.c +6 -0
index 3802c7e..7394478 100644
@@ -18,7 +18,9 @@ static void sc_nand_write_buf(struct mtd_info *mtd, const u_char *buf, int len);
 static u_char sc_nand_read_byte(struct mtd_info *mtd);
 static u16 sc_nand_read_word(struct mtd_info *mtd);
 static void sc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len);
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int sc_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len);
+#endif
 static int sc_nand_device_ready(struct mtd_info *mtdinfo);
 
 #define FPGA_NAND_CMD_MASK		(0x7 << 28)
@@ -100,6 +102,7 @@ static void sc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	}
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /**
  * sc_nand_verify_buf -  Verify chip data against buffer
  * @mtd:	MTD device structure
@@ -116,6 +119,7 @@ static int sc_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 	}
 	return 0;
 }
+#endif
 
 /**
  * sc_nand_device_ready - Check the NAND device is ready for next command.
@@ -174,7 +178,9 @@ int board_nand_init(struct nand_chip *nand)
 	nand->read_word = sc_nand_read_word;
 	nand->write_buf = sc_nand_write_buf;
 	nand->read_buf = sc_nand_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = sc_nand_verify_buf;
+#endif
 
 	return 0;
 }
board/tqc/tqm8272/nand.c +4 -0
index 4925b8d..7fb2dfa 100644
@@ -188,6 +188,7 @@ static void tqm8272_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int
 		*base = buf[i];
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
 {
 	struct nand_chip *this = mtdinfo->priv;
@@ -199,6 +200,7 @@ static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int
 			return -1;
 	return 0;
 }
+#endif
 #endif /* #ifndef CONFIG_NAND_SPL */
 
 void board_nand_select_device(struct nand_chip *nand, int chip)
@@ -247,8 +249,10 @@ int board_nand_init(struct nand_chip *nand)
 #ifndef CONFIG_NAND_SPL
 	nand->write_buf	 = tqm8272_write_buf;
 	nand->read_buf	 = tqm8272_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = tqm8272_verify_buf;
 #endif
+#endif
 
 	/*
 	 * Select required NAND chip
common/cmd_ubi.c +1 -28
index 7c4d950..7171690 100644
@@ -19,6 +19,7 @@
 #include <onenand_uboot.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/err.h>
 #include <ubi_uboot.h>
 #include <asm/errno.h>
 #include <jffs2/load_kernel.h>
@@ -50,33 +51,6 @@ int ubifs_is_mounted(void);
 void cmd_ubifs_umount(void);
 #endif
 
-static void ubi_dump_vol_info(const struct ubi_volume *vol)
-{
-	ubi_msg("volume information dump:");
-	ubi_msg("vol_id          %d", vol->vol_id);
-	ubi_msg("reserved_pebs   %d", vol->reserved_pebs);
-	ubi_msg("alignment       %d", vol->alignment);
-	ubi_msg("data_pad        %d", vol->data_pad);
-	ubi_msg("vol_type        %d", vol->vol_type);
-	ubi_msg("name_len        %d", vol->name_len);
-	ubi_msg("usable_leb_size %d", vol->usable_leb_size);
-	ubi_msg("used_ebs        %d", vol->used_ebs);
-	ubi_msg("used_bytes      %lld", vol->used_bytes);
-	ubi_msg("last_eb_bytes   %d", vol->last_eb_bytes);
-	ubi_msg("corrupted       %d", vol->corrupted);
-	ubi_msg("upd_marker      %d", vol->upd_marker);
-
-	if (vol->name_len <= UBI_VOL_NAME_MAX &&
-		strnlen(vol->name, vol->name_len + 1) == vol->name_len) {
-		ubi_msg("name            %s", vol->name);
-	} else {
-		ubi_msg("the 1st 5 characters of the name: %c%c%c%c%c",
-				vol->name[0], vol->name[1], vol->name[2],
-				vol->name[3], vol->name[4]);
-	}
-	printf("\n");
-}
-
 static void display_volume_info(struct ubi_device *ubi)
 {
 	int i;
@@ -316,7 +290,6 @@ int ubi_volume_continue_write(char *volume, void *buf, size_t size)
 		}
 
 		vol->checked = 1;
-		ubi_gluebi_updated(vol);
 	}
 
 	return 0;
common/cmd_ubifs.c +1 -1
index fdc8bfe..0baa827 100644
@@ -37,7 +37,7 @@ int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		ubifs_initialized = 1;
 	}
 
-	ret = ubifs_mount(vol_name);
+	ret = uboot_ubifs_mount(vol_name);
 	if (ret)
 		return -1;
 
drivers/mtd/mtdconcat.c +215 -15

375 lines not on this page · raw message

drivers/mtd/mtdcore.c +1040 -72

1,291 lines not on this page · raw message

drivers/mtd/mtdcore.h new file +23 -0
new file mode 100644
index 0000000..7b03533
@@ -0,0 +1,23 @@
+/*
+ * These are exported solely for the purpose of mtd_blkdevs.c and mtdchar.c.
+ * You should not use them for _anything_ else.
+ */
+
+extern struct mutex mtd_table_mutex;
+
+struct mtd_info *__mtd_next_device(int i);
+int add_mtd_device(struct mtd_info *mtd);
+int del_mtd_device(struct mtd_info *mtd);
+int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
+int del_mtd_partitions(struct mtd_info *);
+int parse_mtd_partitions(struct mtd_info *master, const char * const *types,
+			 struct mtd_partition **pparts,
+			 struct mtd_part_parser_data *data);
+
+int __init init_mtdchar(void);
+void __exit cleanup_mtdchar(void);
+
+#define mtd_for_each_device(mtd)			\
+	for ((mtd) = __mtd_next_device(0);		\
+	     (mtd) != NULL;				\
+	     (mtd) = __mtd_next_device(mtd->index + 1))
drivers/mtd/mtdpart.c +453 -68

759 lines not on this page · raw message

drivers/mtd/nand/fsl_elbc_nand.c +4 -0
index 2f31fc9..7e1e6ec 100644
@@ -561,6 +561,7 @@ static void fsl_elbc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
 		       len, avail);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /*
  * Verify buffer against the FCM Controller Data Buffer
  */
@@ -593,6 +594,7 @@ static int fsl_elbc_verify_buf(struct mtd_info *mtd,
 	ctrl->index += len;
 	return i == len && ctrl->status == LTESR_CC ? 0 : -EIO;
 }
+#endif
 
 /* This function is called after Program and Erase Operations to
  * check for success or failure.
@@ -725,7 +727,9 @@ static int fsl_elbc_chip_init(int devnum, u8 *addr)
 	nand->read_byte = fsl_elbc_read_byte;
 	nand->write_buf = fsl_elbc_write_buf;
 	nand->read_buf = fsl_elbc_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = fsl_elbc_verify_buf;
+#endif
 	nand->select_chip = fsl_elbc_select_chip;
 	nand->cmdfunc = fsl_elbc_cmdfunc;
 	nand->waitfunc = fsl_elbc_wait;
drivers/mtd/nand/fsl_ifc_nand.c +4 -0
index be5a16a..a8d0b20 100644
@@ -681,6 +681,7 @@ static void fsl_ifc_read_buf(struct mtd_info *mtd, u8 *buf, int len)
 		       __func__, len, avail);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /*
  * Verify buffer against the IFC Controller Data Buffer
  */
@@ -713,6 +714,7 @@ static int fsl_ifc_verify_buf(struct mtd_info *mtd,
 	ctrl->index += len;
 	return i == len && ctrl->status == IFC_NAND_EVTER_STAT_OPC ? 0 : -EIO;
 }
+#endif
 
 /* This function is called after Program and Erase Operations to
  * check for success or failure.
@@ -911,7 +913,9 @@ static int fsl_ifc_chip_init(int devnum, u8 *addr)
 
 	nand->write_buf = fsl_ifc_write_buf;
 	nand->read_buf = fsl_ifc_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	nand->verify_buf = fsl_ifc_verify_buf;
+#endif
 	nand->select_chip = fsl_ifc_select_chip;
 	nand->cmdfunc = fsl_ifc_cmdfunc;
 	nand->waitfunc = fsl_ifc_wait;
drivers/mtd/nand/fsl_upm.c +4 -0
index 3ae0044..65ce98a 100644
@@ -153,6 +153,7 @@ static void upm_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 		buf[i] = in_8(chip->IO_ADDR_R);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int upm_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 {
 	int i;
@@ -165,6 +166,7 @@ static int upm_nand_verify_buf(struct mtd_info *mtd, const u_char *buf, int len)
 
 	return 0;
 }
+#endif
 
 static int nand_dev_ready(struct mtd_info *mtd)
 {
@@ -191,7 +193,9 @@ int fsl_upm_nand_init(struct nand_chip *chip, struct fsl_upm_nand *fun)
 	chip->read_byte = upm_nand_read_byte;
 	chip->read_buf = upm_nand_read_buf;
 	chip->write_buf = upm_nand_write_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	chip->verify_buf = upm_nand_verify_buf;
+#endif
 	if (fun->dev_ready)
 		chip->dev_ready = nand_dev_ready;
 
drivers/mtd/nand/mpc5121_nfc.c +4 -0
index d0f3a35..7233bfc 100644
@@ -459,6 +459,7 @@ static void mpc5121_nfc_write_buf(struct mtd_info *mtd,
 	mpc5121_nfc_buf_copy(mtd, (u_char *) buf, len, 1);
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /* Compare buffer with NAND flash */
 static int mpc5121_nfc_verify_buf(struct mtd_info *mtd,
 				  const u_char * buf, int len)
@@ -479,6 +480,7 @@ static int mpc5121_nfc_verify_buf(struct mtd_info *mtd,
 
 	return 0;
 }
+#endif
 
 /* Read byte from NFC buffers */
 static u8 mpc5121_nfc_read_byte(struct mtd_info *mtd)
@@ -607,7 +609,9 @@ int board_nand_init(struct nand_chip *chip)
 	chip->read_word = mpc5121_nfc_read_word;
 	chip->read_buf = mpc5121_nfc_read_buf;
 	chip->write_buf = mpc5121_nfc_write_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	chip->verify_buf = mpc5121_nfc_verify_buf;
+#endif
 	chip->select_chip = mpc5121_nfc_select_chip;
 	chip->bbt_options = NAND_BBT_USE_FLASH;
 	chip->ecc.mode = NAND_ECC_SOFT;
drivers/mtd/nand/mxc_nand.c +8 -0
index ed0ca3a..2e5b5b9 100644
@@ -949,6 +949,8 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
 	host->col_addr = col;
 }
 
+#ifdef __UBOOT__
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /*
  * Used by the upper layer to verify the data in NAND Flash
  * with the data in the buf.
@@ -972,6 +974,8 @@ static int mxc_nand_verify_buf(struct mtd_info *mtd,
 
 	return 0;
 }
+#endif
+#endif
 
 /*
  * This function is used by upper layer for select and
@@ -1203,7 +1207,11 @@ int board_nand_init(struct nand_chip *this)
 	this->read_word = mxc_nand_read_word;
 	this->write_buf = mxc_nand_write_buf;
 	this->read_buf = mxc_nand_read_buf;
+#ifdef __UBOOT__
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 	this->verify_buf = mxc_nand_verify_buf;
+#endif
+#endif
 
 	host->regs = (struct mxc_nand_regs __iomem *)CONFIG_MXC_NAND_REGS_BASE;
 #ifdef MXC_NFC_V3_2
drivers/mtd/nand/nand_base.c +1376 -521

226 lines not on this page · raw message

drivers/mtd/nand/nand_bbt.c +141 -155

296 lines not on this page · raw message

drivers/mtd/nand/nand_ids.c +131 -125

256 lines not on this page · raw message

drivers/mtd/nand/nand_util.c +3 -0
index b292826..024f6fb 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/nand/ndfc.c +4 -0
index 5510b13..2659595 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/onenand/onenand_base.c +1 -0
index e33e8d3..03deabc 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/onenand/onenand_bbt.c +0 -1
index 0267c2c..52509f1 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/onenand/samsung.c +1 -9
index df04c2b..5e56a29 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/Makefile +2 -1
index 56c2823..4807f94 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/attach.c new file +1754 -0

1,754 lines not on this page · raw message

drivers/mtd/ubi/build.c +586 -226

812 lines not on this page · raw message

drivers/mtd/ubi/crc32.c +7 -6
index f1bebf5..0d65bf4 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/crc32table.h +1 -1
index 0438af4..02ce6fd 100644

Lines of this file are not shown. View the raw message.

drivers/mtd/ubi/debug.c +381 -101

482 lines not on this page · raw message

drivers/mtd/ubi/debug.h +83 -95

178 lines not on this page · raw message

drivers/mtd/ubi/eba.c +315 -159

474 lines not on this page · raw message

drivers/mtd/ubi/fastmap.c new file +1584 -0

1,584 lines not on this page · raw message

drivers/mtd/ubi/io.c +473 -315

788 lines not on this page · raw message

drivers/mtd/ubi/kapi.c +219 -57

276 lines not on this page · raw message

drivers/mtd/ubi/misc.c +53 -5

58 lines not on this page · raw message

drivers/mtd/ubi/scan.c deleted +0 -1348

1,348 lines not on this page · raw message

drivers/mtd/ubi/scan.h deleted +0 -153

153 lines not on this page · raw message

drivers/mtd/ubi/ubi-media.h +176 -29

205 lines not on this page · raw message

drivers/mtd/ubi/ubi.h +496 -130

626 lines not on this page · raw message

drivers/mtd/ubi/upd.c +53 -51

104 lines not on this page · raw message

drivers/mtd/ubi/vmt.c +147 -136

283 lines not on this page · raw message

drivers/mtd/ubi/vtbl.c +200 -159

359 lines not on this page · raw message

drivers/mtd/ubi/wl.c +1033 -557

1,590 lines not on this page · raw message

drivers/usb/gadget/ether.c +0 -5
index cc6cc1f..d0dd29f 100644

Lines of this file are not shown. View the raw message.

drivers/usb/gadget/storage_common.c +0 -5
index 02803df..b55e40b 100644

Lines of this file are not shown. View the raw message.

drivers/usb/musb-new/linux-compat.h +0 -58

58 lines not on this page · raw message

drivers/video/exynos_dp.c +1 -0
index 682483f..f60b060 100644

Lines of this file are not shown. View the raw message.

drivers/video/exynos_mipi_dsi.c +1 -0
index 7dd4652..c68ebd6 100644

Lines of this file are not shown. View the raw message.

fs/ubifs/budget.c +640 -22

662 lines not on this page · raw message

fs/ubifs/debug.c +3063 -69

3,132 lines not on this page · raw message

fs/ubifs/debug.h +282 -296

578 lines not on this page · raw message

fs/ubifs/io.c +866 -31

897 lines not on this page · raw message

fs/ubifs/key.h +24 -44

68 lines not on this page · raw message

fs/ubifs/log.c +648 -15

663 lines not on this page · raw message

fs/ubifs/lprops.c +505 -33

538 lines not on this page · raw message

fs/ubifs/lpt.c +1211 -31

1,242 lines not on this page · raw message

fs/ubifs/lpt_commit.c +1886 -17

1,903 lines not on this page · raw message

fs/ubifs/master.c +78 -24

102 lines not on this page · raw message

fs/ubifs/misc.h +75 -84

159 lines not on this page · raw message

fs/ubifs/orphan.c +651 -20

671 lines not on this page · raw message

fs/ubifs/recovery.c +538 -200

738 lines not on this page · raw message

fs/ubifs/replay.c +285 -288

573 lines not on this page · raw message

fs/ubifs/sb.c +510 -37

547 lines not on this page · raw message

fs/ubifs/scan.c +56 -46

102 lines not on this page · raw message

fs/ubifs/super.c +1833 -340

2,173 lines not on this page · raw message

fs/ubifs/tnc.c +652 -90

742 lines not on this page · raw message

fs/ubifs/tnc_misc.c +88 -36

124 lines not on this page · raw message

fs/ubifs/ubifs-media.h +36 -26

62 lines not on this page · raw message

fs/ubifs/ubifs.c +109 -6

115 lines not on this page · raw message

fs/ubifs/ubifs.h +478 -230

708 lines not on this page · raw message

fs/yaffs2/ydirectenv.h +0 -2
index c6614f1..2b3e84f 100644

Lines of this file are not shown. View the raw message.

include/linux/compat.h +321 -3

324 lines not on this page · raw message

include/linux/err.h +14 -1
index 96c0c72..e490301 100644

Lines of this file are not shown. View the raw message.

include/linux/mtd/bbm.h +37 -36

73 lines not on this page · raw message

include/linux/mtd/concat.h +4 -0
index c92b4dd..195a4a5 100644

Lines of this file are not shown. View the raw message.

include/linux/mtd/flashchip.h new file +105 -0

105 lines not on this page · raw message

include/linux/mtd/mtd.h +185 -87

272 lines not on this page · raw message

include/linux/mtd/nand.h +272 -79

351 lines not on this page · raw message

include/linux/mtd/partitions.h +33 -27

60 lines not on this page · raw message

include/linux/mtd/ubi.h +92 -28

120 lines not on this page · raw message

include/linux/usb/gadget.h +1 -5
index a8a5763..9bccd45 100644

Lines of this file are not shown. View the raw message.

include/mtd/mtd-abi.h +143 -52

195 lines not on this page · raw message

include/mtd/ubi-user.h +230 -75

305 lines not on this page · raw message

include/ubi_uboot.h +9 -155

164 lines not on this page · raw message

include/usb/lin_gadget_compat.h +0 -16
index a25e9d9..29fb166 100644

Lines of this file are not shown. View the raw message.

lib/Makefile +1 -0
index 37030a4..568312c 100644

Lines of this file are not shown. View the raw message.

lib/linux_compat.c new file +42 -0

42 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.3.1

Part of the diff is not shown here. View the raw message.

#4 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Heiko Schocher
Quoted 10 lines · Heiko Schocher

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

+#ifndef __UBOOT__

        /* Reject writes, which are not page aligned */
        if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {

+else
+ /* Reject writes, which are not page aligned */
+ if (NOTALIGNED(to)) {
+endif

This sort of ifdeffing is a bad idea -- if a larger number of lines are ifdeffed, to avoid context conflicts, subsequent merges can silently put updates into the non-U-Boot section that are needed in the U-Boot section.

Plus, it impairs readability, and in this case breaks text-editor brace-matching.

Plus plus, that line has been that way in Linux since 2006 -- why is it being touched at all? Did you merge in changes from the previous mtd sync, or did you just copy the new files over and then try to fix resulting problems? (answered below)

Quoted 9 lines

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code (only compile tested)

- Documented the config defines in README

Quoted 7 lines

- kmalloc now uses memalign for allocating memory. This prevented crashes when tested ubi/ubifs on imx6 board.

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

OK, so you did just copy stuff over. This method will lead to U-Boot changes being reverted every time. You should look in the U-Boot history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

-Scott

#5 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Scott,

Am 17.06.2014 17:54, schrieb Scott Wood:

Quoted 12 lines · Heiko Schocher
Quoted 10 lines

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

   +#ifndef __UBOOT__
         /* Reject writes, which are not page aligned */
         if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
   +else
   +     /* Reject writes, which are not page aligned */
   +     if (NOTALIGNED(to)) {
   +endif
Quoted 4 lines

This sort of ifdeffing is a bad idea -- if a larger number of lines are ifdeffed, to avoid context conflicts, subsequent merges can silently put updates into the non-U-Boot section that are needed in the U-Boot section.

Yes, in general I agree, this is a bad idea. But I introduced it here to get all differences between U-Boot and Linux marked with the "_UBOOT_" define, so a future sync with linux should be easier ...

Quoted 2 lines

Plus, it impairs readability, and in this case breaks text-editor brace-matching.

Yes, could be fixed, see below.

Quoted 4 lines

Plus plus, that line has been that way in Linux since 2006 -- why is it being touched at all? Did you merge in changes from the previous mtd sync, or did you just copy the new files over and then try to fix resulting problems? (answered below)

Yes. Above Code is a good example. In Linux this piece of code looks like:
-------------
static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
struct mtd_oob_ops *ops)
[...]

         ops->retlen = 0;
         if (!writelen)
                 return 0;

         /* Reject writes, which are not page aligned */
         if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
                 pr_notice("%s: attempt to write non page aligned data\n",
                            __func__);
                 return -EINVAL;
         }

         column = to & (mtd->writesize - 1);

-------------

in current U-Boot:

-------------
static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
struct mtd_oob_ops *ops)
[...]

         ops->retlen = 0;
         if (!writelen)
                 return 0;

         column = to & (mtd->writesize - 1);

-------------

Why is this "if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {" missing in U-Boot? Do we allow "not aligned writes" in U-Boot? If so, we should have documented this, and best place for it, I think, would be with a comment in the source code... so if we delete this linux code in U-Boot, mark it with the "_UBOOT_" define... and differences between linux and U-Boot are documented and visible ...

I added for U-Boot the surely good "NOTALIGNED(to)" check, but not the "NOTALIGNED(ops->len)" check, as it prevents such currently working commands: "nand write xxx yyy ${filesize}" ... Maybe this is the reason for missing this piece of linux code in U-Boot?

maybe I should add here a comment ... proposal:
-------------

#ifndef __UBOOT__
         /* Reject writes, which are not page aligned */
         if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
                 pr_notice("%s: attempt to write non page aligned data\n",
                            __func__);
                 return -EINVAL;
         }
#else
         /*
	 * Reject writes, which are not page aligned, but
	 * in U-Boot we accept "not page aligned data len" writes
	 * so commands for example "nand write xxx yyy ${filesize}"
	 * are working.
	 */
         if (NOTALIGNED(to)) {
                 pr_notice("%s: attempt to write non page aligned data\n",
                            __func__);
                 return -EINVAL;
         }

#endif
-------------

With this approach, the difference between linux and u-boot is documented, and text-editor brace-matching is not broken ...

Quoted 12 lines
Quoted 12 lines

as the original linux code leads in not working use of the env var "filesize". For example a "nand write 80000000 80000 ${filesize}" would not work with it ...

- add CONFIG_MTD_NAND_VERIFY_WRITE from U-Boot code (only compile tested)

- Documented the config defines in README

- kmalloc now uses memalign for allocating memory. This prevented crashes when tested ubi/ubifs on imx6 board.

Quoted 6 lines
Quoted 4 lines

- To produce this patch I did three steps:
- copied the linux source files to U-Boot tree -> commit this
- adapt license text in each file -> commit this
- make the code again compile clean and working -> commit this

OK, so you did just copy stuff over. This method will lead to U-Boot

Yes.

Quoted 1 line

changes being reverted every time. You should look in the U-Boot

Yes and No. If they are documented with the "define _UBOOT_", they will pop up after the copy from linux operation and you hopefully can decide, if the U-Boot specific changes are longer necessary or not.

Above Code is a good example for that. Linux has this code since 2006, why has U-Boot not this code?

Quoted 2 lines

history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

I think, we should have the linux code as the reference, and on top of this, we should add our U-Boot changes ... Thats the reason for the git tree [1].

There we have the "simple copy from linux patch" [2]. It overwrites the U-Boot specific changes, yes, but only in an intermediate step in this git tree ... (Maybe I should add in the commit message, that this is a simple copy from linux sources)

Then a U-Boot specifc patch [3], which introduces again hopefully all U-Boot specific changes... so *all* U-Boot specific changs are documented. At last a seperate licencse file patch [4] added which changes the license text.

My hope was, that future linux mtd syncs could look like:

a) copy new linux source files to u-boot tree [1] (make a new branch go back to commit [2] ... and copy new files from linux) (commit this, to have all linux changes since last sync with linux documented)
b) apply [3] and fix problems
All U-Boot changes documented
c) apply [4] and fix problems
d) add newly added U-Boot specific patches
(mark them with _UBOOT_ define if they are not yet marked with it) (maybe squash them to step b ?)

-> new git tree ready

e) squash all patches into one patch and send it to mainline ... so the mainline patch has only new changes with all U-Boot specific changes.

Thats sounds easy ... and you have all linux and all U-Boot changes visible and documented ... I must admit, I did not tried your proposal to look into the linux changes since the last mtd sync ... but that sounds the more tricky way to get this sync, as the history can be long ... and shouldn;t be the result the same?

bye,
Heiko
[1] http://git.denx.de/?p=u-boot/u-boot-testing.git;a=shortlog;h=refs/heads/update-mtd%2Bubi-linux-v3.14
[2] http://git.denx.de/?p=u-boot/u-boot-testing.git;a=commitdiff;h=2df3d72656e131d99f5be1dd10673477dfa9c171
[3] http://git.denx.de/?p=u-boot/u-boot-testing.git;a=commitdiff;h=9e571d0b0d7831cf0eea679396b9e8e39c488e01
[4] http://git.denx.de/?p=u-boot/u-boot-testing.git;a=commitdiff;h=65497750bfef88421cf5a1565fe82054cdf48395

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 15 lines · Heiko Schocher

Hello Scott,

Am 17.06.2014 17:54, schrieb Scott Wood:

Quoted 12 lines · Heiko Schocher
Quoted 10 lines

- Following Code in drivers/mtd/nand/nand_base.c nand_do_write_ops() adapted for U-Boot:

   +#ifndef __UBOOT__
         /* Reject writes, which are not page aligned */
         if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
   +else
   +     /* Reject writes, which are not page aligned */
   +     if (NOTALIGNED(to)) {
   +endif
Quoted 8 lines
Quoted 4 lines

This sort of ifdeffing is a bad idea -- if a larger number of lines are ifdeffed, to avoid context conflicts, subsequent merges can silently put updates into the non-U-Boot section that are needed in the U-Boot section.

Yes, in general I agree, this is a bad idea. But I introduced it here to get all differences between U-Boot and Linux marked with the "_UBOOT_" define, so a future sync with linux should be easier ...

Again, I don't think having the differences be marked with "#ifdef __UBOOT__" is a good thing.

Quoted 41 lines
Quoted 2 lines

Plus, it impairs readability, and in this case breaks text-editor brace-matching.

Yes, could be fixed, see below.

Quoted 4 lines

Plus plus, that line has been that way in Linux since 2006 -- why is it being touched at all? Did you merge in changes from the previous mtd sync, or did you just copy the new files over and then try to fix resulting problems? (answered below)

Yes. Above Code is a good example. In Linux this piece of code looks like:
-------------
static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
struct mtd_oob_ops *ops)
[...]

         ops->retlen = 0;
         if (!writelen)
                 return 0;

         /* Reject writes, which are not page aligned */
         if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {
                 pr_notice("%s: attempt to write non page aligned data\n",
                            __func__);
                 return -EINVAL;
         }

         column = to & (mtd->writesize - 1);

-------------

in current U-Boot:

-------------
static int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
struct mtd_oob_ops *ops)
[...]

         ops->retlen = 0;
         if (!writelen)
                 return 0;

         column = to & (mtd->writesize - 1);
Quoted 4 lines

-------------

Why is this "if (NOTALIGNED(to) || NOTALIGNED(ops->len)) {" missing in U-Boot? Do we allow "not aligned writes" in U-Boot?

The block skipping accessors have their own enforcement of non-aligned
accesses. Other than that, non-aligned accesses should work.

Quoted 2 lines

If so, we should have documented this, and best place for it, I think, would be with a comment in the source code...

You could look at the commit history where the code was altered, though in some cases a comment may be warranted. I don't think that comment should take the form of the Linux code under an ifndef.

Quoted 2 lines

Above Code is a good example for that. Linux has this code since 2006, why has U-Boot not this code?

It was removed by commit f9a5254111a6be2a39464f65a96f4fc2305e3c76, which moved the check into the block-skipping accessors.

Quoted 6 lines
Quoted 2 lines

history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

I think, we should have the linux code as the reference, and on top of this, we should add our U-Boot changes ... Thats the reason for the git tree [1].

One of the strengths of version control is the ability to do three-way merges, rather than throw away the downstream code and reassemble it from scratch.

What does #ifndef __UBOOT__ tell you that a diff between the U-Boot and Linux files, as of the SHA1 that was last merged into U-Boot, doesn't tell you?

Quoted 23 lines

There we have the "simple copy from linux patch" [2]. It overwrites the U-Boot specific changes, yes, but only in an intermediate step in this git tree ... (Maybe I should add in the commit message, that this is a simple copy from linux sources)

Then a U-Boot specifc patch [3], which introduces again hopefully all U-Boot specific changes... so *all* U-Boot specific changs are documented. At last a seperate licencse file patch [4] added which changes the license text.

My hope was, that future linux mtd syncs could look like:

a) copy new linux source files to u-boot tree [1] (make a new branch go back to commit [2] ... and copy new files from linux) (commit this, to have all linux changes since last sync with linux documented)
b) apply [3] and fix problems
All U-Boot changes documented
c) apply [4] and fix problems
d) add newly added U-Boot specific patches
(mark them with _UBOOT_ define if they are not yet marked with it) (maybe squash them to step b ?)

Quoted 5 lines

-> new git tree ready

e) squash all patches into one patch and send it to mainline ... so the mainline patch has only new changes with all U-Boot specific changes.

If you take over as NAND custodian, you can of course do the updates as you please (unless Tom or Wolfgang disagree), but until then I insist on doing a proper merge, and not littering the code with #ifndef __UBOOT__.

Quoted 6 lines

Thats sounds easy ... and you have all linux and all U-Boot changes visible and documented ... I must admit, I did not tried your proposal to look into the linux changes since the last mtd sync ... but that sounds the more tricky way to get this sync, as the history can be long ... and shouldn;t be the result the same?

Why does the length of the history matter? I'm not asking you to go patch by patch. Just take a diff between the SHA1 of last merge and the SHA1 you want to merge now, and apply that patch.

The results will only be the same (ignoring the ifdefs you want to add) if no errors are made, and I find your process more error prone. E.g. how do you know you've fixed all problems (much less fixed them in the same way so as to make the results the same, and reduce code churn)? Do you test every board U-Boot supports NAND on? Every feature of U-Boot code relating to NAND? Limiting the update to things that have actually changed in Linux since the previous sync reduces the likelihood of regressions.

-Scott

#7 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 2 lines · Scott Wood
Quoted 1 line · Heiko Schocher

Hello Scott,

[snip]

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

I think, we should have the linux code as the reference, and on top of this, we should add our U-Boot changes ... Thats the reason for the git tree [1].

One of the strengths of version control is the ability to do three-way merges, rather than throw away the downstream code and reassemble it from scratch.

Indeed.

[snip]

Quoted 45 lines

What does #ifndef __UBOOT__ tell you that a diff between the U-Boot and Linux files, as of the SHA1 that was last merged into U-Boot, doesn't tell you?

Quoted 23 lines

There we have the "simple copy from linux patch" [2]. It overwrites the U-Boot specific changes, yes, but only in an intermediate step in this git tree ... (Maybe I should add in the commit message, that this is a simple copy from linux sources)

Then a U-Boot specifc patch [3], which introduces again hopefully all U-Boot specific changes... so *all* U-Boot specific changs are documented. At last a seperate licencse file patch [4] added which changes the license text.

My hope was, that future linux mtd syncs could look like:

a) copy new linux source files to u-boot tree [1] (make a new branch go back to commit [2] ... and copy new files from linux) (commit this, to have all linux changes since last sync with linux documented)
b) apply [3] and fix problems
All U-Boot changes documented
c) apply [4] and fix problems
d) add newly added U-Boot specific patches
(mark them with _UBOOT_ define if they are not yet marked with it) (maybe squash them to step b ?)

Quoted 5 lines

-> new git tree ready

e) squash all patches into one patch and send it to mainline ... so the mainline patch has only new changes with all U-Boot specific changes.

If you take over as NAND custodian, you can of course do the updates as you please (unless Tom or Wolfgang disagree), but until then I insist on doing a proper merge, and not littering the code with #ifndef __UBOOT__.

Quoted 6 lines

Thats sounds easy ... and you have all linux and all U-Boot changes visible and documented ... I must admit, I did not tried your proposal to look into the linux changes since the last mtd sync ... but that sounds the more tricky way to get this sync, as the history can be long ... and shouldn;t be the result the same?

Quoted 3 lines

Why does the length of the history matter? I'm not asking you to go patch by patch. Just take a diff between the SHA1 of last merge and the SHA1 you want to merge now, and apply that patch.

But it's not even that hard to do so! git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand will give you only the relevant patches, and they should mostly apply, and then you can squash them after the fact.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140618/24736ad1/attachment.pgp>
#8 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Tom, Scott,

Am 18.06.2014 23:42, schrieb Tom Rini:

Quoted 63 lines · Scott Wood
Quoted 2 lines · Heiko Schocher
Quoted 1 line

Hello Scott,

[snip]

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

I think, we should have the linux code as the reference, and on top of this, we should add our U-Boot changes ... Thats the reason for the git tree [1].

One of the strengths of version control is the ability to do three-way merges, rather than throw away the downstream code and reassemble it from scratch.

Indeed.

[snip]

Quoted 45 lines

What does #ifndef __UBOOT__ tell you that a diff between the U-Boot and Linux files, as of the SHA1 that was last merged into U-Boot, doesn't tell you?

Quoted 23 lines

There we have the "simple copy from linux patch" [2]. It overwrites the U-Boot specific changes, yes, but only in an intermediate step in this git tree ... (Maybe I should add in the commit message, that this is a simple copy from linux sources)

Then a U-Boot specifc patch [3], which introduces again hopefully all U-Boot specific changes... so *all* U-Boot specific changs are documented. At last a seperate licencse file patch [4] added which changes the license text.

My hope was, that future linux mtd syncs could look like:

a) copy new linux source files to u-boot tree [1] (make a new branch go back to commit [2] ... and copy new files from linux) (commit this, to have all linux changes since last sync with linux documented)
b) apply [3] and fix problems
All U-Boot changes documented
c) apply [4] and fix problems
d) add newly added U-Boot specific patches
(mark them with _UBOOT_ define if they are not yet marked with it) (maybe squash them to step b ?)

Quoted 5 lines

-> new git tree ready

e) squash all patches into one patch and send it to mainline ... so the mainline patch has only new changes with all U-Boot specific changes.

If you take over as NAND custodian, you can of course do the updates as you please (unless Tom or Wolfgang disagree), but until then I insist on doing a proper merge, and not littering the code with #ifndef __UBOOT__.

Quoted 6 lines

Thats sounds easy ... and you have all linux and all U-Boot changes visible and documented ... I must admit, I did not tried your proposal to look into the linux changes since the last mtd sync ... but that sounds the more tricky way to get this sync, as the history can be long ... and shouldn;t be the result the same?

Quoted 6 lines
Quoted 3 lines

Why does the length of the history matter? I'm not asking you to go patch by patch. Just take a diff between the SHA1 of last merge and the SHA1 you want to merge now, and apply that patch.

But it's not even that hard to do so! git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand will give you only the relevant patches,

"git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand" results in 440 patches ... :-(

"git am" first patch immediately fails ...

Ok, one step back ... I try only "drivers/mtd/mtdcore.c":

$ git format-patch -o mtdcore v3.7..v3.14 drivers/mtd/mtdcore.c
mtdcore/0001-mtd-convert-to-idr_alloc.patch
mtdcore/0002-mtd-add-const-qualifier-to-a-couple-of-register-func.patch
mtdcore/0003-mtd-mtdcore-remove-few-useless-ifdef-s.patch
mtdcore/0004-mtd-merge-mtdchar-module-with-mtdcore.patch
mtdcore/0005-Include-missing-linux-slab.h-inclusions.patch
mtdcore/0006-drivers-avoid-format-string-in-dev_set_name.patch
mtdcore/0007-mtd-add-a-new-sys-node-to-show-the-ecc-step-size.patch
mtdcore/0008-mtd-add-MTD_MLCNANDFLASH-case-for-mtd_type_show.patch
mtdcore/0009-mtd-Move-major-number-definitions-to-major.h.patch
mtdcore/0010-mtd-remove-duplicated-include-from-mtdcore.c.patch
mtdcore/0011-mtd-convert-to-use-ATTRIBUTE_GROUPS.patch
$

Only 11 patches, great ... but:

$ git am -3 mtdcore/0001-mtd-convert-to-idr_alloc.patch
Wende an: mtd: convert to idr_alloc()
fatal: sha1 information is lacking or useless (drivers/mtd/mtdcore.c).
Dem Projektarchiv fehlen notwendige Blobs um auf eine 3-Wege-Zusammenf?hrung zur?ckzufallen.
Kann nicht zu 3-Wege-Zusammenf?hrung zur?ckfallen.
Anwendung des Patches fehlgeschlagen bei 0001 mtd: convert to idr_alloc()
Die Kopie des fehlgeschlagenen Patches befindet sich in:
    /home/hs/i2c/u-boot/.git/rebase-apply/patch
Wenn Sie das Problem gel?st haben, f?hren Sie "git am --resolved" aus.
Falls Sie diesen Patch auslassen m?chten, f?hren Sie stattdessen
"git am --skip" aus.
Um den urspr?nglichen Zweig wiederherzustellen und die Anwendung der
Patches abzubrechen, f?hren Sie "git am --abort" aus.
pollux:u-boot hs [mtdubiubifs_try] $
$ patch -p1 < mtdcore/0001-mtd-convert-to-idr_alloc.patch
patching file drivers/mtd/mtdcore.c
Hunk #1 FAILED@349.
1 out of 1 hunk FAILED -- saving rejects to file drivers/mtd/mtdcore.c.rej
$

:-(

Quoted 2 lines

and they should mostly apply, and then you can squash them after the fact.

I try to try this ASAP and report (first steps see above ...). But as a lot of linux code is missing in U-Boot code, I feel, that a lot of chunks will not apply ... but maybe (hopefully) I am wrong ...

So therefore I copied and introduced the complete linux code, because it is the easier way for generating this patch...

What I new introduced is:
mark in U-Boot unused/different Code with __UBOOT__ ... to get faster, U-Boot relevant changes, by simple looking into the diff ...

Thats the question we must solve, do we want the complete Linux MTD code in U-Boot and mark not used code?

If no, I delete this pieces of code...

Hmm... looking in the history of drivers/mtd/ubi it seems the code is basically from 2008!
http://git.denx.de/?p=u-boot.git;a=history;f=drivers/mtd/ubi;hb=7d2357c1999ff1f93f795282526230a8bd176106

Hmm.. what was the Linux base of this ?

and ubifs from 2009?
http://git.denx.de/?p=u-boot.git;a=history;f=fs/ubifs;hb=7d2357c1999ff1f93f795282526230a8bd176106
Base: "2.6.29-rc6" ... uh, very, very old!

I see there no real syncs with newer linux code ... is this true? Just some fixups ...

Hmm reading the commit mesage from 9eefe2a2b37a838558e3d213a9f5519503d0c180:
"UBIFS: Implement read-only UBIFS support in U-Boot"

"The U-Boot UBIFS implementation is largely a direct copy from the current Linux version (2.6.29-rc6). As already done in the UBI version we have an "abstraction layer" to redefine or remove some OS calls (e.g. mutex_lock() ...). This makes it possible to use the original Linux code with very little changes. And by this we can better update to later Linux versions.

I removed some of the Linux features that are not used in the U-Boot version (e.g. garbage-collection, write support)."

Sounds like my current approach ... Ok, again, not used code is deleted.

I really fear a patch "git format-patch -o ubifs-resync 2.6.29-rc6..v3.14 fs/ubifs" (The result from this command are 355 patches ...)

So, in sum, this are 795 patches + missing ubi patches which must be applied/reworked/reviewed... Sounds painful...

So another question is:
How to generate an update-sync patch:

version a):
- copy the new linux files from Linux v3.14 to U-Boot
- work in the U-Boot specific changes
- make a patch from this

Is this really different to:

version b):
- git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand
- apply them
- make a patch from this

Currently it is differrent, as I introduced the complete linux code and marked unused/different code in U-Boot with __UBOOT__. If I delete this pieces ... version a) and b) should be the same.

I try it ... if I not give up due to count of patches ...

Maybe it was not a so good idea to remove the "RFC" state from this patches ;-)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#9 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 70 lines · Heiko Schocher

Hello Tom, Scott,

Am 18.06.2014 23:42, schrieb Tom Rini:

Quoted 67 lines · Scott Wood
Quoted 2 lines · Heiko Schocher
Quoted 1 line

Hello Scott,

[snip]

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

I think, we should have the linux code as the reference, and on top of this, we should add our U-Boot changes ... Thats the reason for the git tree [1].

One of the strengths of version control is the ability to do three-way merges, rather than throw away the downstream code and reassemble it from scratch.

Indeed.

[snip]

Quoted 48 lines

What does #ifndef __UBOOT__ tell you that a diff between the U-Boot and Linux files, as of the SHA1 that was last merged into U-Boot, doesn't tell you?

Quoted 23 lines

There we have the "simple copy from linux patch" [2]. It overwrites the U-Boot specific changes, yes, but only in an intermediate step in this git tree ... (Maybe I should add in the commit message, that this is a simple copy from linux sources)

Then a U-Boot specifc patch [3], which introduces again hopefully all U-Boot specific changes... so *all* U-Boot specific changs are documented. At last a seperate licencse file patch [4] added which changes the license text.

My hope was, that future linux mtd syncs could look like:

a) copy new linux source files to u-boot tree [1] (make a new branch go back to commit [2] ... and copy new files from linux) (commit this, to have all linux changes since last sync with linux documented)
b) apply [3] and fix problems
All U-Boot changes documented
c) apply [4] and fix problems
d) add newly added U-Boot specific patches
(mark them with _UBOOT_ define if they are not yet marked with it) (maybe squash them to step b ?)

Quoted 5 lines

-> new git tree ready

e) squash all patches into one patch and send it to mainline ... so the mainline patch has only new changes with all U-Boot specific changes.

If you take over as NAND custodian, you can of course do the updates as you please (unless Tom or Wolfgang disagree), but until then I insist on doing a proper merge, and not littering the code with #ifndef __UBOOT__.

Quoted 6 lines

Thats sounds easy ... and you have all linux and all U-Boot changes visible and documented ... I must admit, I did not tried your proposal to look into the linux changes since the last mtd sync ... but that sounds the more tricky way to get this sync, as the history can be long ... and shouldn;t be the result the same?

Why does the length of the history matter? I'm not asking you to go patch by patch. Just take a diff between the SHA1 of last merge and the SHA1 you want to merge now, and apply that patch.

Quoted 5 lines
Quoted 2 lines

But it's not even that hard to do so! git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand will give you only the relevant patches,

"git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand" results in 440 patches ... :-(

This is why I suggested taking one big diff rather than going patch-to-patch. Then you don't have to resolve the same conflicts over and over.

You should also exclude files that U-Boot doesn't have, and include header files that are relevant.

Quoted 18 lines

"git am" first patch immediately fails ...

Ok, one step back ... I try only "drivers/mtd/mtdcore.c":

$ git format-patch -o mtdcore v3.7..v3.14 drivers/mtd/mtdcore.c
mtdcore/0001-mtd-convert-to-idr_alloc.patch
mtdcore/0002-mtd-add-const-qualifier-to-a-couple-of-register-func.patch
mtdcore/0003-mtd-mtdcore-remove-few-useless-ifdef-s.patch
mtdcore/0004-mtd-merge-mtdchar-module-with-mtdcore.patch
mtdcore/0005-Include-missing-linux-slab.h-inclusions.patch
mtdcore/0006-drivers-avoid-format-string-in-dev_set_name.patch
mtdcore/0007-mtd-add-a-new-sys-node-to-show-the-ecc-step-size.patch
mtdcore/0008-mtd-add-MTD_MLCNANDFLASH-case-for-mtd_type_show.patch
mtdcore/0009-mtd-Move-major-number-definitions-to-major.h.patch
mtdcore/0010-mtd-remove-duplicated-include-from-mtdcore.c.patch
mtdcore/0011-mtd-convert-to-use-ATTRIBUTE_GROUPS.patch
$
Quoted 5 lines

Only 11 patches, great ... but:

$ git am -3 mtdcore/0001-mtd-convert-to-idr_alloc.patch
Wende an: mtd: convert to idr_alloc()
fatal: sha1 information is lacking or useless (drivers/mtd/mtdcore.c).

If you fetch the Linux tree into your U-boot repository, then -3 will work.

Quoted 6 lines
Quoted 2 lines

and they should mostly apply, and then you can squash them after the fact.

I try to try this ASAP and report (first steps see above ...). But as a lot of linux code is missing in U-Boot code, I feel, that a lot of chunks will not apply ... but maybe (hopefully) I am wrong ...

If the conflict is due to a change that applies to code that is missing because it doesn't make sense in U-Boot, then just delete that conflict and move on. Unlike having the change silently apply to an ifndef region, you can first evaluate the change to see if it should apply to some alternative U-Boot version of the code.

Quoted 2 lines

Thats the question we must solve, do we want the complete Linux MTD code in U-Boot and mark not used code?

No.

Quoted 7 lines

If no, I delete this pieces of code...

Hmm... looking in the history of drivers/mtd/ubi it seems the code is basically from 2008!
http://git.denx.de/?p=u-boot.git;a=history;f=drivers/mtd/ubi;hb=7d2357c1999ff1f93f795282526230a8bd176106

Hmm.. what was the Linux base of this ?

See commit dfe64e2c89731a3f9950d7acd8681b68df2bae03 "mtd: resync with Linux-3.7.1"

Quoted 6 lines

and ubifs from 2009?
http://git.denx.de/?p=u-boot.git;a=history;f=fs/ubifs;hb=7d2357c1999ff1f93f795282526230a8bd176106
Base: "2.6.29-rc6" ... uh, very, very old!

I see there no real syncs with newer linux code ... is this true? Just some fixups ...

CCing Kyungmin who is the UBI maintainer.

Quoted 5 lines

I really fear a patch "git format-patch -o ubifs-resync 2.6.29-rc6..v3.14 fs/ubifs" (The result from this command are 355 patches ...)

So, in sum, this are 795 patches + missing ubi patches which must be applied/reworked/reviewed... Sounds painful...

I don't know about ubifs, but the core NAND code (and apparently the core UBI code) is currently synced with Linux 3.7.1.

Quoted 8 lines

So another question is:
How to generate an update-sync patch:

version a):
- copy the new linux files from Linux v3.14 to U-Boot
- work in the U-Boot specific changes
- make a patch from this

Quoted 6 lines

Is this really different to:

version b):
- git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand
- apply them
- make a patch from this

It is different because "work in the U-Boot specific changes" is a manual, error-prone step compared to letting git do most of the work.

Quoted 5 lines

Currently it is differrent, as I introduced the complete linux code and marked unused/different code in U-Boot with __UBOOT__. If I delete this pieces ... version a) and b) should be the same.

I try it ... if I not give up due to count of patches ...

Again, there's no need to go patch-by-patch. We haven't done so on prior updates.

-Scott

#10 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Scott,

Am 20.06.2014 01:45, schrieb Scott Wood:

Quoted 77 lines · Heiko Schocher
Quoted 70 lines

Hello Tom, Scott,

Am 18.06.2014 23:42, schrieb Tom Rini:

Quoted 67 lines · Scott Wood
Quoted 2 lines · Heiko Schocher
Quoted 1 line

Hello Scott,

[snip]

Quoted 10 lines
Quoted 6 lines
Quoted 2 lines

history to see what Linux version corresponded to the last mtd sync, and generate a diff relative to that.

I think, we should have the linux code as the reference, and on top of this, we should add our U-Boot changes ... Thats the reason for the git tree [1].

One of the strengths of version control is the ability to do three-way merges, rather than throw away the downstream code and reassemble it from scratch.

Indeed.

[snip]

Quoted 48 lines

What does #ifndef __UBOOT__ tell you that a diff between the U-Boot and Linux files, as of the SHA1 that was last merged into U-Boot, doesn't tell you?

Quoted 23 lines

There we have the "simple copy from linux patch" [2]. It overwrites the U-Boot specific changes, yes, but only in an intermediate step in this git tree ... (Maybe I should add in the commit message, that this is a simple copy from linux sources)

Then a U-Boot specifc patch [3], which introduces again hopefully all U-Boot specific changes... so *all* U-Boot specific changs are documented. At last a seperate licencse file patch [4] added which changes the license text.

My hope was, that future linux mtd syncs could look like:

a) copy new linux source files to u-boot tree [1] (make a new branch go back to commit [2] ... and copy new files from linux) (commit this, to have all linux changes since last sync with linux documented)
b) apply [3] and fix problems
All U-Boot changes documented
c) apply [4] and fix problems
d) add newly added U-Boot specific patches
(mark them with _UBOOT_ define if they are not yet marked with it) (maybe squash them to step b ?)

Quoted 5 lines

-> new git tree ready

e) squash all patches into one patch and send it to mainline ... so the mainline patch has only new changes with all U-Boot specific changes.

If you take over as NAND custodian, you can of course do the updates as you please (unless Tom or Wolfgang disagree), but until then I insist on doing a proper merge, and not littering the code with #ifndef __UBOOT__.

Quoted 6 lines

Thats sounds easy ... and you have all linux and all U-Boot changes visible and documented ... I must admit, I did not tried your proposal to look into the linux changes since the last mtd sync ... but that sounds the more tricky way to get this sync, as the history can be long ... and shouldn;t be the result the same?

Why does the length of the history matter? I'm not asking you to go patch by patch. Just take a diff between the SHA1 of last merge and the SHA1 you want to merge now, and apply that patch.

Quoted 5 lines
Quoted 2 lines

But it's not even that hard to do so! git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand will give you only the relevant patches,

"git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand" results in 440 patches ... :-(

Quoted 6 lines

This is why I suggested taking one big diff rather than going patch-to-patch. Then you don't have to resolve the same conflicts over and over.

You should also exclude files that U-Boot doesn't have, and include header files that are relevant.

Yep.

Quoted 18 lines
Quoted 18 lines

"git am" first patch immediately fails ...

Ok, one step back ... I try only "drivers/mtd/mtdcore.c":

$ git format-patch -o mtdcore v3.7..v3.14 drivers/mtd/mtdcore.c
mtdcore/0001-mtd-convert-to-idr_alloc.patch
mtdcore/0002-mtd-add-const-qualifier-to-a-couple-of-register-func.patch
mtdcore/0003-mtd-mtdcore-remove-few-useless-ifdef-s.patch
mtdcore/0004-mtd-merge-mtdchar-module-with-mtdcore.patch
mtdcore/0005-Include-missing-linux-slab.h-inclusions.patch
mtdcore/0006-drivers-avoid-format-string-in-dev_set_name.patch
mtdcore/0007-mtd-add-a-new-sys-node-to-show-the-ecc-step-size.patch
mtdcore/0008-mtd-add-MTD_MLCNANDFLASH-case-for-mtd_type_show.patch
mtdcore/0009-mtd-Move-major-number-definitions-to-major.h.patch
mtdcore/0010-mtd-remove-duplicated-include-from-mtdcore.c.patch
mtdcore/0011-mtd-convert-to-use-ATTRIBUTE_GROUPS.patch
$
Quoted 8 lines
Quoted 5 lines

Only 11 patches, great ... but:

$ git am -3 mtdcore/0001-mtd-convert-to-idr_alloc.patch
Wende an: mtd: convert to idr_alloc()
fatal: sha1 information is lacking or useless (drivers/mtd/mtdcore.c).

If you fetch the Linux tree into your U-boot repository, then -3 will work.

Ah, try this.

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

and they should mostly apply, and then you can squash them after the fact.

I try to try this ASAP and report (first steps see above ...). But as a lot of linux code is missing in U-Boot code, I feel, that a lot of chunks will not apply ... but maybe (hopefully) I am wrong ...

Quoted 5 lines

If the conflict is due to a change that applies to code that is missing because it doesn't make sense in U-Boot, then just delete that conflict and move on. Unlike having the change silently apply to an ifndef region, you can first evaluate the change to see if it should apply to some alternative U-Boot version of the code.

Ok, I step into this direction.

Quoted 4 lines
Quoted 2 lines

Thats the question we must solve, do we want the complete Linux MTD code in U-Boot and mark not used code?

No.

Ok, prevent this.

Quoted 10 lines
Quoted 7 lines

If no, I delete this pieces of code...

Hmm... looking in the history of drivers/mtd/ubi it seems the code is basically from 2008!
http://git.denx.de/?p=u-boot.git;a=history;f=drivers/mtd/ubi;hb=7d2357c1999ff1f93f795282526230a8bd176106

Hmm.. what was the Linux base of this ?

See commit dfe64e2c89731a3f9950d7acd8681b68df2bae03 "mtd: resync with Linux-3.7.1"

Ah, yes, there are also UBI files.

Quoted 8 lines
Quoted 6 lines

and ubifs from 2009?
http://git.denx.de/?p=u-boot.git;a=history;f=fs/ubifs;hb=7d2357c1999ff1f93f795282526230a8bd176106
Base: "2.6.29-rc6" ... uh, very, very old!

I see there no real syncs with newer linux code ... is this true? Just some fixups ...

CCing Kyungmin who is the UBI maintainer.

Thanks.

Quoted 27 lines
Quoted 5 lines

I really fear a patch "git format-patch -o ubifs-resync 2.6.29-rc6..v3.14 fs/ubifs" (The result from this command are 355 patches ...)

So, in sum, this are 795 patches + missing ubi patches which must be applied/reworked/reviewed... Sounds painful...

I don't know about ubifs, but the core NAND code (and apparently the core UBI code) is currently synced with Linux 3.7.1.

Quoted 8 lines

So another question is:
How to generate an update-sync patch:

version a):
- copy the new linux files from Linux v3.14 to U-Boot
- work in the U-Boot specific changes
- make a patch from this

Quoted 6 lines

Is this really different to:

version b):
- git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand
- apply them
- make a patch from this

It is different because "work in the U-Boot specific changes" is a manual, error-prone step compared to letting git do most of the work.

Quoted 8 lines
Quoted 5 lines

Currently it is differrent, as I introduced the complete linux code and marked unused/different code in U-Boot with __UBOOT__. If I delete this pieces ... version a) and b) should be the same.

I try it ... if I not give up due to count of patches ...

Again, there's no need to go patch-by-patch. We haven't done so on prior updates.

I try it this way.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#11 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Scott,

Am 20.06.2014 09:59, schrieb Heiko Schocher:

Quoted 7 lines

Hello Scott,

Am 20.06.2014 01:45, schrieb Scott Wood:

Quoted 4 lines · Heiko Schocher
Quoted 3 lines

Hello Tom, Scott,

Am 18.06.2014 23:42, schrieb Tom Rini:

[...]

Quoted 31 lines
Quoted 31 lines
Quoted 5 lines

I really fear a patch "git format-patch -o ubifs-resync 2.6.29-rc6..v3.14 fs/ubifs" (The result from this command are 355 patches ...)

So, in sum, this are 795 patches + missing ubi patches which must be applied/reworked/reviewed... Sounds painful...

I don't know about ubifs, but the core NAND code (and apparently the core UBI code) is currently synced with Linux 3.7.1.

Quoted 8 lines

So another question is:
How to generate an update-sync patch:

version a):
- copy the new linux files from Linux v3.14 to U-Boot
- work in the U-Boot specific changes
- make a patch from this

Quoted 6 lines

Is this really different to:

version b):
- git format-patch -o mtd-resync v3.7..v3.14 drivers/mtd/nand
- apply them
- make a patch from this

It is different because "work in the U-Boot specific changes" is a manual, error-prone step compared to letting git do most of the work.

Quoted 4 lines

Currently it is differrent, as I introduced the complete linux code and marked unused/different code in U-Boot with __UBOOT__. If I delete this pieces ... version a) and b) should be the same.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I try it ... if I not give up due to count of patches ...

Again, there's no need to go patch-by-patch. We haven't done so on prior updates.

I try it this way.

Ok, did a "git diff v3.7.1..v3.14 ..." for drivers/mtd/nand and drivers/mtd/mtd*.{c,h} and applied it with "git am -3 ..." after fetching the Linux tree into my U-boot repository ... this command worked now nice ... but there are subtle diffs between the sources in the "copied from linux" tree and the "git am -3" tree ... which did not pop up when doing a "git am -3 ...", just detected them because I could do a diff between "my copied from linux" version and the "git am -3 ..." created version!

Also this does not work correct for "drivers/mtd/ubi" ... hard to describe what went wrong ... maybe the base from the code in U-Boot is not v3.7.1, there are a lot of merge errors ... scan.c is not longer in linux code, therefore attach.c is now there ... and with this change "git am -3 ..." seem to have problems... as there resist old function names which were in scan.c, but now missing ...

Before digging in it, and maybe lost a lot of hours ... I did a diff between my old version (copying the files) and the new version with git diff ... and except the expected differences as I let the complete linux code in U-Boot and marked U-Boot specific Code with __UBOOT__ there are small differences:

"git diff HEAD..20140620" shows:

HEAD: current version, created with "git am -3 ..." 20140620: my old ML posted version created with copying linux files

just two examples:

[...]

drivers/mtd/mtdconcat.c +0 -0
index 31e4289b..39daeab 100644

[...]
@@ -316,7 +416,7 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr)
* to-be-erased area begins. Verify that the starting
* offset is aligned to this region's erase size:
*/
- if (instr->addr & (erase_regions[i].erasesize - 1))
+ if (i < 0 || instr->addr & (erase_regions[i].erasesize - 1))

                         return -EINVAL;

                 /*

looking into the linux history I see this commit:

commit ebf2e93036907fe2a7ddab942aa63d35f97f3b2b

Author: Roel Kluin <[email protected]>
Date:   Fri Sep 18 12:51:49 2009 -0700

mtd: mtdconcat: prevent a read from eraseregions[-1]

If the erase region was found in the first iteration we read from eraseregions[-1]

Seems a necessary bugifx change ...
Why is this missing in the "git am -3" version ... ? (As it is a change before v3.7.1? But then the question is why it is missing in current U-Boot code ...

Is it intentionally or just a mistake? I have no chance to decide this ...

Next example:
[...]
@@ -511,9 +635,6 @@ static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs)

         struct mtd_concat *concat = CONCAT(mtd);
         int i, err = -EINVAL;

- if (!mtd_can_have_bb(concat->subdev[0]))
- return 0;
-

         for (i = 0; i < concat->num_subdev; i++) {
                 struct mtd_info *subdev = concat->subdev[i];

[...]

This Code remains in the "git am -3 ..." version ... why?

Ah, here I found the remove commit in linux:

http://git.denx.de/?p=linux-denx.git;a=commitdiff;h=79186876441278e7276d335448a4cb47fc4c1d8e

So ... why remains this code in the "git am -3 ..." version? This change is in linux v3.7.1 ... so why it is not in U-Boot? No chance to understand this ...

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

bye,
heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#12 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Dear Heiko,

Quoted 6 lines · In message <[email protected]> you wrote:

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Given the complexity of the code - and of the changes added in U-Boot to the original (old) Linux code (which were done over a period of time) - I think indeed that your original approach is the better one; better both in the sense of requiring less efforts (for creating and verifying that all chanes were covered), and less risk to miss individual modifications either from the Linux or from the U-Boot side.

Scott, I agree that your suggestion is what usually should work fine, but here it apparently fails in a number of places that would be time consuming to sort out - and I would expect that the same would happen again whenever we update to another new version of the Linux code base. So I think we should stick with Heiko's approach here; it documents clearly what he did, it looks complete, and it is working. I think it would be a waste of time to redo all the work, just differently.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Testing can show the presense of bugs, but not their absence.
                                                   -- Edsger Dijkstra
#13 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 18 lines · Wolfgang Denk

Dear Heiko,

Quoted 6 lines · In message <[email protected]> you wrote:

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Given the complexity of the code - and of the changes added in U-Boot to the original (old) Linux code (which were done over a period of time) - I think indeed that your original approach is the better one; better both in the sense of requiring less efforts (for creating and verifying that all chanes were covered), and less risk to miss individual modifications either from the Linux or from the U-Boot side.

Quoted 8 lines

Scott, I agree that your suggestion is what usually should work fine, but here it apparently fails in a number of places that would be time consuming to sort out - and I would expect that the same would happen again whenever we update to another new version of the Linux code base. So I think we should stick with Heiko's approach here; it documents clearly what he did, it looks complete, and it is working. I think it would be a waste of time to redo all the work, just differently.

OK, lets try this. One worry at the back of my mind is the fallout we had when we re-synced to v3.7.1 and tested things as best we were able to prior to merge. I think it's too late in the cycle to pull this in for v2014.07, but lets get something in for v2014.10. And since v3.15 is already out, lets do (as part of testing our theories out), a follow up patch to sync up with v3.15. And finally, I think we need, in order to keep this pain point down, sync per kernel release.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140623/7a04da5d/attachment.pgp>
#14 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Tom,

Am 23.06.2014 17:05, schrieb Tom Rini:

Quoted 28 lines · Wolfgang Denk
Quoted 18 lines

Dear Heiko,

Quoted 6 lines · In message<[email protected]> you wrote:

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Given the complexity of the code - and of the changes added in U-Boot to the original (old) Linux code (which were done over a period of time) - I think indeed that your original approach is the better one; better both in the sense of requiring less efforts (for creating and verifying that all chanes were covered), and less risk to miss individual modifications either from the Linux or from the U-Boot side.

Quoted 8 lines

Scott, I agree that your suggestion is what usually should work fine, but here it apparently fails in a number of places that would be time consuming to sort out - and I would expect that the same would happen again whenever we update to another new version of the Linux code base. So I think we should stick with Heiko's approach here; it documents clearly what he did, it looks complete, and it is working. I think it would be a waste of time to redo all the work, just differently.

Quoted 3 lines

OK, lets try this. One worry at the back of my mind is the fallout we had when we re-synced to v3.7.1 and tested things as best we were able to prior to merge. I think it's too late in the cycle to pull this in

Yes I fear such fallout too ... I could also test on some boards only, the rest is compile clean only ... thats the reason why I had the sync serie as RFC ... maybe we create a mtd-test branch? But on the other hand, things maybe get tested only, if they are in mainline ...

Quoted 1 line

for v2014.07, but lets get something in for v2014.10. And since v3.15

Yep, that was my plan too.

Quoted 3 lines

is already out, lets do (as part of testing our theories out), a follow up patch to sync up with v3.15. And finally, I think we need, in order to keep this pain point down, sync per kernel release.

Ok, I had prepared a v5, posting it soon.

I try to do also to prepare a seperate sync with v3.15 patch, but give me some time ... also I found a bug in current v3.16-rc1 kernel, using ubi fastmap, see:

"UBI: fix rb_tree node comparison in add_map commit buggy?"
http://lists.infradead.org/pipermail/linux-mtd/2014-June/054348.html

So current v3.16-rc1 kernel could not attach a ubi volume using ubi fastmap and created with a kernel not having commit 604b592e6fd3c98f21435e1181ba7723ffc24715 applied ... which is the case for v3.14 ... with my fixup, a v3.16-rc1 kernel could again attach a v3.14 kernel or U-Boot (with my v3.14 sync patches applied) created ubi volume ...

Maybe we wait with the sync, until this is sorted out?

To sync us with each kernel release would be a good idea, but the problem would be, to find time for it ...

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#15 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 30 lines · Heiko Schocher

Hello Tom,

Am 23.06.2014 17:05, schrieb Tom Rini:

Quoted 27 lines · Wolfgang Denk
Quoted 25 lines

Dear Heiko,

Quoted 5 lines · In message<[email protected]> you wrote:

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Given the complexity of the code - and of the changes added in U-Boot to the original (old) Linux code (which were done over a period of time) - I think indeed that your original approach is the better one; better both in the sense of requiring less efforts (for creating and verifying that all chanes were covered), and less risk to miss individual modifications either from the Linux or from the U-Boot side.

Scott, I agree that your suggestion is what usually should work fine, but here it apparently fails in a number of places that would be time consuming to sort out - and I would expect that the same would happen again whenever we update to another new version of the Linux code base. So I think we should stick with Heiko's approach here; it documents clearly what he did, it looks complete, and it is working. I think it would be a waste of time to redo all the work, just differently.

Quoted 8 lines
Quoted 3 lines

OK, lets try this. One worry at the back of my mind is the fallout we had when we re-synced to v3.7.1 and tested things as best we were able to prior to merge. I think it's too late in the cycle to pull this in

Yes I fear such fallout too ... I could also test on some boards only, the rest is compile clean only ... thats the reason why I had the sync serie as RFC ... maybe we create a mtd-test branch? But on the other hand, things maybe get tested only, if they are in mainline ...

I'd vouch to apply this first thing after .07 is out and fix the problems which arise as we see them. It'd also be really nice to see MTD synced more often, any volunteers ?

Best regards,
Marek Vasut

#16 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 35 lines · Marek Vasut
Quoted 34 lines · Heiko Schocher

Hello Tom,

Am 23.06.2014 17:05, schrieb Tom Rini:

Quoted 30 lines · Wolfgang Denk
Quoted 17 lines

Dear Heiko,

Quoted 5 lines · In message<[email protected]> you wrote:

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Given the complexity of the code - and of the changes added in U-Boot to the original (old) Linux code (which were done over a period of time) - I think indeed that your original approach is the better one; better both in the sense of requiring less efforts (for creating and verifying that all chanes were covered), and less risk to miss individual modifications either from the Linux or from the U-Boot side.

Quoted 8 lines

Scott, I agree that your suggestion is what usually should work fine, but here it apparently fails in a number of places that would be time consuming to sort out - and I would expect that the same would happen again whenever we update to another new version of the Linux code base. So I think we should stick with Heiko's approach here; it documents clearly what he did, it looks complete, and it is working. I think it would be a waste of time to redo all the work, just differently.

OK, lets try this. One worry at the back of my mind is the fallout we had when we re-synced to v3.7.1 and tested things as best we were able to prior to merge. I think it's too late in the cycle to pull this in

Quoted 7 lines
Quoted 4 lines

Yes I fear such fallout too ... I could also test on some boards only, the rest is compile clean only ... thats the reason why I had the sync serie as RFC ... maybe we create a mtd-test branch? But on the other hand, things maybe get tested only, if they are in mainline ...

I'd vouch to apply this first thing after .07 is out and fix the problems which arise as we see them.

Yes, I don't think a separate branch will buy us more testers, only applying it, so very early in the next window.

Quoted 2 lines

It'd also be really nice to see MTD synced more often, any volunteers ?

Well since Scott was asking for someone to take over, I'd like to ask that whomever takes the job next please see about doing this. It shouldn't be as painful if we stay in step (more like 100-150 patches rather than 700).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140624/e306020f/attachment.pgp>
#17 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Heiko Schocher
Quoted 35 lines · Heiko Schocher

Hello Tom,

Am 23.06.2014 17:05, schrieb Tom Rini:

Quoted 28 lines · Wolfgang Denk
Quoted 18 lines

Dear Heiko,

Quoted 6 lines · In message<[email protected]> you wrote:

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Given the complexity of the code - and of the changes added in U-Boot to the original (old) Linux code (which were done over a period of time) - I think indeed that your original approach is the better one; better both in the sense of requiring less efforts (for creating and verifying that all chanes were covered), and less risk to miss individual modifications either from the Linux or from the U-Boot side.

Quoted 8 lines

Scott, I agree that your suggestion is what usually should work fine, but here it apparently fails in a number of places that would be time consuming to sort out - and I would expect that the same would happen again whenever we update to another new version of the Linux code base. So I think we should stick with Heiko's approach here; it documents clearly what he did, it looks complete, and it is working. I think it would be a waste of time to redo all the work, just differently.

Quoted 3 lines

OK, lets try this. One worry at the back of my mind is the fallout we had when we re-synced to v3.7.1 and tested things as best we were able to prior to merge. I think it's too late in the cycle to pull this in

Quoted 8 lines

Yes I fear such fallout too ... I could also test on some boards only, the rest is compile clean only ... thats the reason why I had the sync serie as RFC ... maybe we create a mtd-test branch? But on the other hand, things maybe get tested only, if they are in mainline ...

Quoted 1 line

for v2014.07, but lets get something in for v2014.10. And since v3.15

Yep, that was my plan too.

OK.

Quoted 13 lines
Quoted 3 lines

is already out, lets do (as part of testing our theories out), a follow up patch to sync up with v3.15. And finally, I think we need, in order to keep this pain point down, sync per kernel release.

Ok, I had prepared a v5, posting it soon.

I try to do also to prepare a seperate sync with v3.15 patch, but give me some time ... also I found a bug in current v3.16-rc1 kernel, using ubi fastmap, see:

"UBI: fix rb_tree node comparison in add_map commit buggy?"
http://lists.infradead.org/pipermail/linux-mtd/2014-June/054348.html

Quoted 8 lines

So current v3.16-rc1 kernel could not attach a ubi volume using ubi fastmap and created with a kernel not having commit 604b592e6fd3c98f21435e1181ba7723ffc24715 applied ... which is the case for v3.14 ... with my fixup, a v3.16-rc1 kernel could again attach a v3.14 kernel or U-Boot (with my v3.14 sync patches applied) created ubi volume ...

Maybe we wait with the sync, until this is sorted out?

Yes, that's fine. Perhaps we'll end up with a sync to v3.14 series, a v3.15 on top of it, and then backporting your bugfix patch(es) on top of that.

Quoted 2 lines

To sync us with each kernel release would be a good idea, but the problem would be, to find time for it ...

Yes, but I think if we do it more regularly it will be better for us and take less time.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140624/5204adcf/attachment.pgp>
#18 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Tom,

Am 24.06.2014 16:39, schrieb Tom Rini:

Quoted 8 lines · Heiko Schocher
Quoted 7 lines

Hello Tom,

Am 23.06.2014 17:05, schrieb Tom Rini:

Quoted 4 lines · Wolfgang Denk
Quoted 3 lines

Dear Heiko,

In message<[email protected]> you wrote:

[...]

Quoted 20 lines
Quoted 20 lines
Quoted 3 lines

is already out, lets do (as part of testing our theories out), a follow up patch to sync up with v3.15. And finally, I think we need, in order to keep this pain point down, sync per kernel release.

Ok, I had prepared a v5, posting it soon.

I try to do also to prepare a seperate sync with v3.15 patch, but give me some time ... also I found a bug in current v3.16-rc1 kernel, using ubi fastmap, see:

"UBI: fix rb_tree node comparison in add_map commit buggy?"
http://lists.infradead.org/pipermail/linux-mtd/2014-June/054348.html

So current v3.16-rc1 kernel could not attach a ubi volume using ubi fastmap and created with a kernel not having commit 604b592e6fd3c98f21435e1181ba7723ffc24715 applied ... which is the case for v3.14 ... with my fixup, a v3.16-rc1 kernel could again attach a v3.14 kernel or U-Boot (with my v3.14 sync patches applied) created ubi volume ...

Quoted 5 lines
Quoted 1 line

Maybe we wait with the sync, until this is sorted out?

Yes, that's fine. Perhaps we'll end up with a sync to v3.14 series, a v3.15 on top of it, and then backporting your bugfix patch(es) on top of that.

Ok, so let us bring in the v3.14 sync in the next merge window. I try to do some more tests with it ...

I did a fast sync with v3.15, compiled for arm, mips and powerpc but I have to test this, and this will takes some time, I currently not have ...

I did the sync in the following way:

- checked out in the linux tree the commit with which the U-Boot sync was done.

- copy all linux mtd,ubi and ubifs files to the U-Boot mtd,ubi,ubifs code

-> git diff will shows all U-Boot specific changes -> save this patch

- now in the linux tree checked out the new commit I wanted to sync U-Boot with

- copy all linux mtd,ubi and ubifs files from the new linux commit to the U-Boot mtd,ubi,ubifs code

- committed this for documentation only

- apply the u-boot specific changes patch now
- fixed small errors
This worked with some small correction very fast ...

ToDo:

- test
- commit and send to ML

Quoted 5 lines
Quoted 2 lines

To sync us with each kernel release would be a good idea, but the problem would be, to find time for it ...

Yes, but I think if we do it more regularly it will be better for us and take less time.

Definitely.

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#19 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Heiko Schocher
Quoted 8 lines · Heiko Schocher

Ok, did a "git diff v3.7.1..v3.14 ..." for drivers/mtd/nand and drivers/mtd/mtd*.{c,h} and applied it with "git am -3 ..." after fetching the Linux tree into my U-boot repository ... this command worked now nice ... but there are subtle diffs between the sources in the "copied from linux" tree and the "git am -3" tree ... which did not pop up when doing a "git am -3 ...", just detected them because I could do a diff between "my copied from linux" version and the "git am -3 ..." created version!

It looks like the 3.7.1 sync was mainly just the NAND code, not the rest of mtd, other than some API changes needed by the NAND code.

Did you find any differences in the NAND code?

Quoted 5 lines

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Yes, the 3-way merge approach requires that we know where and when the old code came from. Unfortunately that information is not present outside of drivers/mtd/nand, so for those directories starting from scratch is reasonable (unless we can figure it out based on when the code was added to U-Boot...). Once that's been done, future updates can be done with 3-way merges.

I still disagree with #ifndef __UBOOT__ as it will hurt more than it helps with future merges.

-Scott

#20 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Scott,

Am 24.06.2014 21:19, schrieb Scott Wood:

Quoted 10 lines · Heiko Schocher
Quoted 8 lines

Ok, did a "git diff v3.7.1..v3.14 ..." for drivers/mtd/nand and drivers/mtd/mtd*.{c,h} and applied it with "git am -3 ..." after fetching the Linux tree into my U-boot repository ... this command worked now nice ... but there are subtle diffs between the sources in the "copied from linux" tree and the "git am -3" tree ... which did not pop up when doing a "git am -3 ...", just detected them because I could do a diff between "my copied from linux" version and the "git am -3 ..." created version!

Quoted 2 lines

It looks like the 3.7.1 sync was mainly just the NAND code, not the rest of mtd, other than some API changes needed by the NAND code.

Yes.

Quoted 1 line

Did you find any differences in the NAND code?

IIRC, yes.

Quoted 6 lines
Quoted 5 lines

And I have no chance to detect this difference, when using "git am -3 ..." ... it just remains in the code ...

I vote for copying the linux files, marking U-Boot specific code with __UBOOT__ ...

Quoted 6 lines

Yes, the 3-way merge approach requires that we know where and when the old code came from. Unfortunately that information is not present outside of drivers/mtd/nand, so for those directories starting from scratch is reasonable (unless we can figure it out based on when the code was added to U-Boot...). Once that's been done, future updates can be done with 3-way merges.

Ok.

Quoted 2 lines

I still disagree with #ifndef __UBOOT__ as it will hurt more than it helps with future merges.

The remove of this is not to difficult ... Tom, Wolfgang? Should I remove?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#21 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Scott Wood

Dear Scott,

Quoted 3 lines · In message <[email protected]> you wrote:

I still disagree with #ifndef __UBOOT__ as it will hurt more than it helps with future merges.

I agree that #ifdef's should be avoided, but then here they also serve a documentation purpose as they clearly mark areas of code that are specific to U-Boot, or that are not used in U-Boot.

Do you think just of a removal, so there will be no trace left of which code was added for U-Boot, and which was removed? Or should these be turned into comments, something like

	/* BEGIN U-Boot specific code */
	...
	/* END U-Boot specific code */

[but that would not handle code removal well].

So what exactly is your proposal how the #fdef's should be removed?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It's not what you do, it's how you do what you do!  - Jordan D. Ulmer
#22 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 10 lines · Wolfgang Denk

Dear Scott,

Quoted 3 lines · In message <[email protected]> you wrote:

I still disagree with #ifndef __UBOOT__ as it will hurt more than it helps with future merges.

I agree that #ifdef's should be avoided, but then here they also serve a documentation purpose as they clearly mark areas of code that are specific to U-Boot, or that are not used in U-Boot.

git diff can do that too, without reducing readability or increasing the likelihood of mismerges.

Quoted 11 lines

Do you think just of a removal, so there will be no trace left of which code was added for U-Boot, and which was removed? Or should these be turned into comments, something like

	/* BEGIN U-Boot specific code */
	...
	/* END U-Boot specific code */

[but that would not handle code removal well].

So what exactly is your proposal how the #fdef's should be removed?

My proposal is to just remove them, similar to how the NAND code has been handled.

-Scott

#23 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Dear Scott,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

I agree that #ifdef's should be avoided, but then here they also serve a documentation purpose as they clearly mark areas of code that are specific to U-Boot, or that are not used in U-Boot.

git diff can do that too, without reducing readability or increasing the likelihood of mismerges.

(git) diff needs a reference to diff against. Maybe I missed some earlier comments about that, but how exactly should this be done here?

If we want to have strictly bisectable code in mainline, I don't really see how to provide an unmodified source reference to show the U-Boot specific diffs.

Can you please explain (maybe again, sorry) how you think the code update should be done do both allow such a git diff and remain bisectable? The ways I can see all require a non-working / non-com- piling intermediate step.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I'm what passes for a Unix guru in my office. This is  a  frightening
concept. - Lee Ann Goldstein, in <[email protected]>
#24 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Quoted 8 lines · Wolfgang Denk

Dear Scott,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines

I agree that #ifdef's should be avoided, but then here they also serve a documentation purpose as they clearly mark areas of code that are specific to U-Boot, or that are not used in U-Boot.

Quoted 6 lines
Quoted 2 lines

git diff can do that too, without reducing readability or increasing the likelihood of mismerges.

(git) diff needs a reference to diff against. Maybe I missed some earlier comments about that, but how exactly should this be done here?

When the code is synced, the corresponding Linux SHA1 or tag should be placed in the commit message. This is the case for the NAND code. Unfortunately it has never been true of the mtd/ubi code, but this do-over in those trees is an opportunity to fix that.

Quoted 8 lines

If we want to have strictly bisectable code in mainline, I don't really see how to provide an unmodified source reference to show the U-Boot specific diffs.

Can you please explain (maybe again, sorry) how you think the code update should be done do both allow such a git diff and remain bisectable? The ways I can see all require a non-working / non-com- piling intermediate step.

There is no intermediate step.

The unmodified source is in the Linux tree -- most likely in a more accurate/complete form than the ifdefs convey, since minor differences and subsequent local changes are unlikely to be marked.

You can either fetch the Linux tree into your local U-Boot repo (or vice versa) so that git diff can compare them, or you can check out separate repositories to the proper tags/SHAs and use ordinary diff. It's not something that I'd expect one to want to do very often, though. Usually you want to know how things work in the codebase you're working on, or you want to compare some specific aspect of the code which can more easily be done manually.

-Scott

#25 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Dear Scott,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines

(git) diff needs a reference to diff against. Maybe I missed some earlier comments about that, but how exactly should this be done here?

When the code is synced, the corresponding Linux SHA1 or tag should be placed in the commit message. This is the case for the NAND code. Unfortunately it has never been true of the mtd/ubi code, but this do-over in those trees is an opportunity to fix that.

Heiko already did that.

Quoted 10 lines

There is no intermediate step.

The unmodified source is in the Linux tree -- most likely in a more accurate/complete form than the ifdefs convey, since minor differences and subsequent local changes are unlikely to be marked.

You can either fetch the Linux tree into your local U-Boot repo (or vice versa) so that git diff can compare them, or you can check out separate repositories to the proper tags/SHAs and use ordinary diff. It's not something that I'd expect one to want to do very often, though. Usually

Are you talking here about the theoretitical possibility to do that, or have you actually done that - and found the result useful? Maybe I'm doing something wrong, but I get such a huge volume of new resp. deleted files that I find it really, really hard to see any diffs at all.

Quoted 3 lines

you want to know how things work in the codebase you're working on, or you want to compare some specific aspect of the code which can more easily be done manually.

Hm... I think I know what you have in mind. But did you actually try this out with the given code base? One problem I see is that the changes are scattered across the directory tree; we have changes in drivers/mtd, fs/ubifs, include/linux/mtd, and in include/mtd . I am not connvinced that this is a reliable way to study all changes; it seems too easy to me to miss some.

Note that I would like to follow your advice, but it is just not working in a sensible way to me, and I wonder if I'm doing something wrong. Maybe you could share the commands to generate such a diff between the U-Boot and the Linux sources - something that generates output equivalent running "git-format-patch --stdout HEAD^.." in Heiko's tree?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I read part of it all the way through.
#26 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Hello Scott,

In message <[email protected]> I wrote:
...

Quoted 18 lines
Quoted 4 lines

When the code is synced, the corresponding Linux SHA1 or tag should be placed in the commit message. This is the case for the NAND code. Unfortunately it has never been true of the mtd/ubi code, but this do-over in those trees is an opportunity to fix that.

Heiko already did that.

Quoted 10 lines

There is no intermediate step.

The unmodified source is in the Linux tree -- most likely in a more accurate/complete form than the ifdefs convey, since minor differences and subsequent local changes are unlikely to be marked.

You can either fetch the Linux tree into your local U-Boot repo (or vice versa) so that git diff can compare them, or you can check out separate repositories to the proper tags/SHAs and use ordinary diff. It's not something that I'd expect one to want to do very often, though. Usually

Quoted 5 lines

Are you talking here about the theoretitical possibility to do that, or have you actually done that - and found the result useful? Maybe I'm doing something wrong, but I get such a huge volume of new resp. deleted files that I find it really, really hard to see any diffs at all.

etc.

Do you have any further comments on that, i. e. do you really insist that the code be changes as you proposed?

I've tried that, but the result was worse than the current state. If you really want to get rid of the #ifdef's we should do this as a separate commit in Heiko's u-boot-testing branch, but otherwise I would really like to leave Heiko's code and approach as is, because it appears (to me) to be the easiest to reproduce and verify.

If you know better methods, then please show how these can be applied to this patch set in question here.

Thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When a program is being  tested,  it  is  too  late  to  make  design
changes.                  -- Geoffrey James, "The Tao of Programming"
#27 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Scott Wood
Quoted 36 lines · Scott Wood
Quoted 8 lines · Wolfgang Denk

Dear Scott,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines

I agree that #ifdef's should be avoided, but then here they also serve a documentation purpose as they clearly mark areas of code that are specific to U-Boot, or that are not used in U-Boot.

Quoted 6 lines
Quoted 2 lines

git diff can do that too, without reducing readability or increasing the likelihood of mismerges.

(git) diff needs a reference to diff against. Maybe I missed some earlier comments about that, but how exactly should this be done here?

When the code is synced, the corresponding Linux SHA1 or tag should be placed in the commit message. This is the case for the NAND code. Unfortunately it has never been true of the mtd/ubi code, but this do-over in those trees is an opportunity to fix that.

Quoted 8 lines

If we want to have strictly bisectable code in mainline, I don't really see how to provide an unmodified source reference to show the U-Boot specific diffs.

Can you please explain (maybe again, sorry) how you think the code update should be done do both allow such a git diff and remain bisectable? The ways I can see all require a non-working / non-com- piling intermediate step.

There is no intermediate step.

The unmodified source is in the Linux tree -- most likely in a more accurate/complete form than the ifdefs convey, since minor differences and subsequent local changes are unlikely to be marked.

Quoted 7 lines

You can either fetch the Linux tree into your local U-Boot repo (or vice versa) so that git diff can compare them, or you can check out separate repositories to the proper tags/SHAs and use ordinary diff. It's not something that I'd expect one to want to do very often, though. Usually you want to know how things work in the codebase you're working on, or you want to compare some specific aspect of the code which can more easily be done manually.

So an example of this would be doing say:

$ git diff 3dad234 drivers/mtd/nand/nand_base.c

Where 3dad234 is the last kernel commit to U-Boot drivers/mtd/nand/nand_base.c where we synced right (and we've fetched the kernel sources into this repo as well) ? (This commit is also valid for atmel_nand.c and I looked over the results there too..).

We must, really, follow the general rule where when we sync stuff from the kernel we say what the commit we synced with is, for UBI/etc. We may not have been for forever but the last time we also said that tag it was against.

But how we denote U-Boot vs Linux Kernel differences is somewhat up to the subsystem maintainer. We must be careful when syncing back. But looking over the above diff, as a more casual nand developer, I wish there was more in-code context about why we are different. But that's just me and how I develop. It would be pretty easy (but not quite easily scriptable) to whack out the #ifndef/else/endif __UBOOT__'s, commit that, and be back to having the output one wants, if that's how one works.

In sum, if Heiko is going to be owning UBI/related code and syncs, whatever makes life easiest on _him_ to make sure we don't have regressions is fine with me (within reason, and this seems to be within reason). Do not get me wrong please, I appreciate all the time you've spent thus far in U-Boot and wish and want you to comment / review / advise as you're still able to find time. But if someone else is taking up doing the re-syncs it needs to also fit their workflow.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140707/9691f12c/attachment.pgp>
#28 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

Dear Tom,

Quoted 11 lines · In message <20140707161204.GM29202@bill-the-cat> you wrote:
Quoted 8 lines

You can either fetch the Linux tree into your local U-Boot repo (or vice versa) so that git diff can compare them, or you can check out separate repositories to the proper tags/SHAs and use ordinary diff. It's not something that I'd expect one to want to do very often, though. Usually you want to know how things work in the codebase you're working on, or you want to compare some specific aspect of the code which can more easily be done manually.

So an example of this would be doing say:

$ git diff 3dad234 drivers/mtd/nand/nand_base.c

Yes - but this works only on a per-file or per-directory base. As I mentioned before, the code is scattered over a number of directories (and I'm not even sure that we don't have any renames to deal with).

Quoted 4 lines

Where 3dad234 is the last kernel commit to U-Boot drivers/mtd/nand/nand_base.c where we synced right (and we've fetched the kernel sources into this repo as well) ? (This commit is also valid for atmel_nand.c and I looked over the results there too..).

As Heiko explains in his posting, his patches are agains kernel tag v3.14 = commit ID 455c6fd

Quoted 4 lines

We must, really, follow the general rule where when we sync stuff from the kernel we say what the commit we synced with is, for UBI/etc. We may not have been for forever but the last time we also said that tag it was against.

Heiko included this information in his posting.

Quoted 7 lines

In sum, if Heiko is going to be owning UBI/related code and syncs, whatever makes life easiest on _him_ to make sure we don't have regressions is fine with me (within reason, and this seems to be within reason). Do not get me wrong please, I appreciate all the time you've spent thus far in U-Boot and wish and want you to comment / review / advise as you're still able to find time. But if someone else is taking up doing the re-syncs it needs to also fit their workflow.

Thanks. Well, officially UBI is in the responsibility of Kyungmin Park (though Stefan Roese did a major part of that work, too), and MTD is something we haven't defined yet. But I think Heiko will watch over this area and care about any upcoing issues related to this update at least for the next weeks and months...

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The best things in life are for a fee.
#29 lore raw

v4 cover mtd, ubi, ubifs: resync with Linux-3.14

In reply to Tom Rini
Quoted 13 lines · Tom Rini
Quoted 11 lines · Scott Wood

The unmodified source is in the Linux tree -- most likely in a more accurate/complete form than the ifdefs convey, since minor differences and subsequent local changes are unlikely to be marked.

You can either fetch the Linux tree into your local U-Boot repo (or vice versa) so that git diff can compare them, or you can check out separate repositories to the proper tags/SHAs and use ordinary diff. It's not something that I'd expect one to want to do very often, though. Usually you want to know how things work in the codebase you're working on, or you want to compare some specific aspect of the code which can more easily be done manually.

Quoted 6 lines

So an example of this would be doing say:

$ git diff 3dad234 drivers/mtd/nand/nand_base.c

Where 3dad234 is the last kernel commit to U-Boot drivers/mtd/nand/nand_base.c where we synced right (and we've fetched the kernel sources into this repo as well) ?

3dad234 was a cherry-pick, not a sync. The last sync was v3.7.1. To see the differences as of the last sync, do this:

git diff cc8605070 dfe64e2c drivers/mtd/nand/nand_base.c

Quoted 7 lines

(This commit is
also valid for atmel_nand.c and I looked over the results there too..).

We must, really, follow the general rule where when we sync stuff from the kernel we say what the commit we synced with is, for UBI/etc. We may not have been for forever but the last time we also said that tag it was against.

Yes. Unfortunately this can create misleading commit messages when some files are synced to a Linux SHA, and other files are merely touched to avoid resulting breakage. That SHA should be valid for core nand files, but probably not for most drivers. I don't think we've ever done centralized syncing of nand drivers.

Future merge commits should be more explicit about which files were synced.

Quoted 8 lines

But how we denote U-Boot vs Linux Kernel differences is somewhat up to the subsystem maintainer. We must be careful when syncing back. But looking over the above diff, as a more casual nand developer, I wish there was more in-code context about why we are different. But that's just me and how I develop. It would be pretty easy (but not quite easily scriptable) to whack out the #ifndef/else/endif __UBOOT__'s, commit that, and be back to having the output one wants, if that's how one works.

FWIW, back when the nand code had such ifdefs, there was rarely any explanation for the difference -- it was just a statement that a difference existed. Nor could I trust that all of the differences were documented that way, or that the code in ifndef sections was kept up to date.

Beyond readability and usefulness, my concern is that the ifndef code will cause mismerges in the future, if the if/else section is large enough that git doesn't flag it as a conflict, and thus needed changes don't get applied to the U-Boot side of the if/else.

Quoted 7 lines

In sum, if Heiko is going to be owning UBI/related code and syncs, whatever makes life easiest on _him_ to make sure we don't have regressions is fine with me (within reason, and this seems to be within reason). Do not get me wrong please, I appreciate all the time you've spent thus far in U-Boot and wish and want you to comment / review / advise as you're still able to find time. But if someone else is taking up doing the re-syncs it needs to also fit their workflow.

Yes, of course. For code outside drivers/mtd/nand, I'm just providing advice, based on what I felt did and did not work well in the nand code. That goes for nand as well if and when someone actually takes over the custodian role -- I said as much earlier in this discussion. If that helps motivate Heiko or someone else to formally take over the role sooner rather than later, then great. :-)

In the absence of a change in custodianship, my experience has been that a different person ends up submitting a sync each time. I would have also done an occasional sync myself if someone requested one based on missing important changes, but usually people have shown up with patches instead.

-Scott