lkml.org 
[lkml]   [2000]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ioremap return type
   From: Jes Sorensen <jes@linuxcare.com>
Date: 09 Aug 2000 19:54:05 +0200

Jamie> Name it ioaddr_t -- to clarify usage for _new_ driver authors.

Please don't, we have way too many silly typedef's already that are
just hiding sane types underneath.

The whole point is we don't want driver authors to have any idea
what type it is. What we want them to know is:

1) It is returned from ioremap()
2) It can be passed to iounmap()
3) It can be passed to {read,write,in,out}{b,w,l}() with an optional
byte offset added to it.

Otherwise, the thing is to be completely opaque. If you expose the
"sane type" underneath, driver developers will never get this right.

You can document the three points I made above in 100 different
places, driver authors are still going to get it wrong unless you make
it such that their driver does not compile unless they follow the
rules above. See?

This is why the typedefs are necessary to solve the problem properly.

Sure, the programmer can use really ugly casts to subvert the compile
failure, but that will stick out and be an eyesore to anyone who looks
at the code. Currently it's just too easy to convert the void * from
ioremap into any pointer type whatsoever without casts etc. and this
is why so many people get it wrong.

Later,
David S. Miller
davem@redhat.com


-
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:0.053 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site