On Fri, Nov 04, 2016 at 02:42:34PM +0100, Allan W. Nielsen wrote:
> On 04/11/16 13:27, Andrew Lunn wrote:
> > > +     } else if (count) {
> > > +             /* Downshift count is either 2,3,4 or 5 */
> > > +             count = (((count - 2) << DOWNSHIFT_CNTL_POS) | 
> > > DOWNSHIFT_EN);
> > 
> > Ah, now i see why + 2. But this means it never does what you ask it to
> > do. It would be better to round up < 2 to 2, and leave all the others
> > as is.
> Not sure I understand what you mean...
> 
> If the user configure "count == 1", then you want that to be rounded up to
> "count == 2", because the HW does not support a count of 1???

Yes. The other option would be to return ERANGE when 1 is asked
for. The real question is, which is better for the user? Returning
ERANGE and letting the user make a guessing game to figure out what is
valid, or magically turn 1 into 2. I will let you decide which is
best.

> If the user configure count to 6, 7, 8 etc. would you also like to round it 
> down
> to 5?

No. ERANGE. The user has to expect some upper limit, and ERANGE is a
good indication they have reached it. But having a lowered limit of 2
is less obvious.

   Andrew

Reply via email to