From: Jeff Garzik <jgarzik@pobox.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: netdev@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] s2io ppc64 fix for readq/writeq
Date: Mon, 06 Nov 2006 02:50:27 -0500 [thread overview]
Message-ID: <454EE943.6000603@pobox.com> (raw)
In-Reply-To: <1162780109.28571.273.camel@localhost.localdomain>
Benjamin Herrenschmidt wrote:
> The s2io driver is redefining it's own readq/writeq based on
> readl/writel when the platform doesn't provide native ones. However, it
> currently does so by testing #ifndef readq. While that works for now, we
> are about to change ppc64 to use inline functions rather that macros for
> all those IO accessors which will break that test. This fixes it. I
> don't have anything less ugly at hand unfortunately.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> The patch changing ppc64 own definition is scheduled to go in 2.6.20 when
> the merge window opens, so it would be nice if this patch could go in a
> similar timeframe, provided that you agree with it of course. It can go
> earlier as it won't break current ppc64.
>
> Index: linux-cell/drivers/net/s2io.h
> ===================================================================
> --- linux-cell.orig/drivers/net/s2io.h 2006-10-13 17:23:49.000000000 +1000
> +++ linux-cell/drivers/net/s2io.h 2006-11-06 13:19:32.000000000 +1100
> @@ -862,8 +862,10 @@ struct s2io_nic {
> #define RESET_ERROR 1;
> #define CMD_ERROR 2;
>
> -/* OS related system calls */
> -#ifndef readq
> +/* OS related system calls. Note that ppc64 has readq defined as
> + * an inline, not a macro
> + */
> +#if !defined(CONFIG_PPC64) && !defined(readq)
> static inline u64 readq(void __iomem *addr)
> {
> u64 ret = 0;
> @@ -875,7 +877,7 @@ static inline u64 readq(void __iomem *ad
> }
> #endif
>
> -#ifndef writeq
> +#if !defined(CONFIG_PPC64) && !defined(writeq)
> static inline void writeq(u64 val, void __iomem *addr)
This seems a bit ugly. Could you add
#define readq readq
to your platform instead?
I generally think it's a bug in the kernel-wide API, if use of said API
requires arch-specific ifdefs.
Or maybe the problem could be solved another way, by guaranteeing that a
"good enough for drivers" readq() and writeq() exist on all platforms,
even 32-bit platforms where the operation isn't inherently atomic.
Jeff
next prev parent reply other threads:[~2006-11-06 7:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-06 2:28 [PATCH] s2io ppc64 fix for readq/writeq Benjamin Herrenschmidt
2006-11-06 7:50 ` Jeff Garzik [this message]
2006-11-06 8:04 ` Benjamin Herrenschmidt
2006-11-06 8:21 ` Jeff Garzik
2006-11-06 8:52 ` Benjamin Herrenschmidt
2006-11-06 9:34 ` Jeff Garzik
2006-11-07 0:17 ` Benjamin Herrenschmidt
2006-11-06 9:37 ` Linus Torvalds
2006-11-06 9:42 ` Benjamin Herrenschmidt
2006-11-06 9:50 ` Linus Torvalds
2006-11-06 9:51 ` Benjamin Herrenschmidt
2006-11-06 9:55 ` Jeff Garzik
2006-11-06 9:57 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2006-11-06 20:33 Ramkrishna Vepa
2006-11-06 20:46 ` Christoph Hellwig
2006-11-06 20:54 ` Roland Dreier
2006-11-07 2:57 Ramkrishna Vepa
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=454EE943.6000603@pobox.com \
--to=jgarzik@pobox.com \
--cc=benh@kernel.crashing.org \
--cc=netdev@vger.kernel.org \
--cc=torvalds@osdl.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).