Skip to contentSkip to conversation

R-Car GPIO fixes

PATCH Superseded Laurent Pinchart 5 participants 7 messages Jun 17, 2013 – Jun 19, 2013

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover R-Car GPIO fixes

Hello,

Here are two small fixes for the gpio-rcar driver. I would push them through the GPIO tree if it wasn't for the fact that they're based on gpio-rcar DT support, scheduled for merge through the ARM SoC tree.

Simon, as these patches are fixes, would it be possible to get them in v3.11 through your tree ?

Laurent Pinchart (2):
gpio-rcar: Reference core gpio documentation in the DT bindings
gpio-rcar: Remove #ifdef CONFIG_OF around OF-specific sections

 .../devicetree/bindings/gpio/renesas,gpio-rcar.txt     | 18 ++++++------------
 drivers/gpio/gpio-rcar.c                               |  8 ++------
 2 files changed, 8 insertions(+), 18 deletions(-)
Signature · 3 lines
Regards,

Laurent Pinchart
#1 lore raw

PATCH 1/2 gpio-rcar: Reference core gpio documentation in the DT bindings

Replaced the detailed gpio-ranges documentation with a reference to the code gpio DT bindings, and mention the gpio flags symbolic names.

Cc devicetree-discuss at lists.ozlabs.org
---
 .../devicetree/bindings/gpio/renesas,gpio-rcar.txt     | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +6 -12
index 46d76a0..cb3dc7b 100644
@@ -16,18 +16,12 @@ Required Properties:
 
   - gpio-controller: Marks the device node as a gpio controller.
   - #gpio-cells: Should be 2. The first cell is the GPIO number and the second
-    cell is used to specify optional parameters as bit flags. Only the GPIO
-    active low flag (bit 0) is currently supported.
-  - gpio-ranges: Range of pins managed by the GPIO controller as a 4-cells
-    tuple using the following syntax.
-
-    <[phandle of the pin controller node]
-     0
-     [index of the first pin]
-     [number of pins]>
-
-Please refer to gpio.txt in this directory for details of the common GPIO
-bindings used by client devices.
+    cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>. Only the
+    GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
+  - gpio-ranges: Range of pins managed by the GPIO controller.
+
+Please refer to gpio.txt in this directory for details of gpio-ranges property
+and the common GPIO bindings used by client devices.
 
 Example: R8A7779 (R-Car H1) GPIO controller nodes
 
Signature · 1 line
1.8.1.5
#3 lore raw

PATCH 2/2 gpio-rcar: Remove #ifdef CONFIG_OF around OF-specific sections

In reply to Laurent Pinchart

All functions and data types used by OF-specific code paths are declared in <linux/of.h> regardless of CONFIG_OF. Replace the #ifdef CONFIG_OF guard with a if(IS_SELECTED(CONFIG_OF)) and let the compiler optimize the unused code away.

---
 drivers/gpio/gpio-rcar.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpio/gpio-rcar.c +2 -6
index 5a693dd..7fd09ef 100644
@@ -279,16 +279,13 @@ static struct irq_domain_ops gpio_rcar_irq_domain_ops = {
 static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
 {
 	struct gpio_rcar_config *pdata = p->pdev->dev.platform_data;
-#ifdef CONFIG_OF
 	struct device_node *np = p->pdev->dev.of_node;
 	struct of_phandle_args args;
 	int ret;
-#endif
 
-	if (pdata)
+	if (pdata) {
 		p->config = *pdata;
-#ifdef CONFIG_OF
-	else if (np) {
+	} else if (IS_ENABLED(CONFIG_OF) && np) {
 		ret = of_parse_phandle_with_args(np, "gpio-ranges",
 				"#gpio-range-cells", 0, &args);
 		p->config.number_of_pins = ret == 0 && args.args_count == 3
@@ -296,7 +293,6 @@ static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
 					 : RCAR_MAX_GPIO_PER_BANK;
 		p->config.gpio_base = -1;
 	}
-#endif
 
 	if (p->config.number_of_pins == 0 ||
 	    p->config.number_of_pins > RCAR_MAX_GPIO_PER_BANK) {
Signature · 1 line
1.8.1.5
#4 lore raw

PATCH 2/2 gpio-rcar: Remove #ifdef CONFIG_OF around OF-specific sections

Hello.

Quoted 3 lines · Laurent Pinchart

All functions and data types used by OF-specific code paths are declared in <linux/of.h> regardless of CONFIG_OF. Replace the #ifdef CONFIG_OF guard with a if(IS_SELECTED(CONFIG_OF)) and let the compiler optimize

You're using IS_ENABLED() actually.

Quoted 20 lines

the unused code away.

---
  drivers/gpio/gpio-rcar.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpio/gpio-rcar.c +0 -2
index 5a693dd..7fd09ef 100644
@@ -279,16 +279,13 @@ static struct irq_domain_ops gpio_rcar_irq_domain_ops = {
  static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p)
  {
  	struct gpio_rcar_config *pdata = p->pdev->dev.platform_data;
-#ifdef CONFIG_OF
  	struct device_node *np = p->pdev->dev.of_node;
  	struct of_phandle_args args;
  	int ret;
-#endif

drivers/gpio/gpio-rcar.c static struct irq_domain_ops gpio_rcar_irq_domain_ops = { · line 291

Quoted 10 lines
drivers/gpio/gpio-rcar.c +2 -3
 
-	if (pdata)
+	if (pdata) {
  		p->config = *pdata;
-#ifdef CONFIG_OF
-	else if (np) {
+	} else if (IS_ENABLED(CONFIG_OF) && np) {
  		ret = of_parse_phandle_with_args(np, "gpio-ranges",
  				"#gpio-range-cells", 0, &args);
  		p->config.number_of_pins = ret == 0 && args.args_count == 3

WBR, Sergei

#5 lore raw

PATCH 2/2 gpio-rcar: Remove #ifdef CONFIG_OF around OF-specific sections

Quoted 8 lines · On Monday 17 June 2013 23:19:07 Sergei Shtylyov wrote:

Hello.

Quoted 3 lines · Laurent Pinchart

All functions and data types used by OF-specific code paths are declared in <linux/of.h> regardless of CONFIG_OF. Replace the #ifdef CONFIG_OF guard with a if(IS_SELECTED(CONFIG_OF)) and let the compiler optimize

You're using IS_ENABLED() actually.

Oops. We should fix gcc to check the commit messages :-)

Simon, could you fix this while applying, or should I resubmit ?

Quoted 42 lines
Quoted 42 lines

the unused code away.

Signed-off-by: Laurent Pinchart
<[email protected]>
---

  drivers/gpio/gpio-rcar.c | 8 ++------
  1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpio/gpio-rcar.c +0 -0
index 5a693dd..7fd09ef 100644
@@ -279,16 +279,13 @@ static struct irq_domain_ops

gpio_rcar_irq_domain_ops = {>
static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p) {

  	struct gpio_rcar_config *pdata = p->pdev->dev.platform_data;
drivers/gpio/gpio-rcar.c +2 -5
-#ifdef CONFIG_OF
 
  	struct device_node *np = p->pdev->dev.of_node;
  	struct of_phandle_args args;
  	int ret;
 
-#endif
 
-	if (pdata)
+	if (pdata) {
 
  		p->config = *pdata;
 
-#ifdef CONFIG_OF
-	else if (np) {
+	} else if (IS_ENABLED(CONFIG_OF) && np) {
 
  		ret = of_parse_phandle_with_args(np, "gpio-ranges",
 
  				"#gpio-range-cells", 0, &args);
 
  		p->config.number_of_pins = ret == 0 && args.args_count == 3
Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

PATCH 2/2 gpio-rcar: Remove #ifdef CONFIG_OF around OF-specific sections

Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Monday 17 June 2013 23:19:07 Sergei Shtylyov wrote:

Hello.

Quoted 3 lines · Laurent Pinchart

All functions and data types used by OF-specific code paths are declared in <linux/of.h> regardless of CONFIG_OF. Replace the #ifdef CONFIG_OF guard with a if(IS_SELECTED(CONFIG_OF)) and let the compiler optimize

Quoted 5 lines
Quoted 1 line

You're using IS_ENABLED() actually.

Oops. We should fix gcc to check the commit messages :-)

Simon, could you fix this while applying, or should I resubmit ?

Please re-spin, thanks.