Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753359AbdLEKDM (ORCPT ); Tue, 5 Dec 2017 05:03:12 -0500 Received: from conssluserg-06.nifty.com ([210.131.2.91]:39881 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752713AbdLEKDK (ORCPT ); Tue, 5 Dec 2017 05:03:10 -0500 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com vB5A37cX014512 X-Nifty-SrcIP: [209.85.213.41] X-Google-Smtp-Source: AGs4zMYVXSQTRdvUb1SJGBf7imJsY1GOzCn+AFJm0nS7RWp2mri6iNNR2vcCOVjog9Xs5OB/HMn4jEZMGugE8yXkKBY= MIME-Version: 1.0 In-Reply-To: <20171204101043.602ff213@bbrezillon> References: <1512366470-16772-1-git-send-email-yamada.masahiro@socionext.com> <20171204101043.602ff213@bbrezillon> From: Masahiro Yamada Date: Tue, 5 Dec 2017 19:02:26 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mtd: nand: squash struct nand_buffers into struct nand_chip To: Boris Brezillon Cc: Kamal Dasu , Richard Weinberger , Linux Kernel Mailing List , Broadcom Kernel Feedback List , Marek Vasut , Chen-Yu Tsai , linux-mtd , Cyrille Pitchen , Han Xu , Maxime Ripard , Brian Norris , David Woodhouse , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1140 Lines: 38 Hi Boris, 2017-12-04 18:10 GMT+09:00 Boris Brezillon : >> } >> >> if (!(chip->options & NAND_OWN_BUFFERS)) { >> - nbuf = kzalloc(sizeof(*nbuf), GFP_KERNEL); >> - if (!nbuf) >> + chip->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL); >> + if (!chip->ecccalc) >> return -ENOMEM; >> >> - nbuf->ecccalc = kmalloc(mtd->oobsize, GFP_KERNEL); >> - if (!nbuf->ecccalc) { >> + chip->ecccode = kmalloc(mtd->oobsize, GFP_KERNEL); >> + if (!chip->ecccode) { >> ret = -ENOMEM; >> goto err_free_nbuf; >> } > > Hm, again not directly related to this patch, but I wonder if we > couldn't allocate those buffers only when they are really needed. For > example, most NAND controllers do the ECC calculation/correct in HW and > simply don't need those buffers. The only idea I came up with is to add a new flag, but I am not sure if you are happy with it because we are removing NAND_OWN_BUFFERS. -- Best Regards Masahiro Yamada