Linux IIO development
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>,
	linux-iio@vger.kernel.org, achew@nvidia.com,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH 1/2] iio: ak8975: Add support for gpios DT property
Date: Mon, 06 May 2013 20:11:09 +0200	[thread overview]
Message-ID: <5187F23D.1000400@metafoo.de> (raw)
In-Reply-To: <5187DE08.6020002@kernel.org>

On 05/06/2013 06:44 PM, Jonathan Cameron wrote:
> On 04/16/2013 03:37 PM, Jacek Anaszewski wrote:
[...]
>> diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c
>> index af6c320..eb17eca 100644
>> --- a/drivers/iio/magnetometer/ak8975.c
>> +++ b/drivers/iio/magnetometer/ak8975.c
>> @@ -29,6 +29,7 @@
>>  #include <linux/delay.h>
>>  
>>  #include <linux/gpio.h>
>> +#include <linux/of_gpio.h>
>>  
>>  #include <linux/iio/iio.h>
>>  #include <linux/iio/sysfs.h>
>> @@ -384,7 +385,9 @@ static int ak8975_probe(struct i2c_client *client,
>>  	int err;
>>  
>>  	/* Grab and set up the supplied GPIO. */
>> -	if (client->dev.platform_data == NULL)
>> +	if (client->dev.of_node)
>> +		eoc_gpio = of_get_gpio(client->dev.of_node, 0);
>> +	else if (client->dev.platform_data == NULL)
>>  		eoc_gpio = -1;
>>  	else
>>  		eoc_gpio = *(int *)(client->dev.platform_data);

Usually this is done in the opposite order. First check for platform_data,
then, of_node. Also it probably makes sense to check for -EPROBE_DEFER in the
of case.

- Lars

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 14:37 iio:magnetometer:ak8975: Add support for DT and interrupt handling Jacek Anaszewski
2013-04-16 14:37 ` [PATCH 1/2] iio: ak8975: Add support for gpios DT property Jacek Anaszewski
2013-05-06 16:44   ` Jonathan Cameron
2013-05-06 18:11     ` Lars-Peter Clausen [this message]
2013-04-16 14:37 ` [PATCH 2/2] iio: ak8975: Implement data ready interrupt handling Jacek Anaszewski
2013-05-06 16:49   ` Jonathan Cameron
2013-05-07  9:17     ` Jacek Anaszewski

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=5187F23D.1000400@metafoo.de \
    --to=lars@metafoo.de \
    --cc=achew@nvidia.com \
    --cc=j.anaszewski@samsung.com \
    --cc=jic23@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-iio@vger.kernel.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