[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 9 Oct 2008 21:27:55 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: David Miller <davem@...emloft.net>
Cc: mingo@...e.hu, netdev@...r.kernel.org
Subject: Re: drivers/net/enic/vnic_cq.c
On Thu, 09 Oct 2008 21:15:52 -0700 (PDT) David Miller <davem@...emloft.net> wrote:
> From: Andrew Morton <akpm@...ux-foundation.org>
> Date: Thu, 9 Oct 2008 21:12:17 -0700
>
> >
> > i386 allmodconfig, all trees applied:
> >
> > drivers/net/enic/vnic_cq.c: In function 'vnic_cq_init':
> > drivers/net/enic/vnic_cq.c:65: error: implicit declaration of function 'writeq'
> >
> > I can't immediately find an i386 implementation of writeq.
>
> There isn't, because only a non-atomic implementation (two writew's)
> is possible.
>
> So what ends up happening is that every driver that wants readq and
> writeq does this ifdef dance:
>
> #ifndef readq
> static u64 readq(void __iomem *reg)
> {
> return (((u64)readl(reg + 0x4UL) << 32) |
> (u64)readl(reg));
> }
>
> static void writeq(u64 val, void __iomem *reg)
> {
> writel(val & 0xffffffff, reg);
> writel(val >> 32, reg + 0x4UL);
> }
> #endif
>
> basically stating that they explicitly understand that these are
> non-atomic and that the driver can handle it.
>
> But this is completely stupid. Instead of putting this in every driver
> we should put it in the 32-bit asm/io.h files and guard it with
> some ifdef test, on a macro that the driver can define.
Well OK.
We have a driver which has never been compileable on i386 which has
slipped through at least three sets of fingers only to land on the
usual guy's head.
Someone should write a book about this or something.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists