public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Vlad Dogaru <vlad.dogaru@intel.com>, linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 2/3] iio: sx9500: refactor GPIO interrupt code
Date: Sat, 18 Apr 2015 20:14:33 +0100	[thread overview]
Message-ID: <5532AD19.30000@kernel.org> (raw)
In-Reply-To: <1428858561-27994-3-git-send-email-vlad.dogaru@intel.com>

On 12/04/15 18:09, Vlad Dogaru wrote:
> Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Applied with the define name changed as mentioned earlier...

J
> ---
>  drivers/iio/proximity/sx9500.c | 27 ++++++++++-----------------
>  1 file changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c
> index f0f65a7..72efbbc 100644
> --- a/drivers/iio/proximity/sx9500.c
> +++ b/drivers/iio/proximity/sx9500.c
> @@ -859,30 +859,24 @@ static int sx9500_init_device(struct iio_dev *indio_dev)
>  	return 0;
>  }
>  
> -static int sx9500_gpio_probe(struct i2c_client *client,
> -			     struct sx9500_data *data)
> +static void sx9500_gpio_probe(struct i2c_client *client,
> +			      struct sx9500_data *data)
>  {
>  	struct device *dev;
>  	struct gpio_desc *gpio;
> -	int ret;
>  
>  	if (!client)
> -		return -EINVAL;
> +		return;
>  
>  	dev = &client->dev;
>  
> -	/* data ready gpio interrupt pin */
> -	gpio = devm_gpiod_get_index(dev, SX9500_GPIO_NAME, 0, GPIOD_IN);
> -	if (IS_ERR(gpio)) {
> -		dev_err(dev, "acpi gpio get index failed\n");
> -		return PTR_ERR(gpio);
> +	if (client->irq <= 0) {
> +		gpio = devm_gpiod_get_index(dev, SX9500_GPIO_INT, 0, GPIOD_IN);
> +		if (IS_ERR(gpio))
> +			dev_err(dev, "gpio get irq failed\n");
> +		else
> +			client->irq = gpiod_to_irq(gpio);
>  	}
> -
> -	ret = gpiod_to_irq(gpio);
> -
> -	dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
> -
> -	return ret;
>  }
>  
>  static int sx9500_probe(struct i2c_client *client,
> @@ -916,8 +910,7 @@ static int sx9500_probe(struct i2c_client *client,
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	i2c_set_clientdata(client, indio_dev);
>  
> -	if (client->irq <= 0)
> -		client->irq = sx9500_gpio_probe(client, data);
> +	sx9500_gpio_probe(client, data);
>  
>  	if (client->irq <= 0)
>  		dev_warn(&client->dev, "no valid irq found\n");
> 


  reply	other threads:[~2015-04-18 19:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-12 17:09 [PATCH v3 0/3] iio: sx9500: power usage and gpio changes Vlad Dogaru
2015-04-12 17:09 ` [PATCH v3 1/3] iio: sx9500: optimize power usage Vlad Dogaru
2015-04-18 19:12   ` Jonathan Cameron
2015-06-26 11:01   ` Hartmut Knaack
2015-06-29  7:42     ` Vlad Dogaru
2015-04-12 17:09 ` [PATCH v3 2/3] iio: sx9500: refactor GPIO interrupt code Vlad Dogaru
2015-04-18 19:14   ` Jonathan Cameron [this message]
2015-04-12 17:09 ` [PATCH v3 3/3] iio: sx9500: add GPIO reset pin Vlad Dogaru
2015-04-18 19:16   ` Jonathan Cameron

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=5532AD19.30000@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=vlad.dogaru@intel.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