[go: up one dir, main page]

lkml.org 
[lkml]   [2013]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2013-09-19 17:21    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog