linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] gpiolib: make names array and its values const
       [not found] <20100203155558.GH11354@pengutronix.de>
@ 2010-02-08  9:09 ` Uwe Kleine-König
  2010-02-08  9:37   ` Baruch Siach
                     ` (2 more replies)
  2010-02-08  9:09 ` [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it Uwe Kleine-König
  2010-02-08  9:09 ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
  2 siblings, 3 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-02-08  9:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, Andrew Morton, David Brownell, Jani Nikula,
	Daniel Glöckner, Nate Case, H Hartley Sweeten,
	Daniel Silverstone, Arnd Bergmann, Mike Frysinger, Kevin Wells

gpiolib doesn't need to modify the names and I assume most initializers
use sting constants that shouldn't be modified anyhow.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Kevin Wells <kevin.wells@nxp.com>
---
 drivers/gpio/gpiolib.c      |    2 +-
 drivers/gpio/pca953x.c      |    2 +-
 include/asm-generic/gpio.h  |    2 +-
 include/linux/i2c/pca953x.h |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index a25ad28..8543685 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -716,7 +716,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
 	unsigned long		flags;
 	struct gpio_desc	*desc;
 	int			status = -EINVAL;
-	char			*ioname = NULL;
+	const char		*ioname = NULL;
 
 	/* can't export until sysfs is available ... */
 	if (!gpio_class.p) {
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 6a2fb3f..4faeca4 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -56,7 +56,7 @@ struct pca953x_chip {
 	struct i2c_client *client;
 	struct pca953x_platform_data *dyn_pdata;
 	struct gpio_chip gpio_chip;
-	char **names;
+	const char *const *names;
 };
 
 static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 485eeb6..37af893 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -98,7 +98,7 @@ struct gpio_chip {
 						struct gpio_chip *chip);
 	int			base;
 	u16			ngpio;
-	char			**names;
+	const char		*const *names;
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 };
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 81736d6..4630fab 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -15,5 +15,5 @@ struct pca953x_platform_data {
 	int		(*teardown)(struct i2c_client *client,
 				unsigned gpio, unsigned ngpio,
 				void *context);
-	char		**names;
+	const char	*const *names;
 };
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it
       [not found] <20100203155558.GH11354@pengutronix.de>
  2010-02-08  9:09 ` [PATCH 1/3] gpiolib: make names array and its values const Uwe Kleine-König
@ 2010-02-08  9:09 ` Uwe Kleine-König
  2010-02-08  9:09 ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
  2 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-02-08  9:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, Andrew Morton, David Brownell, Jani Nikula,
	Daniel Glöckner, Nate Case, H Hartley Sweeten,
	Daniel Silverstone, Arnd Bergmann, Mike Frysinger

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpiolib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8543685..20988c8 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -747,7 +747,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
 		struct device	*dev;
 
 		dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
-				desc, ioname ? ioname : "gpio%d", gpio);
+				desc, ioname ? ioname : "gpio%u", gpio);
 		if (!IS_ERR(dev)) {
 			status = sysfs_create_group(&dev->kobj,
 						&gpio_attr_group);
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] gpiolib: document that names can contain printk format specifiers
       [not found] <20100203155558.GH11354@pengutronix.de>
  2010-02-08  9:09 ` [PATCH 1/3] gpiolib: make names array and its values const Uwe Kleine-König
  2010-02-08  9:09 ` [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it Uwe Kleine-König
@ 2010-02-08  9:09 ` Uwe Kleine-König
  2010-02-08  9:16   ` Uwe Kleine-König
  2 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2010-02-08  9:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, Andrew Morton, David Brownell, Jani Nikula,
	Daniel Glöckner, Nate Case, H Hartley Sweeten,
	Daniel Silverstone, Arnd Bergmann, Mike Frysinger

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/asm-generic/gpio.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 37af893..abdb5d3 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -60,7 +60,8 @@ struct module;
  * @names: if set, must be an array of strings to use as alternative
  *      names for the GPIOs in this chip. Any entry in the array
  *      may be NULL if there is no alias for the GPIO, however the
- *      array must be @ngpio entries long.
+ *      array must be @ngpio entries long.  A name can include a single printk
+ *      format specifier for an unsigned int.
  *
  * A gpio_chip can help platforms abstract various sources of GPIOs so
  * they can all be accessed through a common programing interface.
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] gpiolib: document that names can contain printk format specifiers
  2010-02-08  9:09 ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
@ 2010-02-08  9:16   ` Uwe Kleine-König
  0 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-02-08  9:16 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-arm-kernel, Andrew Morton, David Brownell, Jani Nikula,
	Daniel Glöckner, Nate Case, H Hartley Sweeten,
	Daniel Silverstone, Arnd Bergmann, Mike Frysinger

Hello,

On Mon, Feb 08, 2010 at 10:09:40AM +0100, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  include/asm-generic/gpio.h |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index 37af893..abdb5d3 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -60,7 +60,8 @@ struct module;
>   * @names: if set, must be an array of strings to use as alternative
>   *      names for the GPIOs in this chip. Any entry in the array
>   *      may be NULL if there is no alias for the GPIO, however the
> - *      array must be @ngpio entries long.
> + *      array must be @ngpio entries long.  A name can include a single printk
> + *      format specifier for an unsigned int.
probably add: "It is substituted by the actual number of the gpio."

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] gpiolib: make names array and its values const
  2010-02-08  9:09 ` [PATCH 1/3] gpiolib: make names array and its values const Uwe Kleine-König
@ 2010-02-08  9:37   ` Baruch Siach
  2010-02-08  9:43     ` Uwe Kleine-König
  2010-02-24 10:35   ` Uwe Kleine-König
  2010-03-22 20:47   ` Uwe Kleine-König
  2 siblings, 1 reply; 11+ messages in thread
From: Baruch Siach @ 2010-02-08  9:37 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-kernel, David Brownell, Mike Frysinger, Nate Case,
	Daniel Silverstone, Kevin Wells, Daniel Glöckner,
	H Hartley Sweeten, Arnd Bergmann, Jani Nikula, Andrew Morton,
	linux-arm-kernel

Hi Uwe,

On Mon, Feb 08, 2010 at 10:09:38AM +0100, Uwe Kleine-König wrote:
> gpiolib doesn't need to modify the names and I assume most initializers
> use sting constants that shouldn't be modified anyhow.

s/sting/string/

> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Kevin Wells <kevin.wells@nxp.com>
> ---

[snip]

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] gpiolib: make names array and its values const
  2010-02-08  9:37   ` Baruch Siach
@ 2010-02-08  9:43     ` Uwe Kleine-König
  0 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-02-08  9:43 UTC (permalink / raw)
  To: Baruch Siach
  Cc: linux-kernel, David Brownell, Mike Frysinger, Nate Case,
	Daniel Silverstone, Kevin Wells, Daniel Glöckner,
	H Hartley Sweeten, Arnd Bergmann, Jani Nikula, Andrew Morton,
	linux-arm-kernel

Hi Baruch,

On Mon, Feb 08, 2010 at 11:37:24AM +0200, Baruch Siach wrote:
> Hi Uwe,
> 
> On Mon, Feb 08, 2010 at 10:09:38AM +0100, Uwe Kleine-König wrote:
> > gpiolib doesn't need to modify the names and I assume most initializers
> > use sting constants that shouldn't be modified anyhow.
> 
> s/sting/string/
Thanks, fixed in my tree.

BTW, you can get the updated series at

	git://git.pengutronix.de/git/ukl/linux-2.6.git gpiolib/names

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] gpiolib: make names array and its values const
  2010-02-08  9:09 ` [PATCH 1/3] gpiolib: make names array and its values const Uwe Kleine-König
  2010-02-08  9:37   ` Baruch Siach
@ 2010-02-24 10:35   ` Uwe Kleine-König
  2010-03-22 20:47   ` Uwe Kleine-König
  2 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-02-24 10:35 UTC (permalink / raw)
  To: David Brownell
  Cc: linux-arm-kernel, Andrew Morton, Jani Nikula,
	Daniel Glöckner, Nate Case, H Hartley Sweeten,
	Daniel Silverstone, Arnd Bergmann, Mike Frysinger, Kevin Wells,
	linux-kernel

Hi David,

what do you think about these three patches?  Should I resend?

Best regards
Uwe

The following changes since commit 6339204ecc2aa2067a99595522de0403f0854bb8:
  Linus Torvalds (1):
        Merge branch 'for-linus' of git://git.kernel.org/.../viro/vfs-2.6

are available in the git repository at:

  git://git.pengutronix.de/git/ukl/linux-2.6.git gpiolib/names

Uwe Kleine-König (3):
      gpiolib: make names array and its values const
      gpiolib: a gpio is unsigned, so use %u to print it
      gpiolib: document that names can contain printk format specifiers

 drivers/gpio/gpiolib.c      |    4 ++--
 drivers/gpio/pca953x.c      |    2 +-
 include/asm-generic/gpio.h  |    6 ++++--
 include/linux/i2c/pca953x.h |    2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)
-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/3] gpiolib: make names array and its values const
  2010-02-08  9:09 ` [PATCH 1/3] gpiolib: make names array and its values const Uwe Kleine-König
  2010-02-08  9:37   ` Baruch Siach
  2010-02-24 10:35   ` Uwe Kleine-König
@ 2010-03-22 20:47   ` Uwe Kleine-König
  2010-03-23 10:24     ` Uwe Kleine-König
                       ` (2 more replies)
  2 siblings, 3 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-03-22 20:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-arm-kernel, David Brownell, Jani Nikula,
	Daniel Glöckner, Nate Case, H Hartley Sweeten,
	Daniel Silverstone, Arnd Bergmann, Mike Frysinger, Kevin Wells,
	linux-kernel

Hi Andrew,

On Mon, Feb 08, 2010 at 10:09:38AM +0100, Uwe Kleine-König wrote:
> gpiolib doesn't need to modify the names and I assume most initializers
> use sting constants that shouldn't be modified anyhow.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Kevin Wells <kevin.wells@nxp.com>
> ---
>  drivers/gpio/gpiolib.c      |    2 +-
>  drivers/gpio/pca953x.c      |    2 +-
>  include/asm-generic/gpio.h  |    2 +-
>  include/linux/i2c/pca953x.h |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

I haven't received feed back for these patches.  Would you care to take
them?  If yes, should I resend?  Alternatively you can get them from 

	git://git.pengutronix.de/git/ukl/linux-2.6.git gpiolib/names

whatever is easiest for you ...

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] gpiolib: make names array and its values const
  2010-03-22 20:47   ` Uwe Kleine-König
@ 2010-03-23 10:24     ` Uwe Kleine-König
  2010-03-23 10:24     ` [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it Uwe Kleine-König
  2010-03-23 10:24     ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
  2 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-03-23 10:24 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton; +Cc: Kevin Wells

gpiolib doesn't need to modify the names and I assume most initializers
use string constants that shouldn't be modified anyhow.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Kevin Wells <kevin.wells@nxp.com>
---
 drivers/gpio/gpiolib.c      |    2 +-
 drivers/gpio/pca953x.c      |    2 +-
 include/asm-generic/gpio.h  |    2 +-
 include/linux/i2c/pca953x.h |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 6d1b866..03e82d5 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -720,7 +720,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
 	unsigned long		flags;
 	struct gpio_desc	*desc;
 	int			status = -EINVAL;
-	char			*ioname = NULL;
+	const char		*ioname = NULL;
 
 	/* can't export until sysfs is available ... */
 	if (!gpio_class.p) {
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index ab5daab..60553d0 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -72,7 +72,7 @@ struct pca953x_chip {
 	struct i2c_client *client;
 	struct pca953x_platform_data *dyn_pdata;
 	struct gpio_chip gpio_chip;
-	char **names;
+	const char *const *names;
 };
 
 static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 979c6a5..bc0c14d 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -98,7 +98,7 @@ struct gpio_chip {
 						struct gpio_chip *chip);
 	int			base;
 	u16			ngpio;
-	char			**names;
+	const char		*const *names;
 	unsigned		can_sleep:1;
 	unsigned		exported:1;
 };
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index d5c5a60..139ba52 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -24,7 +24,7 @@ struct pca953x_platform_data {
 	int		(*teardown)(struct i2c_client *client,
 				unsigned gpio, unsigned ngpio,
 				void *context);
-	char		**names;
+	const char	*const *names;
 };
 
 #endif /* _LINUX_PCA953X_H */
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it
  2010-03-22 20:47   ` Uwe Kleine-König
  2010-03-23 10:24     ` Uwe Kleine-König
@ 2010-03-23 10:24     ` Uwe Kleine-König
  2010-03-23 10:24     ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
  2 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-03-23 10:24 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpiolib.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 03e82d5..548b71e 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -751,7 +751,7 @@ int gpio_export(unsigned gpio, bool direction_may_change)
 		struct device	*dev;
 
 		dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0),
-				desc, ioname ? ioname : "gpio%d", gpio);
+				desc, ioname ? ioname : "gpio%u", gpio);
 		if (!IS_ERR(dev)) {
 			status = sysfs_create_group(&dev->kobj,
 						&gpio_attr_group);
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] gpiolib: document that names can contain printk format specifiers
  2010-03-22 20:47   ` Uwe Kleine-König
  2010-03-23 10:24     ` Uwe Kleine-König
  2010-03-23 10:24     ` [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it Uwe Kleine-König
@ 2010-03-23 10:24     ` Uwe Kleine-König
  2 siblings, 0 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2010-03-23 10:24 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/asm-generic/gpio.h |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index bc0c14d..fb1ecf8 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -60,7 +60,9 @@ struct module;
  * @names: if set, must be an array of strings to use as alternative
  *      names for the GPIOs in this chip. Any entry in the array
  *      may be NULL if there is no alias for the GPIO, however the
- *      array must be @ngpio entries long.
+ *      array must be @ngpio entries long.  A name can include a single printk
+ *      format specifier for an unsigned int.  It is substituted by the actual
+ *      number of the gpio.
  *
  * A gpio_chip can help platforms abstract various sources of GPIOs so
  * they can all be accessed through a common programing interface.
-- 
1.7.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-03-23 10:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100203155558.GH11354@pengutronix.de>
2010-02-08  9:09 ` [PATCH 1/3] gpiolib: make names array and its values const Uwe Kleine-König
2010-02-08  9:37   ` Baruch Siach
2010-02-08  9:43     ` Uwe Kleine-König
2010-02-24 10:35   ` Uwe Kleine-König
2010-03-22 20:47   ` Uwe Kleine-König
2010-03-23 10:24     ` Uwe Kleine-König
2010-03-23 10:24     ` [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it Uwe Kleine-König
2010-03-23 10:24     ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
2010-02-08  9:09 ` [PATCH 2/3] gpiolib: a gpio is unsigned, so use %u to print it Uwe Kleine-König
2010-02-08  9:09 ` [PATCH 3/3] gpiolib: document that names can contain printk format specifiers Uwe Kleine-König
2010-02-08  9:16   ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).