Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845AbdIVD7y (ORCPT ); Thu, 21 Sep 2017 23:59:54 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:62752 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751726AbdIVD7x (ORCPT ); Thu, 21 Sep 2017 23:59:53 -0400 X-UUID: af39409fb4874d15a0919ba6a17c8ccb-20170922 Message-ID: <1506052787.21515.10.camel@mtkswgap22> Subject: Re: [PATCH 2/5] nvmem: mtk-efuse: use stack for nvmem_config instead of malloc'ing it From: Sean Wang To: Masahiro Yamada CC: Srinivas Kandagatla , Jassi Brar , Keiji Hayashibara , Linux Kernel Mailing List , "moderated list:ARM/Mediatek SoC support" , Masami Hiramatsu , Matthias Brugger , linux-arm-kernel Date: Fri, 22 Sep 2017 11:59:47 +0800 In-Reply-To: References: <1505134864-11975-1-git-send-email-yamada.masahiro@socionext.com> <1505134864-11975-3-git-send-email-yamada.masahiro@socionext.com> <1505925159.17049.12.camel@mtkswgap22> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1373 Lines: 52 Hi, Masahiro On Thu, 2017-09-21 at 11:09 +0900, Masahiro Yamada wrote: > Hi Sean, > > > 2017-09-21 1:32 GMT+09:00 Sean Wang : > > Hi, Masahiro > > > > For maintainability, I felt it's better if we use the same way to > > register nvmem as that most drivers does under nvmem usually using > > static structure. Otherwise, they should also be changed to use the > > one-time data in stack to avoid extra bytes to keep them. > > > > Sean > > > Srinivas and I discussed the best practice for allocating nvmem_config. > https://lkml.org/lkml/2017/9/11/4 > > From the discussion, static structure is possible only when > the system has one instance of the device. > thank you for your detailed explanation > If you know this is the case for mediatek, > yes, you can turn it into static, > but it is not always possible. > For example, Socionext SoCs have > two banks of efuse devices. > there should be only one instance of nvmem for mediatek soc, currently > So, if we want to align the coding style for consistency, > nvmem in stack is safe and efficient, I think. > > > Moving one-time data into stack slightly > reduces the kernel image size. > > agreed on those statements, indeed bigger struct uart_8250_port is still used on stack for configuring in a lot 8250 driver, so Acked-by: Sean Wang