From patchwork Wed Dec 9 13:11:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57958 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp658338lbb; Wed, 9 Dec 2015 05:11:38 -0800 (PST) X-Received: by 10.66.150.5 with SMTP id ue5mr7735042pab.42.1449666698095; Wed, 09 Dec 2015 05:11:38 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hm2si12659966pac.186.2015.12.09.05.11.37; Wed, 09 Dec 2015 05:11:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754050AbbLINLh (ORCPT + 4 others); Wed, 9 Dec 2015 08:11:37 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:35719 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753962AbbLINLg (ORCPT ); Wed, 9 Dec 2015 08:11:36 -0500 Received: by lfdl133 with SMTP id l133so33717409lfd.2 for ; Wed, 09 Dec 2015 05:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=FMk9hpRQI173+yg6Ti9CxotlJMiRwPvf887NMEcB4Jw=; b=CDDKGhG3KJkAjRbPVjXyOauoZb8yULrJDO+r6iTwNhlSBff3CUxenicxMTC5Bs8zn5 dt77me0vWf1wmPTTSTKZHE7wdIQa5rAQtWCbeUrhdkld8EZinDwwaRwJdrWZToY9TW1f fgKUjFa4VFMAlDvtDzbIWmEcIrLKOCeg6VwnT/+j8JbrMndsEKqY0WHvoU+XLVCoIced /avj0jLUkDluHz0nvrIZWgFlOl0VFVUU0aCq+5RAo9VrHSMqGvxeUt4zllbYFGFWYfg9 NyQDMmFtKAN8g+QzEpgwTcDxt8Vt5elJ36f6T5TmXfZiY1lrqdP+sFxXvthNiicEsmic B9Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FMk9hpRQI173+yg6Ti9CxotlJMiRwPvf887NMEcB4Jw=; b=M/g7dD3y5VyGz8cvfMOzGLZpDsQMr+4Tyw5GwQ+SeeLtdR2jr6TUMrQoz4qlrQdlgm QqM7HQX3JghcdFpmVshF/UxTPZxkdA+fvYfMT5SXDxw4GHFc85/CqeCRHYbqNXou98Ai BmcRqiDdnd/Ggs86qJpHqYK0gjvwZclXvnTtS5HWGr29BWZPsGCmiWrXJ7mTe/2BtA9O I8lRlhoJnqMUuh47PoovjIv7+fuETzEsTFgCTMgU4WjSo/OZvBzznRdkK3LGf5OclKX7 hbZZTtRHUwy31xVhYEUphYmgujW4sqOP9fTwmup1DC6wajtRusaudjiwrh/zQxZY185J QQZw== X-Gm-Message-State: ALoCoQml30xLM85DH+P7RNrWwhRApKZVmfFd0KyKAtZ4gC8fMxajU8dRoeOSJz4aaAKvJLlutPPkYHXxPKKCwXoE7NwPESSQvA== X-Received: by 10.25.150.204 with SMTP id y195mr2224571lfd.66.1449666695555; Wed, 09 Dec 2015 05:11:35 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a18sm1437249lfb.37.2015.12.09.05.11.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:11:34 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij Subject: [PATCH 003/182] gpio: of: provide optional of_mm_gpiochip_add_data() function Date: Wed, 9 Dec 2015 14:11:31 +0100 Message-Id: <1449666691-29754-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org In the same spirit as we add an optional void *data argument to the gpiochip_add_data() call, we need this also for of_mm_gpiochip_add(). Signed-off-by: Linus Walleij --- drivers/gpio/gpiolib-of.c | 12 +++++++----- include/linux/of_gpio.h | 10 ++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 6ed465ea2e12..42a4bb7cf49a 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -262,9 +262,10 @@ int of_gpio_simple_xlate(struct gpio_chip *gc, EXPORT_SYMBOL(of_gpio_simple_xlate); /** - * of_mm_gpiochip_add - Add memory mapped GPIO chip (bank) + * of_mm_gpiochip_add_data - Add memory mapped GPIO chip (bank) * @np: device node of the GPIO chip * @mm_gc: pointer to the of_mm_gpio_chip allocated structure + * @data: driver data to store in the struct gpio_chip * * To use this function you should allocate and fill mm_gc with: * @@ -280,8 +281,9 @@ EXPORT_SYMBOL(of_gpio_simple_xlate); * do all necessary work for you. Then you'll able to use .regs * to manage GPIOs from the callbacks. */ -int of_mm_gpiochip_add(struct device_node *np, - struct of_mm_gpio_chip *mm_gc) +int of_mm_gpiochip_add_data(struct device_node *np, + struct of_mm_gpio_chip *mm_gc, + void *data) { int ret = -ENOMEM; struct gpio_chip *gc = &mm_gc->gc; @@ -301,7 +303,7 @@ int of_mm_gpiochip_add(struct device_node *np, mm_gc->gc.of_node = np; - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, data); if (ret) goto err2; @@ -315,7 +317,7 @@ err0: np->full_name, ret); return ret; } -EXPORT_SYMBOL(of_mm_gpiochip_add); +EXPORT_SYMBOL(of_mm_gpiochip_add_data); /** * of_mm_gpiochip_remove - Remove memory mapped GPIO chip (bank) diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h index 87d6d1632dd4..54a23d6e4892 100644 --- a/include/linux/of_gpio.h +++ b/include/linux/of_gpio.h @@ -51,8 +51,14 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) extern int of_get_named_gpio_flags(struct device_node *np, const char *list_name, int index, enum of_gpio_flags *flags); -extern int of_mm_gpiochip_add(struct device_node *np, - struct of_mm_gpio_chip *mm_gc); +extern int of_mm_gpiochip_add_data(struct device_node *np, + struct of_mm_gpio_chip *mm_gc, + void *data); +static inline int of_mm_gpiochip_add(struct device_node *np, + struct of_mm_gpio_chip *mm_gc) +{ + return of_mm_gpiochip_add_data(np, mm_gc, NULL); +} extern void of_mm_gpiochip_remove(struct of_mm_gpio_chip *mm_gc); extern int of_gpiochip_add(struct gpio_chip *gc);