Re: [PATCH] regulator: When constraining modes fall back to higherpower modes

From: Mark Brown
Date: Tue Mar 29 2011 - 19:39:07 EST


On Wed, Mar 30, 2011 at 12:29:24AM +0100, Liam Girdwood wrote:

> It's late and I'm wondering if it's cleaner here just to :-
>
> if (mask & *mode)
> return 0;

> *mode = fls(mask);
> if (*mode)
> return 0;

This will end up selecting the highest mode in mask, even if it's lower
than the one asked for, you'd need to recheck against the original mask.
There's a few ways I can think of to do that but they're none of them
exceptionally pretty.
--
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/