From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755001Ab2BXDRa (ORCPT ); Thu, 23 Feb 2012 22:17:30 -0500 Received: from va3ehsobe005.messaging.microsoft.com ([216.32.180.31]:52428 "EHLO VA3EHSOBE007.bigfish.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754525Ab2BXDR3 (ORCPT ); Thu, 23 Feb 2012 22:17:29 -0500 X-SpamScore: -9 X-BigFish: VS-9(zz1432N98dKzz1202hzz8275bh8275dhz2dh2a8h668h839h944h) X-Forefront-Antispam-Report: CIP:70.37.183.190;KIP:(null);UIP:(null);IPV:NLI;H:mail.freescale.net;RD:none;EFVD:NLI Date: Fri, 24 Feb 2012 11:24:52 +0800 From: Dong Aisheng To: Stephen Warren CC: Linus Walleij , Linus Walleij , Dong Aisheng-B29396 , "s.hauer@pengutronix.de" , "dongas86@gmail.com" , "shawn.guo@linaro.org" , "thomas.abraham@linaro.org" , "tony@atomide.com" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 1/3] pinctrl: Introduce PINCTRL_STATE_DEFAULT define, and use it Message-ID: <20120224032451.GA25789@shlinux2.ap.freescale.net> References: <1330041880-12406-1-git-send-email-swarren@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1330041880-12406-1-git-send-email-swarren@nvidia.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 24, 2012 at 08:04:38AM +0800, Stephen Warren wrote: > This provides a single centralized name for the default state. > > Update PIN_MAP_* macros to use this state name, instead of requiring the > user to pass a state name in. > > Update documentation and mapping tables to use this. > > Signed-off-by: Stephen Warren > --- > These 3 patches are small cleanup/fixes triggered by review comments from > the 20-long series I posted a few days ago. > > These patches are based on the 4-long series that I posted yesterday. > > Documentation/pinctrl.txt | 8 ++++---- > arch/arm/mach-u300/core.c | 6 +++--- > include/linux/pinctrl/machine.h | 13 ++++++++----- > include/linux/pinctrl/pinctrl.h | 2 ++ > 4 files changed, 17 insertions(+), 12 deletions(-) > > diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt > index fa9163a..8bf46bc 100644 > --- a/Documentation/pinctrl.txt > +++ b/Documentation/pinctrl.txt > @@ -814,7 +814,7 @@ it even more compact which assumes you want to use pinctrl-foo and position > 0 for mapping, for example: > > static struct pinctrl_map __initdata mapping[] = { > - PIN_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"), > + PIN_MAP(PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", "foo-i2c.0"), To keep align with the following PIN_MAP_SYS_HOG("pinmux-u300", "power"), Maybe PIN_MAP("pinctrl-foo", "i2c0", "foo-i2c.0") is better, right? And we may want to add a PIN_MAP_STAT macro, as well as PIN_MAP_SYS_HOG_STAT. Regards Dong Aisheng > }; > > > @@ -930,7 +930,7 @@ foo_probe() > /* Allocate a state holder named "state" etc */ > struct pinctrl p; > > - p = pinctrl_get(&device, NULL); > + p = pinctrl_get(&device, PINCTRL_STATE_DEFAULT); > if IS_ERR(p) > return PTR_ERR(p); > pinctrl_enable(p); > @@ -988,7 +988,7 @@ 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" > + .name = PINCTRL_STATE_DEFAULT, > .ctrl_dev_name = "pinctrl-foo", > .function = "power_func", > .dev_name = "pinctrl-foo", > @@ -998,7 +998,7 @@ 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", "pinctrl-foo", "power_func") > +PIN_MAP_SYS_HOG("pinctrl-foo", "power_func") > > This gives the exact same result as the above construction. > > diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c > index d66bc97..2388dc2 100644 > --- a/arch/arm/mach-u300/core.c > +++ b/arch/arm/mach-u300/core.c > @@ -1554,9 +1554,9 @@ static struct platform_device pinmux_device = { > /* Pinmux settings */ > static struct pinctrl_map __initdata u300_pinmux_map[] = { > /* anonymous maps for chip power and EMIFs */ > - PIN_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), > - PIN_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), > - PIN_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), > + PIN_MAP_SYS_HOG("pinmux-u300", "power"), > + PIN_MAP_SYS_HOG("pinmux-u300", "emif0"), > + PIN_MAP_SYS_HOG("pinmux-u300", "emif1"), > /* per-device maps for MMC/SD, SPI and UART */ > PIN_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), > PIN_MAP("SPI", "pinmux-u300", "spi0", "pl022"), > diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h > index 400f192..4743f84 100644 > --- a/include/linux/pinctrl/machine.h > +++ b/include/linux/pinctrl/machine.h > @@ -12,6 +12,8 @@ > #ifndef __LINUX_PINCTRL_MACHINE_H > #define __LINUX_PINCTRL_MACHINE_H > > +#include "pinctrl.h" > + > /** > * struct pinctrl_map - boards/machines shall provide this map for devices > * @name: the name of this specific map entry for the particular machine. > @@ -49,17 +51,18 @@ struct pinctrl_map { > * Convenience macro to map a system function onto a certain pinctrl device, > * 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, .dev_name = b, .function = c, } > +#define PIN_MAP_SYS_HOG(a, b) \ > + { .name = PINCTRL_STATE_DEFAULT, .ctrl_dev_name = a, .dev_name = a, \ > + .function = b, } > > /* > * Convenience macro to map a system function onto a certain pinctrl device > * using a specified group, to be hogged by the pin control core until the > * system shuts down. > */ > -#define PIN_MAP_SYS_HOG_GROUP(a, b, c, d) \ > - { .name = a, .ctrl_dev_name = b, .dev_name = b, .function = c, \ > - .group = d, } > +#define PIN_MAP_SYS_HOG_GROUP(a, b, c) \ > + { .name = PINCTRL_STATE_DEFAULT, .ctrl_dev_name = a, .dev_name = a, \ > + .function = b, .group = c, } > > #ifdef CONFIG_PINMUX > > diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h > index 8bd22ee..411fe23 100644 > --- a/include/linux/pinctrl/pinctrl.h > +++ b/include/linux/pinctrl/pinctrl.h > @@ -19,6 +19,8 @@ > #include > #include > > +#define PINCTRL_STATE_DEFAULT "default" > + > struct pinctrl_dev; > struct pinmux_ops; > struct pinconf_ops; > -- > 1.7.0.4 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >