Re: unsigned long ioremap()?

From: Jes Sorensen (jes@sunsite.dk)
Date: Sun May 13 2001 - 09:00:45 EST


>>>>> "Abramo" == Abramo Bagnara <abramo@alsa-project.org> writes:

Abramo> "David S. Miller" wrote:
>> One final point, I want to reiterate that I believe:
>>
>> foo = readl(&regs->bar);
>>
>> is perfectly legal and should not be discouraged and in particular,
>> not made painful to do.

Abramo> I disagree: regs it's not a dereferenceable thing and I think
Abramo> it's an abuse of pointer type. You're keeping a pointer that
Abramo> need a big sign on it saying "Don't dereference me", it's a
Abramo> mess.

Thats complete rubbish, in many cases the regs structure matches a
regs structure seen by another CPU on the other side of the PCI bus
(ie. the firmware case). There is nothing wrong with the above
approach as long as you keep in mind that you cannot dereference the
struct without using readl and you have to make sure to explicitly do
padding in the struct (not all CPUs guarantee the same natural
alignment).

Jes
-
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/



This archive was generated by hypermail 2b29 : Tue May 15 2001 - 21:00:31 EST