From patchwork Tue Jan 15 08:37:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1975721 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0902E3FE33 for ; Tue, 15 Jan 2013 08:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756847Ab3AOIhY (ORCPT ); Tue, 15 Jan 2013 03:37:24 -0500 Received: from va3ehsobe010.messaging.microsoft.com ([216.32.180.30]:38000 "EHLO va3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756845Ab3AOIhY (ORCPT ); Tue, 15 Jan 2013 03:37:24 -0500 Received: from mail117-va3-R.bigfish.com (10.7.14.236) by VA3EHSOBE006.bigfish.com (10.7.40.26) with Microsoft SMTP Server id 14.1.225.23; Tue, 15 Jan 2013 08:37:23 +0000 Received: from mail117-va3 (localhost [127.0.0.1]) by mail117-va3-R.bigfish.com (Postfix) with ESMTP id 02F9F40221; Tue, 15 Jan 2013 08:37:23 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275dhz2dh87h2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail117-va3 (localhost.localdomain [127.0.0.1]) by mail117-va3 (MessageSwitch) id 1358239040830243_11455; Tue, 15 Jan 2013 08:37:20 +0000 (UTC) Received: from VA3EHSMHS013.bigfish.com (unknown [10.7.14.241]) by mail117-va3.bigfish.com (Postfix) with ESMTP id B82B7600A8; Tue, 15 Jan 2013 08:37:20 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS013.bigfish.com (10.7.99.23) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 15 Jan 2013 08:37:19 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.318.3; Tue, 15 Jan 2013 08:37:18 +0000 Received: from S2101-09.ap.freescale.net ([10.192.185.27]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r0F8b86i007772; Tue, 15 Jan 2013 01:37:15 -0700 From: Shawn Guo To: Grant Likely , Linus Walleij CC: Chris Ball , , , Shawn Guo Subject: [PATCH 2/2] gpio: devm_gpio_* support should not depend on GPIOLIB Date: Tue, 15 Jan 2013 16:37:36 +0800 Message-ID: <1358239056-703-3-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358239056-703-1-git-send-email-shawn.guo@linaro.org> References: <1358239056-703-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Some architectures (e.g. blackfin) provide gpio API without requiring GPIOLIB support (ARCH_WANT_OPTIONAL_GPIOLIB). devm_gpio_* functions should also work for these architectures, since they do not really depend on GPIOLIB. Add a new option GPIO_DEVRES (enabled by default) to control the build of devres.c, and move devm_gpio_* function declarations out from #ifdef CONFIG_GPIOLIB in include/asm-generic/gpio.h, so that they can be available to client drivers without unnecessary dependency on GPIOLIB. Signed-off-by: Shawn Guo --- drivers/gpio/Kconfig | 3 +++ drivers/gpio/Makefile | 3 ++- include/asm-generic/gpio.h | 17 ++++++++--------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 682de75..d972932 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -30,6 +30,9 @@ config ARCH_REQUIRE_GPIOLIB Selecting this from the architecture code will cause the gpiolib code to always get built in. +config GPIO_DEVRES + def_bool y + depends on HAS_IOMEM menuconfig GPIOLIB diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index c5aebd0..36ca605 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -2,7 +2,8 @@ ccflags-$(CONFIG_DEBUG_GPIO) += -DDEBUG -obj-$(CONFIG_GPIOLIB) += gpiolib.o devres.o +obj-$(CONFIG_GPIO_DEVRES) += devres.o +obj-$(CONFIG_GPIOLIB) += gpiolib.o obj-$(CONFIG_OF_GPIO) += gpiolib-of.o obj-$(CONFIG_GPIO_ACPI) += gpiolib-acpi.o diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 2341014..71fd984 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -7,6 +7,8 @@ #include #include +struct device; + #ifdef CONFIG_GPIOLIB #include @@ -42,7 +44,6 @@ static inline bool gpio_is_valid(int number) return number >= 0 && number < ARCH_NR_GPIOS; } -struct device; struct gpio; struct seq_file; struct module; @@ -192,12 +193,6 @@ extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *labe extern int gpio_request_array(const struct gpio *array, size_t num); extern void gpio_free_array(const struct gpio *array, size_t num); -/* bindings for managed devices that want to request gpios */ -int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); -int devm_gpio_request_one(struct device *dev, unsigned gpio, - unsigned long flags, const char *label); -void devm_gpio_free(struct device *dev, unsigned int gpio); - #ifdef CONFIG_GPIO_SYSFS /* @@ -280,9 +275,13 @@ static inline void gpio_set_value_cansleep(unsigned gpio, int value) #endif /* !CONFIG_GPIOLIB */ -#ifndef CONFIG_GPIO_SYSFS +/* bindings for managed devices that want to request gpios */ +int devm_gpio_request(struct device *dev, unsigned gpio, const char *label); +int devm_gpio_request_one(struct device *dev, unsigned gpio, + unsigned long flags, const char *label); +void devm_gpio_free(struct device *dev, unsigned int gpio); -struct device; +#ifndef CONFIG_GPIO_SYSFS /* sysfs support is only available with gpiolib, where it's optional */