Re: [patch] leds: renesas-tpu: cleanup a small type issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 30, 2013 at 1:59 AM, walter harms <wharms@xxxxxx> wrote:
>
>
> Am 29.05.2013 23:15, schrieb Dan Carpenter:
>> On Wed, May 29, 2013 at 07:34:39PM +0200, walter harms wrote:
>>
>>> int would be a more "natural" choice.
>>>
>>
>> You should never use signed types for a bit field.  That's just
>> asking for a sign expansion bug.
>
> my idea was more to use unsigned int instead of u16.
> Personally i try to avoid this (artificial) types as much as possible,
>

In this case, "val" is an unsigned 16 bits value for register
operation nothing else. 'u16' is correct for this usage and it's more
portable. It should be always unsigned 16 bits type crossing all the
architecture. But unsigned int is not always 32 bits and unsigned
short is not always 16 bits on every platform.

Thanks,
-Bryan
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux