Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7563bbf8 authored by Mark Brown's avatar Mark Brown Committed by Grant Likely
Browse files

gpiolib/arches: Centralise bolierplate asm/gpio.h



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.

This makes it much easier to do gpiolib updates and is also a step towards
making gpiolib APIs available on every architecture.

For architectures with existing boilerplate code leave a stub header in
place which warns on direct inclusion of asm/gpio.h and includes
linux/gpio.h to catch code that's doing this.  Direct inclusion of
asm/gpio.h has long been deprecated.

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarJonas Bonn <jonas@southpole.se>
Acked-by: default avatarTony Luck <tony.luck@intel.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 25cf2507
Loading
Loading
Loading
Loading
+4 −55
Original line number Diff line number Diff line
/*
 * Generic GPIO API implementation for Alpha.
 *
 * A stright copy of that for PowerPC which was:
 *
 * Copyright (c) 2007-2008  MontaVista Software, Inc.
 *
 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef _ASM_ALPHA_GPIO_H
#define _ASM_ALPHA_GPIO_H

#include <linux/errno.h>
#include <asm-generic/gpio.h>

#ifdef CONFIG_GPIOLIB

/*
 * We don't (yet) implement inlined/rapid versions for on-chip gpios.
 * Just call gpiolib.
 */
static inline int gpio_get_value(unsigned int gpio)
{
	return __gpio_get_value(gpio);
}

static inline void gpio_set_value(unsigned int gpio, int value)
{
	__gpio_set_value(gpio, value);
}

static inline int gpio_cansleep(unsigned int gpio)
{
	return __gpio_cansleep(gpio);
}

static inline int gpio_to_irq(unsigned int gpio)
{
	return __gpio_to_irq(gpio);
}

static inline int irq_to_gpio(unsigned int irq)
{
	return -EINVAL;
}

#endif /* CONFIG_GPIOLIB */

#endif /* _ASM_ALPHA_GPIO_H */
#ifndef __LINUX_GPIO_H
#warning Include linux/gpio.h instead of asm/gpio.h
#include <linux/gpio.h>
#endif
+1 −0
Original line number Diff line number Diff line
config ARM
	bool
	default y
	select ARCH_HAVE_CUSTOM_GPIO_H
	select HAVE_AOUT
	select HAVE_DMA_API_DEBUG
	select HAVE_IDE if PCI || ISA || PCMCIA
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ config AVR32
	select GENERIC_ATOMIC64
	select HARDIRQS_SW_RESEND
	select GENERIC_IRQ_SHOW
	select ARCH_HAVE_CUSTOM_GPIO_H
	select ARCH_HAVE_NMI_SAFE_CMPXCHG
	help
	  AVR32 is a high-performance 32-bit RISC microprocessor core,
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ config BLACKFIN
	select HAVE_KERNEL_LZO if RAMKERNEL
	select HAVE_OPROFILE
	select HAVE_PERF_EVENTS
	select ARCH_HAVE_CUSTOM_GPIO_H
	select ARCH_WANT_OPTIONAL_GPIOLIB
	select HAVE_GENERIC_HARDIRQS
	select GENERIC_ATOMIC64
+4 −55
Original line number Diff line number Diff line
/*
 * Generic GPIO API implementation for IA-64.
 *
 * A stright copy of that for PowerPC which was:
 *
 * Copyright (c) 2007-2008  MontaVista Software, Inc.
 *
 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef _ASM_IA64_GPIO_H
#define _ASM_IA64_GPIO_H

#include <linux/errno.h>
#include <asm-generic/gpio.h>

#ifdef CONFIG_GPIOLIB

/*
 * We don't (yet) implement inlined/rapid versions for on-chip gpios.
 * Just call gpiolib.
 */
static inline int gpio_get_value(unsigned int gpio)
{
	return __gpio_get_value(gpio);
}

static inline void gpio_set_value(unsigned int gpio, int value)
{
	__gpio_set_value(gpio, value);
}

static inline int gpio_cansleep(unsigned int gpio)
{
	return __gpio_cansleep(gpio);
}

static inline int gpio_to_irq(unsigned int gpio)
{
	return __gpio_to_irq(gpio);
}

static inline int irq_to_gpio(unsigned int irq)
{
	return -EINVAL;
}

#endif /* CONFIG_GPIOLIB */

#endif /* _ASM_IA64_GPIO_H */
#ifndef __LINUX_GPIO_H
#warning Include linux/gpio.h instead of asm/gpio.h
#include <linux/gpio.h>
#endif
Loading