linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Crispin <blogic@openwrt.org>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	linux-gpio@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Grant Likely <grant.likely@linaro.org>
Subject: Re: [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper
Date: Tue, 26 May 2015 08:56:06 +0200	[thread overview]
Message-ID: <55641906.1080408@openwrt.org> (raw)
In-Reply-To: <1432586391-27634-2-git-send-email-martin.blumenstingl@googlemail.com>



On 25/05/2015 22:39, Martin Blumenstingl wrote:
> This removes some redundant code but does have any functional impact.

-EPARSE, i assume you mean "... that does not have ..."

please fix the description and resend. the actual patch is fine

	John

> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  drivers/gpio/gpio-stp-xway.c | 27 +++++++++++----------------
>  1 file changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
> index 6d4148f..81bdbe7 100644
> --- a/drivers/gpio/gpio-stp-xway.c
> +++ b/drivers/gpio/gpio-stp-xway.c
> @@ -200,7 +200,7 @@ static int xway_stp_hw_init(struct xway_stp *chip)
>  static int xway_stp_probe(struct platform_device *pdev)
>  {
>  	struct resource *res;
> -	const __be32 *shadow, *groups, *dsl, *phy;
> +	u32 shadow, groups, dsl, phy;
>  	struct xway_stp *chip;
>  	struct clk *clk;
>  	int ret = 0;
> @@ -223,33 +223,28 @@ static int xway_stp_probe(struct platform_device *pdev)
>  	chip->gc.owner = THIS_MODULE;
>  
>  	/* store the shadow value if one was passed by the devicetree */
> -	shadow = of_get_property(pdev->dev.of_node, "lantiq,shadow", NULL);
> -	if (shadow)
> -		chip->shadow = be32_to_cpu(*shadow);
> +	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,shadow", &shadow))
> +		chip->shadow = shadow;
>  
>  	/* find out which gpio groups should be enabled */
> -	groups = of_get_property(pdev->dev.of_node, "lantiq,groups", NULL);
> -	if (groups)
> -		chip->groups = be32_to_cpu(*groups) & XWAY_STP_GROUP_MASK;
> +	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,groups", &groups))
> +		chip->groups = groups & XWAY_STP_GROUP_MASK;
>  	else
>  		chip->groups = XWAY_STP_GROUP0;
>  	chip->gc.ngpio = fls(chip->groups) * 8;
>  
>  	/* find out which gpios are controlled by the dsl core */
> -	dsl = of_get_property(pdev->dev.of_node, "lantiq,dsl", NULL);
> -	if (dsl)
> -		chip->dsl = be32_to_cpu(*dsl) & XWAY_STP_ADSL_MASK;
> +	if (!of_property_read_u32(pdev->dev.of_node, "lantiq,dsl", &dsl))
> +		chip->dsl = dsl & XWAY_STP_ADSL_MASK;
>  
>  	/* find out which gpios are controlled by the phys */
>  	if (of_machine_is_compatible("lantiq,ar9") ||
>  			of_machine_is_compatible("lantiq,gr9") ||
>  			of_machine_is_compatible("lantiq,vr9")) {
> -		phy = of_get_property(pdev->dev.of_node, "lantiq,phy1", NULL);
> -		if (phy)
> -			chip->phy1 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
> -		phy = of_get_property(pdev->dev.of_node, "lantiq,phy2", NULL);
> -		if (phy)
> -			chip->phy2 = be32_to_cpu(*phy) & XWAY_STP_PHY_MASK;
> +		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy1", &phy))
> +			chip->phy1 = phy & XWAY_STP_PHY_MASK;
> +		if (!of_property_read_u32(pdev->dev.of_node, "lantiq,phy2", &phy))
> +			chip->phy2 = phy & XWAY_STP_PHY_MASK;
>  	}
>  
>  	/* check which edge trigger we should use, default to a falling edge */
> 

  reply	other threads:[~2015-05-26  6:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25 20:39 [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs Martin Blumenstingl
2015-05-25 20:39 ` [PATCH 2/2] gpio-stp-xway: Use the of_property_read_u32 helper Martin Blumenstingl
2015-05-26  6:56   ` John Crispin [this message]
2015-05-26 21:12     ` [PATCHv2 " Martin Blumenstingl
2015-06-01 14:59       ` Linus Walleij
2015-05-26  6:54 ` [PATCH 1/2] gpio-stp-xway: Fix enabling the highest bit of the PHY LEDs John Crispin
2015-06-01 14:44 ` Linus Walleij

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=55641906.1080408@openwrt.org \
    --to=blogic@openwrt.org \
    --cc=gnurou@gmail.com \
    --cc=grant.likely@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    /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 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).