Subject: Re: MPC8349ea Random Device Generator driver

From: Timur Tabi <[email-masked]>
Date: Wed, 06 Jun 2007 17:07:05 -0500

Olof Johansson wrote:

> There's nothing wrong with the way he coded that up. Lots of drivers
> are written that way (all of mine are). It's at least as clear as any
> structure, and it doesn't cause temptation to do...

That vast majority of Freescale SOC device register maps are handled via a structure. 
He's doing everything via 32-bit operations, even though the registers are 64 bits, and 
therefore he has twice as much macros as he needs.

>>> +
>>> +
>>> +	/* check for things like FIFO underflow */
>>> +	
>>> +	u32 v;
>>> +
>>> +	v = in_be32(rng_regs + TALITOS_RNGISR_HI);
>> 	u64 v;
>> 	v = rng->rngisr;
>>
>> or something like that.  Try to use the built-in support for 64-bit data types when possible.
> 
> ...this. NO! Don't reference ioremapped memory from regular code like
> that. The way he's doing it is the preferred way.

Can you explain that better?  What is "regular code"?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale