[Top] [All Lists]

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

To: Mark Brown <>
Subject: Re: [PATCH] gpiolib/arches: Centralise bolierplate asm/gpio.h
From: Mike Frysinger <>
Date: Tue, 25 Oct 2011 19:44:14 -0400
Cc: Russell King <>, Haavard Skinnemoen <>, Hans-Christian Egtvedt <>, Geert Uytterhoeven <>, Ralf Baechle <>, Paul Mundt <>, Guan Xuetao <>, Grant Likely <>,,,,,,,
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; 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: <>
References: <>
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 ... }

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>

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