lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 24 Feb 2012 11:24:52 +0800
From:	Dong Aisheng <aisheng.dong@...escale.com>
To:	Stephen Warren <swarren@...dia.com>
CC:	Linus Walleij <linus.walleij@...aro.org>,
	Linus Walleij <linus.walleij@...ricsson.com>,
	Dong Aisheng-B29396 <B29396@...escale.com>,
	"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
	"dongas86@...il.com" <dongas86@...il.com>,
	"shawn.guo@...aro.org" <shawn.guo@...aro.org>,
	"thomas.abraham@...aro.org" <thomas.abraham@...aro.org>,
	"tony@...mide.com" <tony@...mide.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] pinctrl: Introduce PINCTRL_STATE_DEFAULT define,
 and use it

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 <swarren@...dia.com>
> ---
> 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 <linux/list.h>
>  #include <linux/seq_file.h>
>  
> +#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@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists