Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1516312

[PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available

Path csiph.com!1.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!enother.net!enother.net!enother.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Zach Brown <zach.brown@ni.com>
Newsgroups linux.kernel
Subject [PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available
Date Mon, 07 Nov 2016 17:50:03 +0100
Message-ID <sAVhp-5CE-43@gated-at.bofh.it> (permalink)
References <sAVho-5CE-1@gated-at.bofh.it>
X-Original-To <dwmw2@infradead.org>
X-Mailer git-send-email 2.7.4
MIME-Version 1.0
Content-Type text/plain
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:,, definitions=2016-11-07_07:,, signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611070304
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 29
Organization linux.* mail to news gateway
X-Original-Cc <computersforpeace@gmail.com>, <boris.brezillon@free-electrons.com>, <richard@nod.at>, <dedekind1@gmail.com>, <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>
X-Original-Date Mon, 7 Nov 2016 10:36:10 -0600
X-Original-Message-ID <1478536573-17610-3-git-send-email-zach.brown@ni.com>
X-Original-References <1478536573-17610-1-git-send-email-zach.brown@ni.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1516312

Show key headers only | View raw


From: Jeff Westfahl <jeff.westfahl@ni.com>

Use the MTD function 'max_bad_blocks' to compute the UBI bad_peb_limit,
if the function is implemented for an MTD and doesn't return an error.

Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Signed-off-by: Zach Brown <zach.brown@ni.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electron.com>
---
 drivers/mtd/ubi/build.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 85d54f3..e9940a9 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -584,6 +584,10 @@ static int get_bad_peb_limit(const struct ubi_device *ubi, int max_beb_per1024)
 	int limit, device_pebs;
 	uint64_t device_size;
 
+	limit = mtd_max_bad_blocks(ubi->mtd, 0, ubi->mtd->size);
+	if (limit > 0)
+		return limit;
+
 	if (!max_beb_per1024)
 		return 0;
 
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/5] mtd: use ONFI bad blocks per LUN to calculate UBI bad PEB limit Zach Brown <zach.brown@ni.com> - 2016-11-07 17:50 +0100
  [PATCH v5 4/5] mtd: nand: implement 'max_bad_blocks' mtd function Zach Brown <zach.brown@ni.com> - 2016-11-07 17:50 +0100
  [PATCH v5 1/5] mtd: introduce function max_bad_blocks Zach Brown <zach.brown@ni.com> - 2016-11-07 17:50 +0100
  [PATCH v5 3/5] mtd: nand: Add max_bb_per_die and blocks_per_die fields to nand_chip Zach Brown <zach.brown@ni.com> - 2016-11-07 17:50 +0100
  [PATCH v5 2/5] mtd: ubi: use 'max_bad_blocks' to compute bad_peb_limit if available Zach Brown <zach.brown@ni.com> - 2016-11-07 17:50 +0100
  [PATCH v5 5/5] mtd: nand: set max_bb_per_die and blocks_per_die for ONFI compliant chips Zach Brown <zach.brown@ni.com> - 2016-11-07 17:50 +0100

csiph-web