All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC/PATCH v2 2/2] gpio-rcar: Add DT support
Date: Thu, 13 Jun 2013 17:08:42 +0000	[thread overview]
Message-ID: <2687390.IKNGX5KlWy@avalon> (raw)
In-Reply-To: <20130612114911.638683E0A56@localhost>

Hi Grant,

Thanks for the review.

On Wednesday 12 June 2013 12:49:11 Grant Likely wrote:
> On Tue, 21 May 2013 13:40:06 +0200, Laurent Pinchart wrote:
> > Add DT bindings for the gpio-rcar driver and read the device
> > configuration from the DT node at probe time if available.
> > 
> > Cc: devicetree-discuss@lists.ozlabs.org
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../devicetree/bindings/gpio/renesas,gpio-rcar.txt | 52 +++++++++++++++++
> >  drivers/gpio/gpio-rcar.c                           | 66 ++++++++++++++---
> >  2 files changed, 108 insertions(+), 10 deletions(-)
> >  create mode 100644
> >  Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt

[snip]

> > diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> > index 0f3d647..c153837 100644
> > --- a/drivers/gpio/gpio-rcar.c
> > +++ b/drivers/gpio/gpio-rcar.c

[snip]

> > +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)
> > +		p->config = *pdata;
> > +#ifdef CONFIG_OF
> > +	else if (np) {
> 
> Try this:
> 	else if ((IS_ENABLED(CONFIG_OF)) && np) {
> 
> It's much better than adding #ifdef blocks to .c files. In v3.11 a bunch
> of the OF forward declarations get pulled out from under the #ifdef
> block so that you can use the above construct.

As a pull request has already been sent to the ARM SoC maintainers, and given 
that this isn't a critical issue, I'll address it as a follow-up patch if 
that's fine with you.

> > +		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
> > +					 ? args.args[2]
> > +					 : 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) {
> > +		dev_warn(&p->pdev->dev,
> > +			 "Invalid number of gpio lines %u, using %u\n",
> > +			 p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK);
> > +		p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK;
> > +	}
> > +}

-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	linux-sh@vger.kernel.org, Magnus Damm <damm@opensource.se>,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: Re: [RFC/PATCH v2 2/2] gpio-rcar: Add DT support
Date: Thu, 13 Jun 2013 19:08:42 +0200	[thread overview]
Message-ID: <2687390.IKNGX5KlWy@avalon> (raw)
In-Reply-To: <20130612114911.638683E0A56@localhost>

Hi Grant,

Thanks for the review.

On Wednesday 12 June 2013 12:49:11 Grant Likely wrote:
> On Tue, 21 May 2013 13:40:06 +0200, Laurent Pinchart wrote:
> > Add DT bindings for the gpio-rcar driver and read the device
> > configuration from the DT node at probe time if available.
> > 
> > Cc: devicetree-discuss@lists.ozlabs.org
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../devicetree/bindings/gpio/renesas,gpio-rcar.txt | 52 +++++++++++++++++
> >  drivers/gpio/gpio-rcar.c                           | 66 ++++++++++++++---
> >  2 files changed, 108 insertions(+), 10 deletions(-)
> >  create mode 100644
> >  Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt

[snip]

> > diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> > index 0f3d647..c153837 100644
> > --- a/drivers/gpio/gpio-rcar.c
> > +++ b/drivers/gpio/gpio-rcar.c

[snip]

> > +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)
> > +		p->config = *pdata;
> > +#ifdef CONFIG_OF
> > +	else if (np) {
> 
> Try this:
> 	else if ((IS_ENABLED(CONFIG_OF)) && np) {
> 
> It's much better than adding #ifdef blocks to .c files. In v3.11 a bunch
> of the OF forward declarations get pulled out from under the #ifdef
> block so that you can use the above construct.

As a pull request has already been sent to the ARM SoC maintainers, and given 
that this isn't a critical issue, I'll address it as a follow-up patch if 
that's fine with you.

> > +		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
> > +					 ? args.args[2]
> > +					 : 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) {
> > +		dev_warn(&p->pdev->dev,
> > +			 "Invalid number of gpio lines %u, using %u\n",
> > +			 p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK);
> > +		p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK;
> > +	}
> > +}

-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH v2 2/2] gpio-rcar: Add DT support
Date: Thu, 13 Jun 2013 19:08:42 +0200	[thread overview]
Message-ID: <2687390.IKNGX5KlWy@avalon> (raw)
In-Reply-To: <20130612114911.638683E0A56@localhost>

