From: Stefan Agner <stefan@agner.ch>
To: linus.walleij@linaro.org
Cc: u.kleine-koenig@pengutronix.de, kernel@pengutronix.de,
shawn.guo@linaro.org, linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stefan@agner.ch
Subject: [PATCH] pinctrl: imx: do not implicitly set pin regs to -1
Date: Fri, 6 Feb 2015 17:30:56 +0100 [thread overview]
Message-ID: <1423240256-27210-1-git-send-email-stefan@agner.ch> (raw)
Commit 3dac1918a491 ("pinctrl: imx: detect uninitialized pins") needs
the values in struct imx_pin_reg to be -1. This has been done in a
rather unorthodox way by setting the memory to 0xff using memset...
Use a proper for loop to initialize the whole array with -1.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 52f2b94..95041b6 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -645,7 +645,7 @@ int imx_pinctrl_probe(struct platform_device *pdev,
{
struct imx_pinctrl *ipctl;
struct resource *res;
- int ret;
+ int ret, i;
if (!info || !info->pins || !info->npins) {
dev_err(&pdev->dev, "wrong pinctrl info\n");
@@ -662,7 +662,11 @@ int imx_pinctrl_probe(struct platform_device *pdev,
info->npins, GFP_KERNEL);
if (!info->pin_regs)
return -ENOMEM;
- memset(info->pin_regs, 0xff, sizeof(*info->pin_regs) * info->npins);
+
+ for (i = 0; i < info->npins; i++) {
+ info->pin_regs[i].mux_reg = -1;
+ info->pin_regs[i].conf_reg = -1;
+ }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ipctl->base = devm_ioremap_resource(&pdev->dev, res);
--
2.2.2
next reply other threads:[~2015-02-06 16:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 16:30 Stefan Agner [this message]
2015-02-06 19:21 ` [PATCH] pinctrl: imx: do not implicitly set pin regs to -1 Uwe Kleine-König
2015-02-06 19:40 ` Stefan Agner
2015-03-02 11:45 ` Shawn Guo
2015-03-02 12:59 ` Uwe Kleine-König
2015-03-02 13:42 ` Stefan Agner
2015-03-02 15:53 ` Uwe Kleine-König
2015-03-04 23:23 ` Stefan Agner
2015-03-09 16:18 ` Linus Walleij
2015-03-09 16:18 ` Linus Walleij
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=1423240256-27210-1-git-send-email-stefan@agner.ch \
--to=stefan@agner.ch \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shawn.guo@linaro.org \
--cc=u.kleine-koenig@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).