From: Jonathan Cameron <jic23@kernel.org>
To: Irina Tirdea <irina.tirdea@intel.com>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Daniel Baluta <daniel.baluta@intel.com>,
Peter Meerwald <pmeerw@pmeerw.net>
Subject: Re: [PATCH v2 4/4] iio: accel: kxcjk-1013: power off device if probe fails
Date: Fri, 12 Dec 2014 11:22:54 +0000 [thread overview]
Message-ID: <548AD00E.8080301@kernel.org> (raw)
In-Reply-To: <1418228634-10505-5-git-send-email-irina.tirdea@intel.com>
On 10/12/14 16:23, Irina Tirdea wrote:
> When the device is initialized in probe, it is also powered on.
> If there is an error after the initialization, the device will
> remain powered on.
>
> Power off the device in case probe fails after device initialization.
>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> Suggested-by: Daniel Baluta <daniel.baluta@intel.com>
> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Applied to the togreg branch of iio.git - initially pushed out as
testing sometime later today.
Thanks,
Jonathan
> ---
> drivers/iio/accel/kxcjk-1013.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index 0dc6ccf..a5e7d30 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -1240,21 +1240,25 @@ static int kxcjk1013_probe(struct i2c_client *client,
> KXCJK1013_IRQ_NAME,
> indio_dev);
> if (ret)
> - return ret;
> + goto err_poweroff;
>
> data->dready_trig = devm_iio_trigger_alloc(&client->dev,
> "%s-dev%d",
> indio_dev->name,
> indio_dev->id);
> - if (!data->dready_trig)
> - return -ENOMEM;
> + if (!data->dready_trig) {
> + ret = -ENOMEM;
> + goto err_poweroff;
> + }
>
> data->motion_trig = devm_iio_trigger_alloc(&client->dev,
> "%s-any-motion-dev%d",
> indio_dev->name,
> indio_dev->id);
> - if (!data->motion_trig)
> - return -ENOMEM;
> + if (!data->motion_trig) {
> + ret = -ENOMEM;
> + goto err_poweroff;
> + }
>
> data->dready_trig->dev.parent = &client->dev;
> data->dready_trig->ops = &kxcjk1013_trigger_ops;
> @@ -1263,7 +1267,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
> iio_trigger_get(indio_dev->trig);
> ret = iio_trigger_register(data->dready_trig);
> if (ret)
> - return ret;
> + goto err_poweroff;
>
> data->motion_trig->dev.parent = &client->dev;
> data->motion_trig->ops = &kxcjk1013_trigger_ops;
> @@ -1312,6 +1316,8 @@ err_trigger_unregister:
> iio_trigger_unregister(data->dready_trig);
> if (data->motion_trig)
> iio_trigger_unregister(data->motion_trig);
> +err_poweroff:
> + kxcjk1013_set_mode(data, STANDBY);
>
> return ret;
> }
>
next prev parent reply other threads:[~2014-12-12 11:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 16:23 [PATCH v2 0/4] PM fixes for kxcjk-1013 Irina Tirdea
2014-12-10 16:23 ` [PATCH v2 1/4] iio: accel: kxcjk-1013: always power on device in resume Irina Tirdea
2014-12-10 16:23 ` [PATCH v2 2/4] iio: accel: kxcjk-1013: only set power state if CONFIG_PM is defined Irina Tirdea
2014-12-10 16:23 ` [PATCH v2 3/4] iio: accel: kxcjk-1013: error handling when set mode fails Irina Tirdea
2014-12-12 11:22 ` Jonathan Cameron
2014-12-10 16:23 ` [PATCH v2 4/4] iio: accel: kxcjk-1013: power off device if probe fails Irina Tirdea
2014-12-12 11:22 ` Jonathan Cameron [this message]
2014-12-12 11:21 ` [PATCH v2 0/4] PM fixes for kxcjk-1013 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=548AD00E.8080301@kernel.org \
--to=jic23@kernel.org \
--cc=daniel.baluta@intel.com \
--cc=irina.tirdea@intel.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=srinivas.pandruvada@linux.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 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.