From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>, linux-iio@vger.kernel.org
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Tiberiu Breana <tiberiu.a.breana@intel.com>
Subject: Re: [PATCH v2 1/5] iio:light:stk3310: move device register to end of probe
Date: Sun, 19 Jul 2015 14:53:12 +0100 [thread overview]
Message-ID: <55ABABC8.6030506@kernel.org> (raw)
In-Reply-To: <fe03a1248d7d1037686a7b08bd5357b95a0b9081.1436398691.git.knaack.h@gmx.de>
On 09/07/15 22:51, Hartmut Knaack wrote:
> iio_device_register should be the last operation during probe. Therefor
> move up interrupt setup code and while at it, change the check for invalid
> values of client->irq to be smaller than zero.
> Fixes: 3dd477acbdd1 ("iio: light: Add threshold interrupt support for STK3310")
>
> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Applied to the fixes-togreg branch of iio.git
I added some stuff about why this ordering matters.
Jonathan
> ---
> drivers/iio/light/stk3310.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> index c1a218236be5..e7e6e5a2b1f8 100644
> --- a/drivers/iio/light/stk3310.c
> +++ b/drivers/iio/light/stk3310.c
> @@ -608,13 +608,7 @@ static int stk3310_probe(struct i2c_client *client,
> if (ret < 0)
> return ret;
>
> - ret = iio_device_register(indio_dev);
> - if (ret < 0) {
> - dev_err(&client->dev, "device_register failed\n");
> - stk3310_set_state(data, STK3310_STATE_STANDBY);
> - }
> -
> - if (client->irq <= 0)
> + if (client->irq < 0)
> client->irq = stk3310_gpio_probe(client);
>
> if (client->irq >= 0) {
> @@ -629,6 +623,12 @@ static int stk3310_probe(struct i2c_client *client,
> client->irq);
> }
>
> + ret = iio_device_register(indio_dev);
> + if (ret < 0) {
> + dev_err(&client->dev, "device_register failed\n");
> + stk3310_set_state(data, STK3310_STATE_STANDBY);
> + }
> +
> return ret;
> }
>
>
next prev parent reply other threads:[~2015-07-19 13:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-09 21:51 [PATCH v2 0/5] stk3310 fixes and cleanup Hartmut Knaack
2015-07-09 21:51 ` [PATCH v2 1/5] iio:light:stk3310: move device register to end of probe Hartmut Knaack
2015-07-19 13:53 ` Jonathan Cameron [this message]
2015-07-09 21:51 ` [PATCH v2 2/5] iio:light:stk3310: make endianness independent of host Hartmut Knaack
2015-07-19 13:55 ` Jonathan Cameron
2015-07-09 21:51 ` [PATCH v2 3/5] iio:light:stk3310: add more error handling Hartmut Knaack
2015-07-19 13:57 ` Jonathan Cameron
2015-08-12 21:16 ` Jonathan Cameron
2015-07-09 21:51 ` [PATCH v2 4/5] iio:light:stk3310: use correct names and type for state Hartmut Knaack
2015-07-19 13:58 ` Jonathan Cameron
2015-08-12 21:16 ` Jonathan Cameron
2015-07-09 21:51 ` [PATCH v2 5/5] iio:light:stk3310: adjust indentation Hartmut Knaack
2015-08-12 21:17 ` Jonathan Cameron
2015-07-10 8:02 ` [PATCH v2 0/5] stk3310 fixes and cleanup Breana, Tiberiu A
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=55ABABC8.6030506@kernel.org \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=tiberiu.a.breana@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;
as well as URLs for NNTP newsgroup(s).