From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Wolfram Sang <wsa@the-dreams.de>,
jarkko.nikula@linux.intel.com, linux-i2c@vger.kernel.org,
p.zabel@pengutronix.de, Zhangfei Gao <zhangfei.gao@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
mika.westerberg@linux.intel.com
Subject: Re: [PATCH v3] i2c: designware: add reset interface
Date: Fri, 06 Jan 2017 12:32:52 +0100 [thread overview]
Message-ID: <3024749.v77eulNknP@wuerfel> (raw)
In-Reply-To: <1483544119.9552.223.camel@linux.intel.com>
On Wednesday, January 4, 2017 5:35:19 PM CET Andy Shevchenko wrote:
> > > @@ -270,10 +280,18 @@ static int dw_i2c_plat_probe(struct
> > > platform_device *pdev)
> > > }
> > >
> > > r = i2c_dw_probe(dev);
> > > - if (r && !dev->pm_runtime_disabled)
> > > - pm_runtime_disable(&pdev->dev);
> > > + if (r)
> > > + goto exit_probe;
> > >
> > > return r;
> > > +
> > > +exit_probe:
> > > + if (!dev->pm_runtime_disabled)
> > > + pm_runtime_disable(&pdev->dev);
> > > +exit_reset:
> > > + if (!IS_ERR_OR_NULL(dev->rst))
> > > + reset_control_assert(dev->rst);
> > > + return r;
> > >
> >
> > try to avoid the IS_ERR_OR_NULL() check, it usually indicates either
> > a bad interface, or that the interface is used wrong.
>
> Please, fix reset framework first than.
>
> For my understanding:
> It should return NULL for optional reset control.
> It should not fail on NULL argument.
I think we discussed that a few times. Your suggestion makes sense
to me, but I don't know why we don't already do that, maybe there
is a good reason.
Arnd
WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] i2c: designware: add reset interface
Date: Fri, 06 Jan 2017 12:32:52 +0100 [thread overview]
Message-ID: <3024749.v77eulNknP@wuerfel> (raw)
In-Reply-To: <1483544119.9552.223.camel@linux.intel.com>
On Wednesday, January 4, 2017 5:35:19 PM CET Andy Shevchenko wrote:
> > > @@ -270,10 +280,18 @@ static int dw_i2c_plat_probe(struct
> > > platform_device *pdev)
> > > }
> > >
> > > r = i2c_dw_probe(dev);
> > > - if (r && !dev->pm_runtime_disabled)
> > > - pm_runtime_disable(&pdev->dev);
> > > + if (r)
> > > + goto exit_probe;
> > >
> > > return r;
> > > +
> > > +exit_probe:
> > > + if (!dev->pm_runtime_disabled)
> > > + pm_runtime_disable(&pdev->dev);
> > > +exit_reset:
> > > + if (!IS_ERR_OR_NULL(dev->rst))
> > > + reset_control_assert(dev->rst);
> > > + return r;
> > >
> >
> > try to avoid the IS_ERR_OR_NULL() check, it usually indicates either
> > a bad interface, or that the interface is used wrong.
>
> Please, fix reset framework first than.
>
> For my understanding:
> It should return NULL for optional reset control.
> It should not fail on NULL argument.
I think we discussed that a few times. Your suggestion makes sense
to me, but I don't know why we don't already do that, maybe there
is a good reason.
Arnd
next prev parent reply other threads:[~2017-01-06 11:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-23 13:40 [PATCH v3] i2c: designware: add reset interface Zhangfei Gao
2016-12-23 13:40 ` Zhangfei Gao
2017-01-04 14:55 ` Arnd Bergmann
2017-01-04 14:55 ` Arnd Bergmann
2017-01-04 15:35 ` Andy Shevchenko
2017-01-04 15:35 ` Andy Shevchenko
2017-01-06 11:32 ` Arnd Bergmann [this message]
2017-01-06 11:32 ` Arnd Bergmann
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=3024749.v77eulNknP@wuerfel \
--to=arnd@arndb.de \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=p.zabel@pengutronix.de \
--cc=wsa@the-dreams.de \
--cc=zhangfei.gao@linaro.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 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.