lkml.org 
[lkml]   [2010]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 1/2] regulator: add support for regulators on the ab8500 MFD
From
On Wed, Oct 27, 2010 at 3:33 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Wed, Oct 27, 2010 at 02:25:44PM -0200, Thiago Farina wrote:
>
>> Shouldn't be this returning 1 instead of true and 0 instead false
>> (since the return type is int not bool)?
>
> There is no reason to do this, logical values are treated as 0 and 1 in
> C.  Using false and true is clear and won't cause any difference in
> code.
>
In C99 I suppose that is true and legal?

>> Maybe like this?
>> return (ret & info->mask) ? 1: 0;
>
> No, that's needlessly obfuscated.
>
Obfuscated? What you mean? It is a driver, and people reading and
writing a driver would know what it means, no?

Would be much simpler if it was just (like done in ab3100.c):

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

\
 
 \ /
  Last update: 2010-10-27 19:45    [W:0.330 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site