public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Rohit Vaswani <rvaswani@codeaurora.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Rob Landley <rob@landley.net>,
	Russell King <linux@arm.linux.org.uk>,
	David Brown <davidb@codeaurora.org>,
	Bryan Huntsman <bryanh@codeaurora.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] gpio: msm: Add device tree and irqdomain support for gpio-msm-v2
Date: Tue, 21 May 2013 14:06:27 -0700	[thread overview]
Message-ID: <20130521210627.GA599@codeaurora.org> (raw)
In-Reply-To: <1369161163-6448-4-git-send-email-rvaswani@codeaurora.org>

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 87d5670..f3c1978 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -165,7 +165,7 @@ config GPIO_MSM_V1
>  
>  config GPIO_MSM_V2
>  	tristate "Qualcomm MSM GPIO v2"
> -	depends on GPIOLIB && ARCH_MSM
> +	depends on GPIOLIB && ARCH_MSM && OF

This doesn't actually rely on ARCH_MSM anymore so I think we can
drop that dependency.

>  	help
>  	  Say yes here to support the GPIO interface on ARM v7 based
>  	  Qualcomm MSM chips.  Most of the pins on the MSM can be
> @@ -222,7 +229,6 @@ static void msm_gpio_update_dual_edge_pos(unsigned gpio)
>  		else
>  			set_gpio_bits(BIT(INTR_POL_CTL), GPIO_INTR_CFG(gpio));
>  		val2 = readl(GPIO_IN_OUT(gpio)) & BIT(GPIO_IN);
> -		intstat = readl(GPIO_INTR_STATUS(gpio)) & BIT(INTR_STATUS);
>  		if (intstat || val == val2)

Looks like intstat is used uninitialized now?

> +
> +static int msm_gpio_probe(struct platform_device *pdev)
> +{
> +	int i, irq, ret, ngpio;
> +	struct resource *res;
> +
> +	msm_gpio.gpio_chip.label = pdev->name;
> +	msm_gpio.gpio_chip.dev = &pdev->dev;
> +	of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio);

Fail probe if the property isn't there?

> +	msm_gpio.gpio_chip.ngpio = ngpio;
> +
> +	res = platform_get_resource(&pdev->dev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
> +		return -EINVAL;
> +	}
> +
> +	msm_tlmm_base = devm_ioremap_resource(pdev->dev, res);
> +	if (!msm_tlmm_base) {
> +		dev_err(&pdev->dev, "Couldn't allocate memory for msm tlmm base\n");
> +		return -ENOMEM;
> +	}

devm_ioremap_resource() returns an ERR_PTR on failure, not NULL.
Also, it already prints messages on errors so you can drop all the
prints around this. Just do

	res = platform_get_resource(&pdev->dev, IORESOURCE_MEM, 0);
	msm_tlmm_base = devm_ioremap_resource(pdev->dev, res);
	if (IS_ERR(msm_tlmm_base))
		return ERR_PTR(msm_tlmm_base);
  

>  static int __init msm_gpio_init(void)
>  {
> -	int rc;
> -
> -	rc = platform_driver_register(&msm_gpio_driver);
> -	if (!rc) {
> -		rc = platform_device_register(&msm_device_gpio);
> -		if (rc)
> -			platform_driver_unregister(&msm_gpio_driver);
> -	}
> -
> -	return rc;
> +	return platform_driver_register(&msm_gpio_driver);
>  }
>  
>  static void __exit msm_gpio_exit(void)
>  {
> -	platform_device_unregister(&msm_device_gpio);
>  	platform_driver_unregister(&msm_gpio_driver);
>  }

You could use module_platform_driver here now too.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

  reply	other threads:[~2013-05-21 21:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21 18:32 [PATCH 0/3] Cleanup MSM_GPIOMUX and add device-tree support for Rohit Vaswani
2013-05-21 18:32 ` [PATCH 1/3] ARM: msm: Remove gpiomux-v2 and re-organize MSM_GPIOMUX configs Rohit Vaswani
2013-05-30 17:53   ` Linus Walleij
2013-05-21 18:32 ` [PATCH 2/3] ARM: msm: Remove unused and unmapped MSM_TLMM_BASE for 8x60 Rohit Vaswani
2013-05-21 18:32 ` [PATCH 3/3] gpio: msm: Add device tree and irqdomain support for gpio-msm-v2 Rohit Vaswani
2013-05-21 21:06   ` Stephen Boyd [this message]
2013-05-22 19:29     ` Rohit Vaswani
2013-05-22  9:36   ` Stanimir Varbanov
2013-05-22 19:27     ` Rohit Vaswani
2013-05-30 17:54 ` [PATCH 0/3] Cleanup MSM_GPIOMUX and add device-tree support for Linus Walleij
  -- strict thread matches above, loose matches on Subject: below --
2013-06-10 22:50 [PATCHv5 0/3] Cleanup MSM_GPIOMUX and add DT support for gpio-msm Rohit Vaswani
2013-06-10 22:50 ` [PATCH 3/3] gpio: msm: Add device tree and irqdomain support for gpio-msm-v2 Rohit Vaswani
2013-06-11 12:45   ` Grant Likely

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=20130521210627.GA599@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=bryanh@codeaurora.org \
    --cc=davidb@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=rvaswani@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox