netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: akpm@linux-foundation.org
Cc: mingo@elte.hu, netdev@vger.kernel.org
Subject: Re: drivers/net/enic/vnic_cq.c
Date: Thu, 09 Oct 2008 21:15:52 -0700 (PDT)	[thread overview]
Message-ID: <20081009.211552.20994950.davem@davemloft.net> (raw)
In-Reply-To: <20081009211217.5f4e5f77.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-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.

  reply	other threads:[~2008-10-10  4:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-10  4:12 drivers/net/enic/vnic_cq.c Andrew Morton
2008-10-10  4:15 ` David Miller [this message]
2008-10-10  4:27   ` drivers/net/enic/vnic_cq.c Andrew Morton
2008-10-10  4:54     ` drivers/net/enic/vnic_cq.c David Miller
2008-10-10  5:05       ` drivers/net/enic/vnic_cq.c David Miller
2008-10-10  5:14         ` drivers/net/enic/vnic_cq.c David Miller
2008-10-10 17:10           ` drivers/net/enic/vnic_cq.c Roland Dreier
2008-10-10 18:29             ` drivers/net/enic/vnic_cq.c Scott Feldman
2008-10-10 18:58               ` drivers/net/enic/vnic_cq.c David Miller
2008-10-10 22:34                 ` drivers/net/enic/vnic_cq.c Scott Feldman
2008-10-10  5:16       ` drivers/net/enic/vnic_cq.c Andrew Morton
2008-10-10  5:25         ` drivers/net/enic/vnic_cq.c David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081009.211552.20994950.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akpm@linux-foundation.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).