From patchwork Fri Oct 20 16:57:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 116514 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1903809qgn; Fri, 20 Oct 2017 09:59:07 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qze17A2MJfyClwKpqZwJnozL7QG9B9z+KPwylE9UkymVFfm2hZ7KxEBMY0awnlr89DNkz8 X-Received: by 10.98.53.1 with SMTP id c1mr5677641pfa.248.1508518747441; Fri, 20 Oct 2017 09:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508518747; cv=none; d=google.com; s=arc-20160816; b=iGsQ/CZdOqjaPhtpfxgdUyCeE/7dzBoDytBIB9HmekN//LO9Ru92kfeiv9s6dt0r3a l6v7l1EgLzcFrxdQ6qxJGqhhSZGbPtM9xA3FsAUkOOIh06aCtXLW2K0bTBXdBR8x+Viv 8WjgPwMHbiHd4Q34B1cowN5qScSeCskQb8gDjFtdtqo6O1GwvRutIfAQZ+q8FoRvvrSS +hMaqlKMhLQlg/ynEMKAWm1oqctwEO+fzPrR6s3EWZhcUfMpb26u8bCQaeDR0oy8us5R yuYKExHG7jTelhFxJ/Elsko5iBriUoOLejdtKtWOJ5Fohaux1ws2jpUO9qUWmdmHetq5 PKQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=ueNuoAFk4Pc4lNDsR86AXvbB/fri7i0Dzqywp3M7+6w=; b=pkbgUwevq8CvNm7i7jLdDVLGb/RJtg5JMMu0es28VWfDLmmH2womT3rVtp3vvjh2fy GxxRS8mw8J0C1sm8OLd2ACHNw9ETu6GZ8361k0NkyY0x3VwQZzzTvefn8zxXHn5OWPBv 76BSVnr9WIKLbEzINult5I4uidkEsHlXDOZvZH3OESoqOUs5SEc9cLM6XD0kCLo99RF+ 7IXteaaPBhJxB0a4TavbpqAiZUohViVonppJ4kynzs17+dYKfGt2ZVONDdb4peiEU6RA nM+x4lzGDr1z/pmq3ybSucu/JDHWwCqnTgbiIT/ljPOE5Er9kLAyNzVcX4+6ykjkTuBI m4vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u1sHFIfF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d127si929819pgc.372.2017.10.20.09.59.07; Fri, 20 Oct 2017 09:59:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=u1sHFIfF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbdJTQ7G (ORCPT + 27 others); Fri, 20 Oct 2017 12:59:06 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:25126 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753226AbdJTQ64 (ORCPT ); Fri, 20 Oct 2017 12:58:56 -0400 Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-07.nifty.com with ESMTP id v9KGwC3Z005656; Sat, 21 Oct 2017 01:58:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com v9KGwC3Z005656 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1508518693; bh=ueNuoAFk4Pc4lNDsR86AXvbB/fri7i0Dzqywp3M7+6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u1sHFIfFLM8e08EYitgocjlklyCmshAJJ5rWQFQ5bXgabhCz1loLkkaymhMGGlxfs NT0rLazWScR193G1cBJ3KkWvXN3ZOWi1uoREhki77deYrwHPuLTiXoatNx6LUyAzMt RB5xIIADnJfnqrW2Rsw4yp34F4DJ/2kv+DtlZVHs1GS/jTHuDCXJLv23nn3AwIpIIl CvBnvmF8t9R9EPTWDxPefGuO0PJ3MmHALek2GolYrBgiVbKpD3l5gjOohhbQoQuv+R Z2QOBBtuMl8mY2ldY4G6rjY7xuWvjuvSV4wUG92HJ5kcmbClibmq0WET36WK2Ji4sP 0ytrsxpD1L1IA== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: Greg Kroah-Hartman , linux-kernel@vger.kernel.org Cc: Srinivas Kandagatla , Masahiro Yamada Subject: [RESEND PATCH 1/5] nvmem: imx-iim: use stack for nvmem_config instead of malloc'ing it Date: Sat, 21 Oct 2017 01:57:38 +0900 Message-Id: <1508518662-8800-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508518662-8800-1-git-send-email-yamada.masahiro@socionext.com> References: <1508518662-8800-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nvmem_register() copies all the members of nvmem_config to nvmem_device. So, nvmem_config is one-time use data during probing. There is no point to keep it until the driver detach. Using stack should be no problem because nvmem_config is pretty small. Signed-off-by: Masahiro Yamada Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/imx-iim.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/nvmem/imx-iim.c b/drivers/nvmem/imx-iim.c index 52ff65e..a599260 100644 --- a/drivers/nvmem/imx-iim.c +++ b/drivers/nvmem/imx-iim.c @@ -34,7 +34,6 @@ struct imx_iim_drvdata { struct iim_priv { void __iomem *base; struct clk *clk; - struct nvmem_config nvmem; }; static int imx_iim_read(void *context, unsigned int offset, @@ -108,7 +107,7 @@ static int imx_iim_probe(struct platform_device *pdev) struct resource *res; struct iim_priv *iim; struct nvmem_device *nvmem; - struct nvmem_config *cfg; + struct nvmem_config cfg = {}; const struct imx_iim_drvdata *drvdata = NULL; iim = devm_kzalloc(dev, sizeof(*iim), GFP_KERNEL); @@ -130,19 +129,17 @@ static int imx_iim_probe(struct platform_device *pdev) if (IS_ERR(iim->clk)) return PTR_ERR(iim->clk); - cfg = &iim->nvmem; - - cfg->name = "imx-iim", - cfg->read_only = true, - cfg->word_size = 1, - cfg->stride = 1, - cfg->owner = THIS_MODULE, - cfg->reg_read = imx_iim_read, - cfg->dev = dev; - cfg->size = drvdata->nregs; - cfg->priv = iim; - - nvmem = nvmem_register(cfg); + cfg.name = "imx-iim", + cfg.read_only = true, + cfg.word_size = 1, + cfg.stride = 1, + cfg.owner = THIS_MODULE, + cfg.reg_read = imx_iim_read, + cfg.dev = dev; + cfg.size = drvdata->nregs; + cfg.priv = iim; + + nvmem = nvmem_register(&cfg); if (IS_ERR(nvmem)) return PTR_ERR(nvmem);