RE: [PATCH v2] regulator: ad5398: Fix min/max current limitboundary checking

From: Axel Lin
Date: Tue Jul 03 2012 - 23:18:57 EST



> >That is why we need to add:
> >if (min_uA < chip->min_uA)
> > min_uA = chip->min_uA;
> >
>
> Yes, but if you apply this logic to min_uA, you should apply the same logic to max_uA, even though it is not used in your application.

Actually, the logic is the same:
to find a supported (minmal) current in specified range.

The question is the equation used in current code does not allow
min_uA < chip->min_uA.
Setting min_uA = chip->min_uA if min_uA < chip->min_uA does make sense
because botch request actually returns the same current value.
( I mean no user visible change )

Adding below logic is not necessary.
( Note: Adding this or not does not have any user visible change, it's
just not necessary)

if (max_uA > chip->min_uA)
max_uA = chip->max_uA;

It is not necessary because the equation to choose selector does not
depends on max_uA. No matter if we set max_uA = chip->max_uA or not in
this case, it does not impact the equation to choose the selector.

But, well, if you really prefer adding it. I'll send a v3 for it.
Just let me know how do you think.

Regards,
Axel


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/