All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: linux-acpi@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linus Walleij <linus.walleij@linaro.org>,
	Chris Ball <cjb@laptop.org>,
	Johannes Berg <johannes@sipsolutions.net>,
	Rhyland Klein <rklein@nvidia.com>,
	Alexandre Courbot <acourbot@nvidia.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	Rob Landley <rob@landley.net>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/7] mmc: sdhci-acpi: covert to use GPIO descriptor API
Date: Fri, 22 Nov 2013 15:39:59 +0200	[thread overview]
Message-ID: <528F5EAF.8070109@intel.com> (raw)
In-Reply-To: <1385122474-14926-5-git-send-email-mika.westerberg@linux.intel.com>

On 22/11/13 14:14, Mika Westerberg wrote:
> The new descriptor based GPIO interface is now the recommended and safer
> way of using GPIOs from device drivers. Convert the ACPI SDHCI driver to
> use that interface.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-acpi.c | 26 ++++++++++++--------------
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index ef19874fcd1f..5c86550f83ad 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -31,10 +31,9 @@
>  #include <linux/bitops.h>
>  #include <linux/types.h>
>  #include <linux/err.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
>  #include <linux/interrupt.h>
>  #include <linux/acpi.h>
> -#include <linux/acpi_gpio.h>
>  #include <linux/pm.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/delay.h>
> @@ -199,22 +198,23 @@ static irqreturn_t sdhci_acpi_sd_cd(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> -static int sdhci_acpi_add_own_cd(struct device *dev, int gpio,
> -				 struct mmc_host *mmc)
> +static int sdhci_acpi_add_own_cd(struct device *dev, struct mmc_host *mmc)
>  {
> +	struct gpio_desc *desc;
>  	unsigned long flags;
>  	int err, irq;
>  
> -	if (gpio < 0) {
> -		err = gpio;
> +	desc = devm_gpiod_get_index(dev, "sd_cd", 0);
> +	if (IS_ERR(desc)) {
> +		err = PTR_ERR(desc);
>  		goto out;
>  	}
>  
> -	err = devm_gpio_request_one(dev, gpio, GPIOF_DIR_IN, "sd_cd");
> +	err = gpiod_direction_input(desc);
>  	if (err)
> -		goto out;
> +		goto out_free;
>  
> -	irq = gpio_to_irq(gpio);
> +	irq = gpiod_to_irq(desc);
>  	if (irq < 0) {
>  		err = irq;
>  		goto out_free;
> @@ -228,7 +228,7 @@ static int sdhci_acpi_add_own_cd(struct device *dev, int gpio,
>  	return 0;
>  
>  out_free:
> -	devm_gpio_free(dev, gpio);
> +	devm_gpiod_put(dev, desc);
>  out:
>  	dev_warn(dev, "failed to setup card detect wake up\n");
>  	return err;
> @@ -254,7 +254,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  	struct resource *iomem;
>  	resource_size_t len;
>  	const char *hid;
> -	int err, gpio;
> +	int err;
>  
>  	if (acpi_bus_get_device(handle, &device))
>  		return -ENODEV;
> @@ -279,8 +279,6 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  	if (IS_ERR(host))
>  		return PTR_ERR(host);
>  
> -	gpio = acpi_get_gpio_by_index(dev, 0, NULL);
> -
>  	c = sdhci_priv(host);
>  	c->host = host;
>  	c->slot = sdhci_acpi_get_slot(handle, hid);
> @@ -338,7 +336,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>  		goto err_free;
>  
>  	if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) {
> -		if (sdhci_acpi_add_own_cd(dev, gpio, host->mmc))
> +		if (sdhci_acpi_add_own_cd(dev, host->mmc))
>  			c->use_runtime_pm = false;
>  	}
>  
> 


  reply	other threads:[~2013-11-22 13:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 12:14 [PATCH v2 0/7] gpio / ACPI: convert users to gpiod_* and drop acpi_gpio.h Mika Westerberg
2013-11-22 12:14 ` [PATCH v2 1/7] net: rfkill: gpio: convert to descriptor-based GPIO interface Mika Westerberg
2013-11-22 12:14 ` [PATCH v2 2/7] ARM: tegra: add gpiod_lookup table for paz00 Mika Westerberg
2013-11-22 18:40   ` Stephen Warren
2013-11-22 18:40     ` Stephen Warren
2013-11-23  5:36     ` Alexandre Courbot
2013-11-23  5:36       ` Alexandre Courbot
2013-11-22 12:14 ` [PATCH v2 3/7] net: rfkill: gpio: remove gpio conversion support Mika Westerberg
2013-11-22 18:40   ` Stephen Warren
2013-11-22 20:56     ` Heikki Krogerus
2013-11-22 21:00       ` Stephen Warren
2013-11-25  8:35         ` Heikki Krogerus
2013-11-23  8:59   ` Alexandre Courbot
2013-11-25  8:41     ` Heikki Krogerus
2013-11-25  8:47       ` Alex Courbot
2013-11-25  9:02         ` Heikki Krogerus
2013-11-25  9:05           ` Alex Courbot
2013-11-22 12:14 ` [PATCH v2 4/7] mmc: sdhci-acpi: covert to use GPIO descriptor API Mika Westerberg
2013-11-22 13:39   ` Adrian Hunter [this message]
2013-11-23  9:23   ` Alexandre Courbot
2013-11-22 12:14 ` [PATCH v2 5/7] gpio / ACPI: register to ACPI events automatically Mika Westerberg
2013-11-22 12:14 ` [PATCH v2 6/7] gpio / ACPI: get rid of acpi_gpio.h Mika Westerberg
2013-11-23  9:21   ` Alexandre Courbot
2013-11-25  8:54     ` Mika Westerberg
2013-11-25  8:51       ` Alex Courbot
2013-11-25 10:18         ` Mika Westerberg
2013-11-22 12:14 ` [PATCH v2 7/7] Documentation / ACPI: update to GPIO descriptor API Mika Westerberg
2013-11-22 12:41 ` [PATCH v2 0/7] gpio / ACPI: convert users to gpiod_* and drop acpi_gpio.h Rafael J. Wysocki

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=528F5EAF.8070109@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acourbot@nvidia.com \
    --cc=cjb@laptop.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=rklein@nvidia.com \
    --cc=rob@landley.net \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.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 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.