Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942055AbcLWTBq (ORCPT ); Fri, 23 Dec 2016 14:01:46 -0500 Received: from mail-wj0-f194.google.com ([209.85.210.194]:35575 "EHLO mail-wj0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753320AbcLWTBo (ORCPT ); Fri, 23 Dec 2016 14:01:44 -0500 Subject: Re: [PATCH] mtd: mtdswap: use MTDSWAP_ECNT_MIN/MAX To: Geliang Tang , David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger , Cyrille Pitchen References: <254e9f859fdb1f850c1d3bd5777e97bf468b4e5a.1482225376.git.geliangtang@gmail.com> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org From: Marek Vasut Message-ID: <252d763e-1767-9bf9-be1a-af0c02d4078f@gmail.com> Date: Fri, 23 Dec 2016 19:51:56 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <254e9f859fdb1f850c1d3bd5777e97bf468b4e5a.1482225376.git.geliangtang@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1242 Lines: 41 On 12/20/2016 02:54 PM, Geliang Tang wrote: > Since macros MTDSWAP_ECNT_MIN() and MTDSWAP_ECNT_MAX() have been > defined in mtdswap.c, use them instead of open-coding. > > Signed-off-by: Geliang Tang Sorry for getting to this so late. The patch is fine, but if you grep for 'rb_first' in the mtdswap driver , you'll see you can also use the MTDSWAP_ECNT_MIN macro in mtdswap_map_free_block() and in mtdswap_pick_gc_blk() . Can you fix those too ? Otherwise: Acked-by: Marek Vasut > --- > drivers/mtd/mtdswap.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c > index c40e2c9..f12879a 100644 > --- a/drivers/mtd/mtdswap.c > +++ b/drivers/mtd/mtdswap.c > @@ -1235,10 +1235,8 @@ static int mtdswap_show(struct seq_file *s, void *data) > > if (root->rb_node) { > count[i] = d->trees[i].count; > - min[i] = rb_entry(rb_first(root), struct swap_eb, > - rb)->erase_count; > - max[i] = rb_entry(rb_last(root), struct swap_eb, > - rb)->erase_count; > + min[i] = MTDSWAP_ECNT_MIN(root); > + max[i] = MTDSWAP_ECNT_MAX(root); > } else > count[i] = 0; > } > -- Best regards, Marek Vasut