From: Jonathan Cameron <jic23@kernel.org>
To: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <mcoquelin.stm32@gmail.com>,
<alexandre.torgue@st.com>, <olivier.moysan@st.com>,
<linux-iio@vger.kernel.org>, <lars@metafoo.de>, <knaack.h@gmx.de>,
<pmeerw@pmeerw.net>, <linux-stm32@st-md-mailman.stormreply.com>,
<etienne.carriere@st.com>
Subject: Re: [PATCH 2/2] iio: dac: stm32-dac: better handle reset controller failures
Date: Sat, 18 Jan 2020 14:32:35 +0000 [thread overview]
Message-ID: <20200118143235.71a67b76@archlinux> (raw)
In-Reply-To: <1578921266-6025-3-git-send-email-fabrice.gasnier@st.com>
On Mon, 13 Jan 2020 14:14:26 +0100
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> From: Etienne Carriere <etienne.carriere@st.com>
>
> Use devm_reset_control_get_optional_exclusive() instead of
> devm_reset_control_get_exclusive() as reset controller is optional.
>
> Nevertheless if reset controller is expected but reports an
> error, propagate the error code to the caller. In such case
> a nice error trace is emitted unless we're deferring the probe
> operation.
>
> Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Applied to the togreg branch of iio.git and pushed out as testing.
Thanks,
Jonathan
> ---
> drivers/iio/dac/stm32-dac-core.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
> index 4d93446..7e5809b 100644
> --- a/drivers/iio/dac/stm32-dac-core.c
> +++ b/drivers/iio/dac/stm32-dac-core.c
> @@ -147,8 +147,16 @@ static int stm32_dac_probe(struct platform_device *pdev)
> priv->common.vref_mv = ret / 1000;
> dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv);
>
> - rst = devm_reset_control_get_exclusive(dev, NULL);
> - if (!IS_ERR(rst)) {
> + rst = devm_reset_control_get_optional_exclusive(dev, NULL);
> + if (rst) {
> + if (IS_ERR(rst)) {
> + ret = PTR_ERR(rst);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "reset get failed, %d\n", ret);
> +
> + goto err_hw_stop;
> + }
> +
> reset_control_assert(rst);
> udelay(2);
> reset_control_deassert(rst);
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: etienne.carriere@st.com, lars@metafoo.de, olivier.moysan@st.com,
alexandre.torgue@st.com, linux-iio@vger.kernel.org,
pmeerw@pmeerw.net, linux-kernel@vger.kernel.org,
mcoquelin.stm32@gmail.com, knaack.h@gmx.de,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] iio: dac: stm32-dac: better handle reset controller failures
Date: Sat, 18 Jan 2020 14:32:35 +0000 [thread overview]
Message-ID: <20200118143235.71a67b76@archlinux> (raw)
In-Reply-To: <1578921266-6025-3-git-send-email-fabrice.gasnier@st.com>
On Mon, 13 Jan 2020 14:14:26 +0100
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:
> From: Etienne Carriere <etienne.carriere@st.com>
>
> Use devm_reset_control_get_optional_exclusive() instead of
> devm_reset_control_get_exclusive() as reset controller is optional.
>
> Nevertheless if reset controller is expected but reports an
> error, propagate the error code to the caller. In such case
> a nice error trace is emitted unless we're deferring the probe
> operation.
>
> Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Applied to the togreg branch of iio.git and pushed out as testing.
Thanks,
Jonathan
> ---
> drivers/iio/dac/stm32-dac-core.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
> index 4d93446..7e5809b 100644
> --- a/drivers/iio/dac/stm32-dac-core.c
> +++ b/drivers/iio/dac/stm32-dac-core.c
> @@ -147,8 +147,16 @@ static int stm32_dac_probe(struct platform_device *pdev)
> priv->common.vref_mv = ret / 1000;
> dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv);
>
> - rst = devm_reset_control_get_exclusive(dev, NULL);
> - if (!IS_ERR(rst)) {
> + rst = devm_reset_control_get_optional_exclusive(dev, NULL);
> + if (rst) {
> + if (IS_ERR(rst)) {
> + ret = PTR_ERR(rst);
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "reset get failed, %d\n", ret);
> +
> + goto err_hw_stop;
> + }
> +
> reset_control_assert(rst);
> udelay(2);
> reset_control_deassert(rst);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-01-18 14:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 13:14 [PATCH 0/2] iio: dac: stm32-dac: improve reset controller use Fabrice Gasnier
2020-01-13 13:14 ` Fabrice Gasnier
2020-01-13 13:14 ` [PATCH 1/2] iio: dac: stm32-dac: use reset controller only at probe time Fabrice Gasnier
2020-01-13 13:14 ` Fabrice Gasnier
2020-01-18 14:30 ` Jonathan Cameron
2020-01-18 14:30 ` Jonathan Cameron
2020-01-13 13:14 ` [PATCH 2/2] iio: dac: stm32-dac: better handle reset controller failures Fabrice Gasnier
2020-01-13 13:14 ` Fabrice Gasnier
2020-01-18 14:32 ` Jonathan Cameron [this message]
2020-01-18 14:32 ` 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=20200118143235.71a67b76@archlinux \
--to=jic23@kernel.org \
--cc=alexandre.torgue@st.com \
--cc=etienne.carriere@st.com \
--cc=fabrice.gasnier@st.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=olivier.moysan@st.com \
--cc=pmeerw@pmeerw.net \
/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.