[U-Boot] [PATCH v1 1/2] mtd, ubi, ubifs: update for the sync with linux v3.14

Heiko Schocher hs at denx.de
Tue Jul 15 16:08:42 CEST 2014


while playing with the new mtd/ubi/ubifs sync, found some
small updates for it:

- add del_mtd_partition() to include/linux/mtd/mtd
- mtd: add a debug_printf
- remove some not used functions

Signed-off-by: Heiko Schocher <hs at denx.de>
Cc: Scott Wood <scottwood at freescale.com>
Cc: Tom Rini <trini at ti.com>

---

This patch is based on the mtd/ubi/ubifs sync with linux v3.14
patches, see:

[U-Boot] [PATCH v5 0/5] mtd, ubi, ubifs: resync with Linux-3.14
http://lists.denx.de/pipermail/u-boot/2014-June/182501.html

Patchwork [U-Boot,v5,1/5] lib, rbtree: resync with Linux-3.14
http://patchwork.ozlabs.org/patch/363332/

Patchwork [U-Boot,v5,2/5] lib, list_sort: add list_sort from linux 3.14
http://patchwork.ozlabs.org/patch/363335/

Patchwork [U-Boot,v5,3/5] linux include: add ERR_CAST
http://patchwork.ozlabs.org/patch/363334/

Patchwork [U-Boot,v5,4/5] lib, linux: move linux specific defines to linux/compat.h
http://patchwork.ozlabs.org/patch/363333/

Patchwork [U-Boot,v5,5/5] mtd, ubi, ubifs: resync with Linux-3.14
http://patchwork.ozlabs.org/patch/363343/
---
 drivers/mtd/mtdcore.c   | 2 ++
 drivers/mtd/mtdpart.c   | 2 ++
 fs/ubifs/super.c        | 6 ++++++
 include/linux/mtd/mtd.h | 1 +
 4 files changed, 11 insertions(+)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 796ac07..bdb94ce 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -476,6 +476,8 @@ int add_mtd_device(struct mtd_info *mtd)
 	   the notifier, since we hold the mtd_table_mutex */
 	list_for_each_entry(not, &mtd_notifiers, list)
 		not->add(mtd);
+#else
+	pr_debug("mtd: Giving out device %d to %s\n", i, mtd->name);
 #endif
 
 	mutex_unlock(&mtd_table_mutex);
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d20b857..3dc47b3 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -572,6 +572,7 @@ out_register:
 	return slave;
 }
 
+#ifndef __UBOOT__
 int mtd_add_partition(struct mtd_info *master, const char *name,
 		      long long offset, long long length)
 {
@@ -651,6 +652,7 @@ int mtd_del_partition(struct mtd_info *master, int partno)
 	return ret;
 }
 EXPORT_SYMBOL_GPL(mtd_del_partition);
+#endif
 
 /*
  * This function, given a master MTD object and a partition table, creates
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 9c87db4..5f53691 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2241,8 +2241,14 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
 	int err;
 
 	c->vfs_sb = sb;
+#ifndef __UBOOT__
 	/* Re-open the UBI device in read-write mode */
 	c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READWRITE);
+#else
+	/* U-Boot read only mode */
+	c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY);
+#endif
+
 	if (IS_ERR(c->ubi)) {
 		err = PTR_ERR(c->ubi);
 		goto out;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 47fd6f0..8561b78 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -480,6 +480,7 @@ static inline int mtd_is_bitflip_or_eccerr(int err) {
 #ifdef __UBOOT__
 /* drivers/mtd/mtdcore.h */
 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 *);
 
-- 
1.8.3.1



More information about the U-Boot mailing list