mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: lgirdwood@gmail.com, linux-kernel@vger.kernel.org, swarren@nvidia.com
Subject: Re: [PATCH] regulator: core: set current constraints while setting machine constraints
Date: Thu, 19 Sep 2013 15:50:01 +0100	[thread overview]
Message-ID: <20130919145001.GD21013@sirena.org.uk> (raw)
In-Reply-To: <1379601988-25839-1-git-send-email-ldewangan@nvidia.com>

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

On Thu, Sep 19, 2013 at 08:16:28PM +0530, Laxman Dewangan wrote:

> +	if (!rdev->desc->ops->set_current_limit ||
> +			!rdev->desc->ops->get_current_limit)
> +		return 0;
> +

The indentation here is odd and we probably ought to complain if someone
tries to set a current constarint on a regulator that doesn't support
the operation, if only to avoid surprises later on when the limits don't
take effect.

> +	current_uA = rdev->desc->ops->get_current_limit(rdev);
> +	if (current_uA < rdev->constraints->min_uA ||
> +			current_uA > rdev->constraints->max_uA) {
> +		ret = rdev->desc->ops->set_current_limit(rdev,
> +				rdev->constraints->min_uA,
> +				rdev->constraints->max_uA);
> +		if (ret < 0) {
> +			rdev_err(rdev,
> +				"Failed to set current constraint, %d\n", ret);
> +			return ret;
> +		}

Why is this conditional on the existing setting?  Just apply the
constraint.

> +	}
> +	return 0;

Missing blank.

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

      reply	other threads:[~2013-09-19 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19 14:46 Laxman Dewangan
2013-09-19 14:50 ` Mark Brown [this message]

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=20130919145001.GD21013@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=ldewangan@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swarren@nvidia.com \
    /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®