Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751578AbdIUCKX (ORCPT ); Wed, 20 Sep 2017 22:10:23 -0400 Received: from conssluserg-03.nifty.com ([210.131.2.82]:48491 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbdIUCKW (ORCPT ); Wed, 20 Sep 2017 22:10:22 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com v8L2AGjn009315 X-Nifty-SrcIP: [209.85.161.177] X-Google-Smtp-Source: AOwi7QA+AYJsdq50SNYcPdj7zQR2ORYh7SrjARELrkUK/kFTJ3L31KA8zd7OidDT5Gu9iHkwT7GtLT23OUBOh0Q0yLQ= MIME-Version: 1.0 In-Reply-To: <1505925159.17049.12.camel@mtkswgap22> 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> From: Masahiro Yamada Date: Thu, 21 Sep 2017 11:09:35 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/5] nvmem: mtk-efuse: use stack for nvmem_config instead of malloc'ing it To: Sean Wang Cc: Srinivas Kandagatla , Jassi Brar , Keiji Hayashibara , Linux Kernel Mailing List , "moderated list:ARM/Mediatek SoC support" , Masami Hiramatsu , Matthias Brugger , 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: 972 Lines: 37 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. 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. 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. -- Best Regards Masahiro Yamada