From patchwork Fri Dec 30 14:07:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 89366 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp6454802qgi; Fri, 30 Dec 2016 06:07:15 -0800 (PST) X-Received: by 10.99.237.69 with SMTP id m5mr85365242pgk.94.1483106835335; Fri, 30 Dec 2016 06:07:15 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si48598258pgd.298.2016.12.30.06.07.15; Fri, 30 Dec 2016 06:07:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754223AbcL3OHK (ORCPT + 25 others); Fri, 30 Dec 2016 09:07:10 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:34671 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754005AbcL3OHI (ORCPT ); Fri, 30 Dec 2016 09:07:08 -0500 Received: by mail-lf0-f49.google.com with SMTP id y21so237352582lfa.1 for ; Fri, 30 Dec 2016 06:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=QIJY/dYYS4X5K9yGHYl8lsdUl+jnLib4kUqxiZJFoKk=; b=CDanvcozs63S0oWstjLGl+3g+T8EXEmqf9hnqcpotzbYX35WdREZK188cUxUISW9Yy jMdXS8gtDNDWlPMXAP97MSGLZth7iqOOaWE2vDPppkfAL+sejsh9Ub1PCw6HO35Xw7Kz uUGMkEhoxO3bHsPHpzgxRNfhjgWFTwvfQuXmc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QIJY/dYYS4X5K9yGHYl8lsdUl+jnLib4kUqxiZJFoKk=; b=VHgOhTlPuVSQ7Zr7k+c1WJFgXhbnfUkBykfnHOrCXXFn1Namu6MEgeec+gYDCzY2wZ j+pLeMWj32vOMZj5olqrYq+cxbpUhC1nBat8chEXxiXlKgktX+DKptJJUYgK8dBh4VS9 qqmYt7PjwpBAOZAivPVf6S+tZY4Wo7m+PMABnKyQtbAAOnNawDoDqxCdknzmiSTnAhTj robNXvcDaEWgxx46MQjivVAVP2FYTFNXzSWLhc2OaXR1rCCW7JLt4jZBRgRjNDNKGHsD m3ctweBGBFnK+L9xtIZUZYj57jcaElMTe9X3Vo4mM3hIkoMQHf0HzjHwYkYv+sijhp1A i6MQ== X-Gm-Message-State: AIkVDXJqD9SWpKNWWxoH6KhKV1IRqWiKjOVp7m3rIZki9q3x4rtIZEs/ZMaCVaM1/mJJ98lh X-Received: by 10.25.165.144 with SMTP id o138mr16733446lfe.172.1483106826817; Fri, 30 Dec 2016 06:07:06 -0800 (PST) Received: from localhost.localdomain (c-357171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.53]) by smtp.gmail.com with ESMTPSA id j9sm1898059lfe.23.2016.12.30.06.07.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Dec 2016 06:07:06 -0800 (PST) From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: linux-gpio@vger.kernel.org, Linus Walleij , Tony Lindgren Subject: [PATCH] pinctrl: stricten up generic group code Date: Fri, 30 Dec 2016 15:07:04 +0100 Message-Id: <20161230140704.13875-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rename the symbol PINCTRL_GENERIC to PINCTRL_GENERIC_GROUPS since it all pertains to groups. Replace everywhere. ifdef out the radix tree and the struct when not using the generic groups. Cc: Tony Lindgren Signed-off-by: Linus Walleij --- drivers/pinctrl/Kconfig | 2 +- drivers/pinctrl/core.c | 6 ++++-- drivers/pinctrl/core.h | 32 +++++++++++++++++--------------- 3 files changed, 22 insertions(+), 18 deletions(-) -- 2.9.3 diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index b986998409d1..add257f80d76 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -8,7 +8,7 @@ config PINCTRL menu "Pin controllers" depends on PINCTRL -config GENERIC_PINCTRL +config GENERIC_PINCTRL_GROUPS bool config PINMUX diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 7b7d706f869c..736149d3a33d 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -540,7 +540,7 @@ void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev, } EXPORT_SYMBOL_GPL(pinctrl_remove_gpio_range); -#ifdef CONFIG_GENERIC_PINCTRL +#ifdef CONFIG_GENERIC_PINCTRL_GROUPS /** * pinctrl_generic_get_group_count() - returns the number of pin groups @@ -714,7 +714,7 @@ static void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev) static inline void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev) { } -#endif /* CONFIG_GENERIC_PINCTRL */ +#endif /* CONFIG_GENERIC_PINCTRL_GROUPS */ /** * pinctrl_get_group_selector() - returns the group selector for a group @@ -1993,7 +1993,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, pctldev->desc = pctldesc; pctldev->driver_data = driver_data; INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL); +#ifdef CONFIG_GENERIC_PINCTRL_GROUPS INIT_RADIX_TREE(&pctldev->pin_group_tree, GFP_KERNEL); +#endif INIT_LIST_HEAD(&pctldev->gpio_ranges); INIT_DELAYED_WORK(&pctldev->late_init, pinctrl_late_init); pctldev->dev = dev; diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index af98b6313902..b04c59bf9701 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h @@ -43,8 +43,10 @@ struct pinctrl_dev { struct list_head node; struct pinctrl_desc *desc; struct radix_tree_root pin_desc_tree; +#ifdef CONFIG_GENERIC_PINCTRL_GROUPS struct radix_tree_root pin_group_tree; unsigned int num_groups; +#endif struct list_head gpio_ranges; struct device *dev; struct module *owner; @@ -166,6 +168,20 @@ struct pin_desc { }; /** + * struct pinctrl_maps - a list item containing part of the mapping table + * @node: mapping table list node + * @maps: array of mapping table entries + * @num_maps: the number of entries in @maps + */ +struct pinctrl_maps { + struct list_head node; + struct pinctrl_map const *maps; + unsigned num_maps; +}; + +#ifdef CONFIG_GENERIC_PINCTRL_GROUPS + +/** * struct group_desc - generic pin group descriptor * @name: name of the pin group * @pins: array of pins that belong to the group @@ -179,20 +195,6 @@ struct group_desc { void *data; }; -/** - * struct pinctrl_maps - a list item containing part of the mapping table - * @node: mapping table list node - * @maps: array of mapping table entries - * @num_maps: the number of entries in @maps - */ -struct pinctrl_maps { - struct list_head node; - struct pinctrl_map const *maps; - unsigned num_maps; -}; - -#ifdef CONFIG_GENERIC_PINCTRL - int pinctrl_generic_get_group_count(struct pinctrl_dev *pctldev); const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev, @@ -218,7 +220,7 @@ pinctrl_generic_remove_last_group(struct pinctrl_dev *pctldev) return pinctrl_generic_remove_group(pctldev, pctldev->num_groups - 1); } -#endif /* CONFIG_GENERIC_PINCTRL */ +#endif /* CONFIG_GENERIC_PINCTRL_GROUPS */ struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name); struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);