From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Guan Xuetao <gxt@mprc.pku.edu.cn>,
Ralf Baechle <ralf@linux-mips.org>,
Paul Mundt <lethal@linux-sh.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Mike Frysinger <vapier@gentoo.org>,
Haavard Skinnemoen <hskinnemoen@gmail.com>,
Hans-Christian Egtvedt <egtvedt@samfundet.no>,
Grant Likely <grant.likely@secretlab.ca>,
linux-arch@vger.kernel.org, linux-mips@linux-mips.org,
uclinux-dist-devel@blackfin.uclinux.org,
linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
linux-sh@vger.kernel.org
Subject: Re: [PATCH] gpiolib/arches: Centralise bolierplate asm/gpio.h
Date: Sat, 04 Feb 2012 17:41:15 +0000 [thread overview]
Message-ID: <20120204174115.GX889@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20120204170632.GA3615@merkur.ravnborg.org>
On Sat, Feb 04, 2012 at 06:06:32PM +0100, Sam Ravnborg wrote:
> On Sat, Feb 04, 2012 at 03:54:39PM +0000, 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.
>
> Hi Mark.
>
> There is an even simpler solution.
>
> For each arch that uses asm-generic/gpio.h add a line
> to arch/$ARCH/include/asm/Kbuild like this:
>
>
> generic-y += gpio.h
>
> This will then make this arch pick up the asm-generic version when
> you do #include <asm/gpio.h>.
You're assuming that asm-generic/gpio.h was invented to be a replacement
for an architecture asm/gpio.h. Unfortunately, things aren't that
simple.
It would have been a lot better if asm-generic/gpio.h was tacked on the
bottom of linux/gpio.h - because that's what it really is. It's core
code features, not platform stuff.
What's platform specific about asm/gpio.h is the number of GPIOs in
the system, and whether it wants to intercept the gpio_xxx() functions
to provide fast access to on-chip GPIOs.
What I'd suggest is moving asm-generic/gpio.h to linux/gpiolib.h, and
making asm-generic/gpio.h include that as a patch until stuff is fixed
for its new location. That should result in a proper asm-generic/gpio.h
being:
/* The trivial gpiolib dispatchers */
#define gpio_get_value __gpio_get_value
#define gpio_set_value __gpio_set_value
#define gpio_cansleep __gpio_cansleep
#define gpio_to_irq __gpio_to_irq
and nothing else.
Alternatively, instead of linux/gpiolib.h, put it in linux/gpio.h instead,
but that gets more icky because of the mess of asm/gpio.h includes (which
I've been banging on for years about in ARM patches and they're _still_
coming.)
next prev parent reply other threads:[~2012-02-04 17:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 7:33 [PATCH] gpiolib/arches: Centralise bolierplate asm/gpio.h Mark Brown
2011-10-25 8:33 ` Grant Likely
2011-10-25 8:39 ` Mark Brown
2011-10-25 23:44 ` Mike Frysinger
2011-10-26 7:33 ` Mark Brown
2012-02-03 23:16 ` Grant Likely
2011-10-27 13:01 ` [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers Mike Frysinger
2011-10-27 22:52 ` [PATCH v2] " Mike Frysinger
2011-11-03 3:45 ` [PATCH v3] " Mike Frysinger
2012-02-04 15:54 ` [PATCH] gpiolib/arches: Centralise bolierplate asm/gpio.h Mark Brown
2012-02-04 17:06 ` Sam Ravnborg
2012-02-04 17:21 ` Mark Brown
2012-02-04 17:41 ` Russell King - ARM Linux [this message]
2012-02-06 11:37 ` Mark Brown
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=20120204174115.GX889@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=egtvedt@samfundet.no \
--cc=geert@linux-m68k.org \
--cc=grant.likely@secretlab.ca \
--cc=gxt@mprc.pku.edu.cn \
--cc=hskinnemoen@gmail.com \
--cc=lethal@linux-sh.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-sh@vger.kernel.org \
--cc=ralf@linux-mips.org \
--cc=sam@ravnborg.org \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.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).