lkml.org 
[lkml]   [2000]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: ioremap return type
From
Date
>>>>> "Jamie" == Jamie Lokier <lk@tantalophile.demon.co.uk> writes:

Jamie> Jes Sorensen wrote: Many drivers use a struct to define the
Jamie> offsets in their I/O or iomem space. E.g. acenic.c:
Jamie> readl(&regs->CpuCtrl). We know that's not portable in the
Jamie> sense that struct layout is not guaranteed. However, provided
Jamie> all the fields are suitably padded & aligned, it works in
Jamie> practice. (So far..)
>> That is perfectly portable because that maps onto the hardware
>> registers directly, the driver is not to known whether an IO spase
>> is sparse or not thats handle by readl/writel. The acenic driver
>> simply uses the struct to generate offsets because I find it
>> utterly ugly to use a zillion defines to set all the offsets.

Jamie> The reason it's not portable in _principle_ is that the mapping
Jamie> "list of struct fields" -> "offsets" can vary between
Jamie> architectures.

That is why the structure I used explicitly used u32's in the define
since PCI data word accessed by readl is 32 bits. True one has to be
careful about the types used, but if done right it is perfectly fine.

Jes

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:2.140 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site