Use of data types
Russell King - ARM Linux
linux at arm.linux.org.uk
Mon Jan 18 08:48:57 EST 2010
On Mon, Jan 18, 2010 at 02:41:20PM +0100, Uwe Kleine-König wrote:
> Hello,
>
> On Mon, Jan 18, 2010 at 09:43:12PM +0900, Khushhua Mogambo wrote:
> > Hi
> > I starting to port Linux kernel to my companies new ARM based
> > SoC and development board.
> >
> > Some of the regs is 16bits wide and some is 32bits width. I ask if
> > my using u16 and u32 in place of 'unsigned short' and 'unsigned int'
> > in the whole porting would be acceptable or not?
> >
> > In different wording, using only u16 and u32 always is considered good
> > quality or bad?
> I prefer using u32 over int. Still more if your register space isn't uniform.
u32 should be used for things that you want to be an unsigned 32-bit and
nothing else. int and unsigned int for integers where the size doesn't
matter that much.
So, if you want a data type that is unsigned 32-bit, use u32. If not,
use unsigned int or similar.
More information about the linux-arm-kernel
mailing list