lkml.org 
[lkml]   [2001]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: unsigned long ioremap()?
    "David S. Miller" wrote:
    >
    > Geert Uytterhoeven writes:
    > > Since you're not allowed to use direct memory dereferencing on ioremapped
    > > areas, wouldn't it be more logical to let ioremap() return an unsigned long
    > > instead of a void *?
    > >
    > > Of course we then have to change readb() and friends to take a long as well,
    > > but at least we'd get compiler warnings when someone tries to do a direct
    > > dereference.
    >
    > There is a school of thought which believes that:
    >
    > struct xdev_regs {
    > u32 reg1;
    > u32 reg2;
    > };
    >
    > val = readl(&regs->reg2);
    >
    > is cleaner than:
    >
    > #define REG1 0x00
    > #define REG2 0x04
    >
    > val = readl(regs + REG2);
    >
    > I'm personally ambivalent and believe that both cases should be allowed.

    The problem I see is that with the former solution nothing prevents from
    to do:

    regs->reg2 = 13;

    That's indeed the reason to change ioremap prototype for 2.5.

    --
    Abramo Bagnara mailto:abramo@alsa-project.org

    Opera Unica Phone: +39.546.656023
    Via Emilia Interna, 140
    48014 Castel Bolognese (RA) - Italy

    ALSA project http://www.alsa-project.org
    It sounds good!
    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 12:52    [W:0.021 / U:29.216 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site