public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@avionic-design.de>
To: Bibek Basu <bbasu@nvidia.com>
Cc: linus.walleij@linaro.org, swarren@wwwdotorg.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pritesh Raithatha <praithatha@nvidia.com>
Subject: Re: [PATCH 1/2] pinctrl: tegra: add suspend-resume support
Date: Tue, 23 Apr 2013 20:43:32 +0200	[thread overview]
Message-ID: <20130423184332.GA31374@avionic-0098.mockup.avionic-design.de> (raw)
In-Reply-To: <1366740542-26127-1-git-send-email-bbasu@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 1771 bytes --]

> diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
[...]
> @@ -41,6 +42,8 @@ struct tegra_pmx {
>  
>  	int nbanks;
>  	void __iomem **regs;
> +	int *regs_size;

Perhaps this should be unsigned int *. The values stored in this array
will never be negative, right?

>  int tegra_pinctrl_probe(struct platform_device *pdev,
>  			const struct tegra_pinctrl_soc_data *soc_data)
>  {
> -	struct tegra_pmx *pmx;
>  	struct resource *res;
> -	int i;
> +	struct tegra_pmx *pmx;
> +	int i, pg_data_size = 0;

There's a needless move of the pmx variable declaration here.

> @@ -735,6 +769,21 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
>  		return -ENODEV;
>  	}
>  
> +if (IS_ENABLED(CONFIG_PM_SLEEP))
> +	pmx->regs_size = devm_kzalloc(&pdev->dev,
> +				pmx->nbanks * sizeof(*(pmx->regs_size)),
> +				GFP_KERNEL);
> +	if (!pmx->regs_size) {
> +		dev_err(&pdev->dev, "Can't alloc regs pointer\n");
> +		return -ENODEV;
> +	}
> +
> +	pmx->pg_data = devm_kzalloc(&pdev->dev, pg_data_size, GFP_KERNEL);
> +	if (!pmx->pg_data) {
> +		dev_err(&pdev->dev, "Can't alloc pingroup data pointer\n");
> +		return -ENODEV;
> +	}

I don't think this works the way you expect it to. The line

	if (IS_ENABLED(CONFIG_PM_SLEEP))

is a standard conditional and therefore needs to be properly indented
and use { and } to delimit the block.

> @@ -756,6 +805,9 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
>  			dev_err(&pdev->dev, "Couldn't ioremap regs %d\n", i);
>  			return -ENODEV;
>  		}
> +
> +if (IS_ENABLED(CONFIG_PM_SLEEP))
> +		pmx->regs_size[i] = resource_size(res);

In this case it will actually work as expected, but the if () should be
properly indented.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2013-04-23 18:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 18:09 [PATCH 1/2] pinctrl: tegra: add suspend-resume support Bibek Basu
2013-04-23 18:09 ` [PATCH 2/2] ARM: DT: tegra: pinctrl suspend resume hook Bibek Basu
2013-04-26 19:49   ` Thierry Reding
2013-04-28 13:42     ` Bibek Basu
2013-05-02 18:33       ` Stephen Warren
2013-04-23 18:43 ` Thierry Reding [this message]
2013-04-28 13:38   ` [PATCH 1/2] pinctrl: tegra: add suspend-resume support Bibek Basu

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=20130423184332.GA31374@avionic-0098.mockup.avionic-design.de \
    --to=thierry.reding@avionic-design.de \
    --cc=bbasu@nvidia.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=praithatha@nvidia.com \
    --cc=swarren@wwwdotorg.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