linux-mips
[Top] [All Lists]

Re: [PATCH] gpiolib/arches: Centralise bolierplate asm/gpio.h

To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH] gpiolib/arches: Centralise bolierplate asm/gpio.h
From: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 25 Oct 2011 19:44:14 -0400
Cc: Russell King <linux@arm.linux.org.uk>, Haavard Skinnemoen <hskinnemoen@gmail.com>, Hans-Christian Egtvedt <egtvedt@samfundet.no>, Geert Uytterhoeven <geert@linux-m68k.org>, Ralf Baechle <ralf@linux-mips.org>, Paul Mundt <lethal@linux-sh.org>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Grant Likely <grant.likely@secretlab.ca>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, uclinux-dist-devel@blackfin.uclinux.org, linux-m68k@lists.linux-m68k.org, linux-mips@linux-mips.org, linux-sh@vger.kernel.org, linux-arch@vger.kernel.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=EB60+bydwMo+4xJ2p0A09rShn92azJjSO0PkdXv5EPY=; b=h0rX5NBSB/sBbFMpNOw1D8WLFzFV2x0RclnoCm/g5VBYPr4Ig3IDRiLlg+UrXeLEHT pUtlA3lBmqHokkWEyEMWY4U6G9AJ3HSpA0QIxowPQskG8nD3lUW0gcSilH/KSBKYUbvS XbHIMQ3CacA7/qGVffIfRFcIdN7A3s9paMRao=
In-reply-to: <1319528012-19006-1-git-send-email-broonie@opensource.wolfsonmicro.com>
References: <1319528012-19006-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Sender: linux-mips-bounce@linux-mips.org
On Tue, Oct 25, 2011 at 03:33, Mark Brown wrote:
> Rather than requiring architectures that use gpiolib but don't have any
> need to define anything custom to copy an asm/gpio.h provide a Kconfig
> symbol which architectures must select in order to include gpio.h and
> for other architectures just provide the trivial implementation directly.

i don't think this is generally how asm-generic is handled.  instead, how about:
 - move the duplicate code to asm-generic/gpio.h
 - have the arches which merely need asm-generic/gpio.h add "generic-y
+= gpio.h" to their include/asm/Kbuild
 - for arches which need to override these common funcs in some way,
add #ifdef protection to the asm-generic/gpio.h

and it seems like with slightly more work, this path allow you to
merge most of arch/sh/include/asm/gpio.h.  and it has the advantage of
not needing new Kconfig symbols.

for example, with asm-generic/atomic.h, it does:
#ifndef atomic_sub_return
static inline int atomic_sub_return(int i, atomic_t *v)
{ ... common implementation ... }
#endif

and then any arch that wants to override it does:
#define atomic_sub_return atomic_sub_return
static inline int atomic_sub_return(int i, atomic_t *v) { weirdness }
#include <asm-generic/atomic.h>
-mike

<Prev in Thread] Current Thread [Next in Thread>