Hi Grant,

Thanks for the review.

On Wednesday 12 June 2013 12:49:11 Grant Likely wrote:
> On Tue, 21 May 2013 13:40:06 +0200, Laurent Pinchart wrote:
> > Add DT bindings for the gpio-rcar driver and read the device
> > configuration from the DT node at probe time if available.
> > 
> > Cc: devicetree-discuss at lists.ozlabs.org
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../devicetree/bindings/gpio/renesas,gpio-rcar.txt | 52 +++++++++++++++++
> >  drivers/gpio/gpio-rcar.c                           | 66 ++++++++++++++---
> >  2 files changed, 108 insertions(+), 10 deletions(-)
> >  create mode 100644
> >  Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt

[snip]

> > diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
> > index 0f3d647..c153837 100644
> > --- a/drivers/gpio/gpio-rcar.c
> > +++ b/drivers/gpio/gpio-rcar.c

[snip]

> > +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)
> > +		p->config = *pdata;
> > +#ifdef CONFIG_OF
> > +	else if (np) {
> 
> Try this:
> 	else if ((IS_ENABLED(CONFIG_OF)) && np) {
> 
> It's much better than adding #ifdef blocks to .c files. In v3.11 a bunch
> of the OF forward declarations get pulled out from under the #ifdef
> block so that you can use the above construct.

As a pull request has already been sent to the ARM SoC maintainers, and given 
that this isn't a critical issue, I'll address it as a follow-up patch if 
that's fine with you.

> > +		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
> > +					 ? args.args[2]
> > +					 : 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) {
> > +		dev_warn(&p->pdev->dev,
> > +			 "Invalid number of gpio lines %u, using %u\n",
> > +			 p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK);
> > +		p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK;
> > +	}
> > +}

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2013-06-13 17:08 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 11:40 [RFC/PATCH v2 0/2] R-Car GPIO DT bindings Laurent Pinchart
2013-05-21 11:40 ` Laurent Pinchart
2013-05-21 11:40 ` Laurent Pinchart
2013-05-21 11:40 ` [RFC/PATCH v2 1/2] gpio-rcar: Make the platform data gpio_base field signed Laurent Pinchart
2013-05-21 11:40   ` Laurent Pinchart
2013-05-21 11:40   ` Laurent Pinchart
2013-05-23  1:39   ` Simon Horman
2013-05-23  1:39     ` Simon Horman
2013-05-23  1:39     ` Simon Horman
2013-05-21 11:40 ` [RFC/PATCH v2 2/2] gpio-rcar: Add DT support Laurent Pinchart
2013-05-21 11:40   ` Laurent Pinchart
2013-05-21 11:40   ` Laurent Pinchart
2013-05-30 17:38   ` Linus Walleij
2013-05-30 17:38     ` Linus Walleij
2013-05-30 17:38     ` Linus Walleij
2013-05-31  1:20     ` Laurent Pinchart
2013-05-31  1:20       ` Laurent Pinchart
2013-05-31  1:20       ` Laurent Pinchart
2013-05-31  7:01       ` Linus Walleij
2013-05-31  7:01         ` Linus Walleij
2013-05-31  7:01         ` Linus Walleij
2013-05-31  7:32         ` Laurent Pinchart
2013-05-31  7:32           ` Laurent Pinchart
2013-05-31  7:32           ` Laurent Pinchart
2013-06-12 11:49   ` Grant Likely
2013-06-12 11:49     ` Grant Likely
2013-06-12 11:49     ` Grant Likely
2013-06-13 17:08     ` Laurent Pinchart [this message]
2013-06-13 17:08       ` Laurent Pinchart
2013-06-13 17:08       ` Laurent Pinchart
2013-05-25  1:24 ` [RFC/PATCH v2 0/2] R-Car GPIO DT bindings Simon Horman
2013-05-25  1:24   ` Simon Horman
2013-05-25  1:24   ` Simon Horman
2013-06-11 22:14   ` Laurent Pinchart
2013-06-11 22:14     ` Laurent Pinchart
2013-06-11 22:14     ` Laurent Pinchart
2013-06-12  1:51     ` Simon Horman
2013-06-12  1:51       ` Simon Horman
2013-06-12  1:51       ` Simon Horman
2013-06-12 14:09       ` Simon Horman
2013-06-12 14:09         ` Simon Horman
2013-06-12 14:09         ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2687390.IKNGX5KlWy@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.