From patchwork Fri Oct 25 15:40:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 21252 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4235F244AF for ; Fri, 25 Oct 2013 15:40:21 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id fa1sf3654953pad.10 for ; Fri, 25 Oct 2013 08:40:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=rHs+hsV1V/JdyZcUg7tJKS7gQkgPuQAkDqJWZIgd8Qs=; b=Cd4wSqgkMeThPVdudK1isfac+qQBI5XHzWE7xgKXTMI1y9rypsadpPSfk5HGLNrzOa iJgcOEIpepKVRZKnxfDk941R4EqAwF1q+Y/fuux/TNMqlYonwolhYPBPUgep9ugvTTrW yn58tySedswxshv3eJNqSMJAezGsLEDsKaHmaPFdj3YSjDeSXKkL6ZLJw60j8lgXTwCJ JateY8/qPezzusMgTjxGpxufapgHTMD/Mc0J1CcajHkQ8bVnm7YxC/iH/52l2dIbBqK+ q/cPsTtUKZ38OHMJml+9al97VexaUPhpO9ViGnZc/fjKGpqr5t9osu0YFzzbk8xTA+uF By6Q== X-Gm-Message-State: ALoCoQnugTUuOZUq5v25XBg+7y/4AkJtWoebNiN3gEpX6ItBkJBvIP5UzBFrxagd844LGF4Od0sr X-Received: by 10.66.5.226 with SMTP id v2mr3373037pav.22.1382715620222; Fri, 25 Oct 2013 08:40:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.43 with SMTP id f11ls1202324qey.33.gmail; Fri, 25 Oct 2013 08:40:20 -0700 (PDT) X-Received: by 10.58.23.33 with SMTP id j1mr4912346vef.27.1382715620058; Fri, 25 Oct 2013 08:40:20 -0700 (PDT) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by mx.google.com with ESMTPS id bl10si1764320vcb.84.2013.10.25.08.40.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Oct 2013 08:40:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.46; Received: by mail-vb0-f46.google.com with SMTP id 10so2587665vbe.19 for ; Fri, 25 Oct 2013 08:40:20 -0700 (PDT) X-Received: by 10.221.21.133 with SMTP id qs5mr710018vcb.28.1382715619928; Fri, 25 Oct 2013 08:40:19 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp482755vcz; Fri, 25 Oct 2013 08:40:19 -0700 (PDT) X-Received: by 10.180.39.34 with SMTP id m2mr3142799wik.26.1382715618973; Fri, 25 Oct 2013 08:40:18 -0700 (PDT) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) by mx.google.com with ESMTPS id w8si1378777wib.85.2013.10.25.08.40.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Oct 2013 08:40:18 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.180 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.180; Received: by mail-we0-f180.google.com with SMTP id q59so3983664wes.39 for ; Fri, 25 Oct 2013 08:40:18 -0700 (PDT) X-Received: by 10.180.93.166 with SMTP id cv6mr3030580wib.37.1382715618444; Fri, 25 Oct 2013 08:40:18 -0700 (PDT) Received: from localhost.localdomain.quadriga.com (ip-77-221-165-98.dsl.twang.net. [77.221.165.98]) by mx.google.com with ESMTPSA id ey4sm7378468wic.11.2013.10.25.08.40.17 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Fri, 25 Oct 2013 08:40:17 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Alexandre Courbot , Linus Walleij Subject: [PATCH v2] gpio: provide stubs for devres gpio functions Date: Fri, 25 Oct 2013 17:40:13 +0200 Message-Id: <1382715613-3435-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.3.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.46 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , commit 6b3d8145dcfdbbb43f13544e16f44f4574f941dd "gpiolib: make GPIO_DEVRES depend on GPIOLIB" breaks builds when device drivers are using devm_gpio* devres functions without enabling GPIOLIB, relying on the devres code to be compiled anyway. Provide stubs so that we get these if we're using the devres functions without GPIOLIB. Reported-by: Fengguang Wu Cc: Alexandre Courbot Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Actually add the keywords "static inline" in the proper place for all stubs. --- include/linux/gpio.h | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/include/linux/gpio.h b/include/linux/gpio.h index c691df044458..0c56b9e9c209 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h @@ -77,6 +77,15 @@ static inline int irq_to_gpio(unsigned int irq) #endif /* ! CONFIG_ARCH_HAVE_CUSTOM_GPIO_H */ +/* CONFIG_GPIOLIB: bindings for managed devices that want to request gpios */ + +struct device; + +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); + #else /* ! CONFIG_GPIOLIB */ #include @@ -241,14 +250,25 @@ gpiochip_remove_pin_ranges(struct gpio_chip *chip) WARN_ON(1); } -#endif /* ! CONFIG_GPIOLIB */ +static inline int devm_gpio_request(struct device *dev, unsigned gpio, + const char *label) +{ + WARN_ON(1); + return -EINVAL; +} -struct device; +static inline int devm_gpio_request_one(struct device *dev, unsigned gpio, + unsigned long flags, const char *label) +{ + WARN_ON(1); + return -EINVAL; +} -/* 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); +static inline void devm_gpio_free(struct device *dev, unsigned int gpio) +{ + WARN_ON(1); +} + +#endif /* ! CONFIG_GPIOLIB */ #endif /* __LINUX_GPIO_H */