[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130919145001.GD21013@sirena.org.uk>
Date: Thu, 19 Sep 2013 15:50:01 +0100
From: Mark Brown <broonie@...nel.org>
To: Laxman Dewangan <ldewangan@...dia.com>
Cc: lgirdwood@...il.com, linux-kernel@...r.kernel.org,
swarren@...dia.com
Subject: Re: [PATCH] regulator: core: set current constraints while setting
machine constraints
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.
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists