From patchwork Sun Sep 28 06:37:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tlinder X-Patchwork-Id: 4990961 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3BE019F2BB for ; Sun, 28 Sep 2014 06:37:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 25B0C20260 for ; Sun, 28 Sep 2014 06:37:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3C2562022D for ; Sun, 28 Sep 2014 06:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753581AbaI1Ghr (ORCPT ); Sun, 28 Sep 2014 02:37:47 -0400 Received: from smtp.codeaurora.org ([198.145.11.231]:54162 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753578AbaI1Ghq (ORCPT ); Sun, 28 Sep 2014 02:37:46 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 97F1013F8D7; Sun, 28 Sep 2014 06:37:45 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 8B5D213F904; Sun, 28 Sep 2014 06:37:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from lx-tlinder.mea.qualcomm.com (unknown [185.23.60.4]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: tlinder@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4210313F8D7; Sun, 28 Sep 2014 06:37:43 +0000 (UTC) From: Tanya Brokhman To: dedeking1@gmail.com Cc: linux-mtd@lists.infradead.org, linux-arm-msm@vger.kernel.org, Tatyana Brokhman , Artem Bityutskiy , David Woodhouse , Brian Norris , linux-kernel@vger.kernel.org (open list) Subject: [RFC/PATCH 3/5] mtd: ubi: Make in_wl_tree function public Date: Sun, 28 Sep 2014 09:37:37 +0300 Message-Id: <1411886257-8603-1-git-send-email-tlinder@codeaurora.org> X-Mailer: git-send-email 1.8.5.2 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tatyana Brokhman Make the in_wl_tree function public to be used outside of wl.c. Rename it to ubi_in_wl_tree. Signed-off-by: Tanya Brokhman --- drivers/mtd/ubi/ubi.h | 1 + drivers/mtd/ubi/wl.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index e4c97ad..ed04de2 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -872,6 +872,7 @@ int ubi_wl_put_fm_peb(struct ubi_device *ubi, struct ubi_wl_entry *used_e, int ubi_is_erase_work(struct ubi_work *wrk); void ubi_refill_pools(struct ubi_device *ubi); int ubi_ensure_anchor_pebs(struct ubi_device *ubi); +int ubi_in_wl_tree(struct ubi_wl_entry *e, struct rb_root *root); /* io.c */ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 2b4e6fe..64c7dfd 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -291,14 +291,14 @@ static int produce_free_peb(struct ubi_device *ubi) } /** - * in_wl_tree - check if wear-leveling entry is present in a WL RB-tree. + * ubi_in_wl_tree - check if wear-leveling entry is present in a WL RB-tree. * @e: the wear-leveling entry to check * @root: the root of the tree * * This function returns non-zero if @e is in the @root RB-tree and zero if it * is not. */ -static int in_wl_tree(struct ubi_wl_entry *e, struct rb_root *root) +int ubi_in_wl_tree(struct ubi_wl_entry *e, struct rb_root *root) { struct rb_node *p; @@ -1607,13 +1607,13 @@ retry: spin_unlock(&ubi->wl_lock); return 0; } else { - if (in_wl_tree(e, &ubi->used)) { + if (ubi_in_wl_tree(e, &ubi->used)) { self_check_in_wl_tree(ubi, e, &ubi->used); rb_erase(&e->u.rb, &ubi->used); - } else if (in_wl_tree(e, &ubi->scrub)) { + } else if (ubi_in_wl_tree(e, &ubi->scrub)) { self_check_in_wl_tree(ubi, e, &ubi->scrub); rb_erase(&e->u.rb, &ubi->scrub); - } else if (in_wl_tree(e, &ubi->erroneous)) { + } else if (ubi_in_wl_tree(e, &ubi->erroneous)) { self_check_in_wl_tree(ubi, e, &ubi->erroneous); rb_erase(&e->u.rb, &ubi->erroneous); ubi->erroneous_peb_count -= 1; @@ -1661,8 +1661,8 @@ int ubi_wl_scrub_peb(struct ubi_device *ubi, int pnum) retry: spin_lock(&ubi->wl_lock); e = ubi->lookuptbl[pnum]; - if (e == ubi->move_from || in_wl_tree(e, &ubi->scrub) || - in_wl_tree(e, &ubi->erroneous)) { + if (e == ubi->move_from || ubi_in_wl_tree(e, &ubi->scrub) || + ubi_in_wl_tree(e, &ubi->erroneous)) { spin_unlock(&ubi->wl_lock); return 0; } @@ -1680,7 +1680,7 @@ retry: goto retry; } - if (in_wl_tree(e, &ubi->used)) { + if (ubi_in_wl_tree(e, &ubi->used)) { self_check_in_wl_tree(ubi, e, &ubi->used); rb_erase(&e->u.rb, &ubi->used); } else { @@ -2150,7 +2150,7 @@ static int self_check_in_wl_tree(const struct ubi_device *ubi, if (!ubi_dbg_chk_gen(ubi)) return 0; - if (in_wl_tree(e, root)) + if (ubi_in_wl_tree(e, root)) return 0; ubi_err("self-check failed for PEB %d, EC %d, RB-tree %p ",