From patchwork Fri Feb 10 00:47:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 6751 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C5A2123ECA for ; Fri, 10 Feb 2012 00:48:04 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 6E55EA18221 for ; Fri, 10 Feb 2012 00:48:04 +0000 (UTC) Received: by iabz7 with SMTP id z7so4488511iab.11 for ; Thu, 09 Feb 2012 16:48:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.94.228 with SMTP id df4mr7266387igb.12.1328834883908; Thu, 09 Feb 2012 16:48:03 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.12.131 with SMTP id x3cs62951ibx; Thu, 9 Feb 2012 16:48:03 -0800 (PST) Received: by 10.112.9.40 with SMTP id w8mr1315368lba.103.1328834881922; Thu, 09 Feb 2012 16:48:01 -0800 (PST) Received: from mail.df.lth.se (mail.df.lth.se. [194.47.250.12]) by mx.google.com with ESMTPS id nx10si1808395lab.65.2012.02.09.16.48.01 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Feb 2012 16:48:01 -0800 (PST) Received-SPF: pass (google.com: domain of triad@df.lth.se designates 194.47.250.12 as permitted sender) client-ip=194.47.250.12; Authentication-Results: mx.google.com; spf=pass (google.com: domain of triad@df.lth.se designates 194.47.250.12 as permitted sender) smtp.mail=triad@df.lth.se Received: from mer.df.lth.se (mer.df.lth.se [194.47.250.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.df.lth.se (Postfix) with ESMTPS id 63D0C65D6B; Fri, 10 Feb 2012 01:48:00 +0100 (CET) Received: from mer.df.lth.se (triad@localhost.localdomain [127.0.0.1]) by mer.df.lth.se (8.14.3/8.14.3/Debian-9.4) with ESMTP id q1A0m0Cv025057; Fri, 10 Feb 2012 01:48:00 +0100 Received: (from triad@localhost) by mer.df.lth.se (8.14.3/8.14.3/Submit) id q1A0lwmt025056; Fri, 10 Feb 2012 01:47:58 +0100 From: Linus Walleij To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Stephen Warren , Shawn Guo , Thomas Abraham , Dong Aisheng , Rajendra Nayak , Haojian Zhuang , Barry Song <21cnbao@gmail.com>, Linus Walleij Subject: [PATCH] pinctrl: changes hog mechanism to be self-referential Date: Fri, 10 Feb 2012 01:47:48 +0100 Message-Id: <1328834868-25030-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-Gm-Message-State: ALoCoQk5vyZQGNcs4DGCGkgk0/tU6jOkmCDKpZHo0vlXDhfYxoU6y5elL2Xke2MphMLdMwy8YUBv Instead of a specific boolean field to indicate if a map entry shall be hogged, treat self-reference as an indication of desired hogging. This drops one field off the map struct and has a nice Douglas R. Hofstadter-feel to it. Suggested-by: Stephen Warren Signed-off-by: Linus Walleij --- Documentation/pinctrl.txt | 8 ++++---- drivers/pinctrl/core.c | 6 ++---- include/linux/pinctrl/machine.h | 18 ++++++------------ 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt index 2e71323..acb9078 100644 --- a/Documentation/pinctrl.txt +++ b/Documentation/pinctrl.txt @@ -989,21 +989,21 @@ is registered. This means that the core will attempt to call pinctrl_get() and pinctrl_enable() on it immediately after the pin control device has been registered. -This is enabled by simply setting the .hog_on_boot field in the map to true, -like this: +This is enabled by simply setting the .dev_name field in the map to the name +of the pin controller itself, like this: { .name = "POWERMAP" .ctrl_dev_name = "pinctrl-foo", .function = "power_func", - .hog_on_boot = true, + .dev_name = "pinctrl-foo", }, Since it may be common to request the core to hog a few always-applicable mux settings on the primary pin controller, there is a convenience macro for this: -PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func") +PIN_MAP_PRIMARY_SYS_HOG("POWERMAP", "pinctrl-foo". "power_func") This gives the exact same result as the above construction. diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ec32c54..c5f76ad 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -793,11 +793,9 @@ int pinctrl_hog_maps(struct pinctrl_dev *pctldev) for (i = 0; i < pinctrl_maps_num; i++) { struct pinctrl_map const *map = &pinctrl_maps[i]; - if (!map->hog_on_boot) - continue; - if (map->ctrl_dev_name && - !strcmp(map->ctrl_dev_name, devname)) { + !strcmp(map->ctrl_dev_name, devname) && + !strcmp(map->dev_name, devname)) { /* OK time to hog! */ ret = pinctrl_hog_map(pctldev, map); if (ret) diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h index a2ab524..af145d5 100644 --- a/include/linux/pinctrl/machine.h +++ b/include/linux/pinctrl/machine.h @@ -26,13 +26,9 @@ * selects a certain specific pin group to activate for the function, if * left as NULL, the first applicable group will be used * @dev_name: the name of the device using this specific mapping, the name - * must be the same as in your struct device* - * @hog_on_boot: if this is set to true, the pin control subsystem will itself - * hog the mappings as the pinmux device drivers are attached, so this is - * typically used with system maps (mux mappings without an assigned - * device) that you want to get hogged and enabled by default as soon as - * a pinmux device supporting it is registered. These maps will not be - * disabled and put until the system shuts down. + * must be the same as in your struct device*. If this name is set to the + * same name as the pin controllers own dev_name(), the map entry will be + * hogged by the driver itself upon registration */ struct pinctrl_map { const char *name; @@ -40,7 +36,6 @@ struct pinctrl_map { const char *function; const char *group; const char *dev_name; - bool hog_on_boot; }; /* @@ -62,8 +57,7 @@ struct pinctrl_map { * to be hogged by the pin control core until the system shuts down. */ #define PIN_MAP_SYS_HOG(a, b, c) \ - { .name = a, .ctrl_dev_name = b, .function = c, \ - .hog_on_boot = true } + { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, } /* * Convenience macro to map a system function onto a certain pinctrl device @@ -71,8 +65,8 @@ struct pinctrl_map { * system shuts down. */ #define PIN_MAP_SYS_HOG_GROUP(a, b, c, d) \ - { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ - .hog_on_boot = true } + { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, \ + .group = d, } #ifdef CONFIG_PINMUX