From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Keiji Hayashibara <hayashibara.keiji@socionext.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Jassi Brar <jaswinder.singh@linaro.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] nvmem: imx-iim: use stack for nvmem_config instead of malloc'ing it
Date: Mon, 11 Sep 2017 22:01:00 +0900 [thread overview]
Message-ID: <1505134864-11975-2-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1505134864-11975-1-git-send-email-yamada.masahiro@socionext.com>
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 <yamada.masahiro@socionext.com>
---
drivers/nvmem/imx-iim.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
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);
--
2.7.4
next prev parent reply other threads:[~2017-09-11 13:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-11 13:00 [PATCH 0/5] nvmem: some cleanups and sparse warning fixes Masahiro Yamada
2017-09-11 13:01 ` Masahiro Yamada [this message]
2017-09-11 13:01 ` [PATCH 2/5] nvmem: mtk-efuse: use stack for nvmem_config instead of malloc'ing it Masahiro Yamada
2017-09-20 16:32 ` Sean Wang
2017-09-21 2:09 ` Masahiro Yamada
2017-09-22 3:59 ` Sean Wang
2017-09-11 13:01 ` [PATCH 3/5] nvmem: mtk-efuse: fix different address space warnings of sparse Masahiro Yamada
2017-09-20 16:19 ` Sean Wang
2017-09-11 13:01 ` [PATCH 4/5] nvmem: qfprom: " Masahiro Yamada
2017-09-11 13:01 ` [PATCH 5/5] nvmem: set nvmem->owner to nvmem->dev->driver->owner if unset Masahiro Yamada
2017-09-20 10:02 ` [PATCH 0/5] nvmem: some cleanups and sparse warning fixes Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505134864-11975-2-git-send-email-yamada.masahiro@socionext.com \
--to=yamada.masahiro@socionext.com \
--cc=hayashibara.keiji@socionext.com \
--cc=jaswinder.singh@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®