All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Wolfram Sang <wsa@the-dreams.de>,
	LKML <linux-kernel@vger.kernel.org>,
	zhuzhenhua@allwinnertech.com,
	"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
	kevin.z.m.zh@gmail.com, sunny@allwinnertech.com,
	shuge@allwinnertech.com, linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: mv64xxx: Fix compilation breakage
Date: Sat, 22 Mar 2014 12:11:24 +0100	[thread overview]
Message-ID: <4177769.XedaQsoUgV@wuerfel> (raw)
In-Reply-To: <20140321191739.GT27873@lukather>

On Friday 21 March 2014 20:17:39 Maxime Ripard wrote:
> On Fri, Mar 21, 2014 at 11:49:59AM -0400, Paul Gortmaker wrote:
> > On Mon, Mar 10, 2014 at 7:29 AM, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> > > On Mon, Mar 10, 2014 at 11:58:08AM +0100, Maxime Ripard wrote:
> > >> On Fri, Mar 07, 2014 at 04:08:36PM +0000, Russell King - ARM Linux wrote:
> > >> > On Fri, Mar 07, 2014 at 03:59:30PM +0100, Maxime Ripard wrote:
> > >> > > @@ -900,7 +902,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
> > >> > >  exit_free_irq:
> > >> > >   free_irq(drv_data->irq, drv_data);
> > >> > >  exit_reset:
> > >> > > - if (pd->dev.of_node && !IS_ERR(drv_data->rstc))
> > >> > > + if (pd->dev.of_node && IS_ENABLED(CONFIG_RESET_CONTROLLER) &&
> > >> > > +     !IS_ERR(drv_data->rstc))
> > >> > >           reset_control_assert(drv_data->rstc);
> > >> >
> > >> > Another question is... why do we need to check pd->dev.of_node here?
> > >> > If CONFIG_RESET_CONTROLLER is set, we always try to get the reset
> > >> > controller node, so drv_data->rstc is either going to be a valid
> > >> > pointer, or it's going to be an error pointer - neither
> > >> > reset_control_get() nor devm_reset_control_get return NULL.
> > >>
> > >> Following back on this as I was doing the patch, actually,
> > >> drv_data->rstc will be NULL if we're not probed by DT, and hence never
> > >> call reset_control_get, that would set an error pointer.
> > >>
> > >> But then, we can use IS_ERR_OR_NULL on drv_data->rstc.
> > >
> > > I think you can also move the devm_reset_control_get() into the main
> > > probe function: you're only checking for -EPROBE_DEFER from it to fail,
> > > allowing other errors to continue with the driver init.  This means
> > > that on non-OF, devm_reset_control_get() will fail with -ENOENT.
> > 
> > Looping linux-next into the CC since this is the cause of the failure
> > in orion5x_defconfig there, and no point in anyone else re-doing the
> > same bisect.
> 
> I sent a fix for this that hasn't been picked up yet:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-March/239069.html
> 
> IIRC, Wolfram's away until Monday, so I guess it will be merged some
> time next week.

I think there is something wrong with an interface that makes you use
IS_ERR_OR_NULL(). If you are calling reset_control_get_optional(), that'
should not return an error when there is no reset controller listed
in the device tree. We should still have a way to propagate -EPROBE_DEFER,
or bail out if there is a reset controller but there is something wrong
with it, but otherwise I'd suggest just leaving NULL as a valid pointer
in drv_data->rstc and making sure that the reset controller functions
can just deal with a NULL argument, so you never have to check it again.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-kernel@lists.infradead.org
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Wolfram Sang <wsa@the-dreams.de>,
	LKML <linux-kernel@vger.kernel.org>,
	zhuzhenhua@allwinnertech.com,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	"linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
	kevin.z.m.zh@gmail.com, sunny@allwinnertech.com,
	shuge@allwinnertech.com,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH] i2c: mv64xxx: Fix compilation breakage
Date: Sat, 22 Mar 2014 12:11:24 +0100	[thread overview]
Message-ID: <4177769.XedaQsoUgV@wuerfel> (raw)
In-Reply-To: <20140321191739.GT27873@lukather>

On Friday 21 March 2014 20:17:39 Maxime Ripard wrote:
> On Fri, Mar 21, 2014 at 11:49:59AM -0400, Paul Gortmaker wrote:
> > On Mon, Mar 10, 2014 at 7:29 AM, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> > > On Mon, Mar 10, 2014 at 11:58:08AM +0100, Maxime Ripard wrote:
> > >> On Fri, Mar 07, 2014 at 04:08:36PM +0000, Russell King - ARM Linux wrote:
> > >> > On Fri, Mar 07, 2014 at 03:59:30PM +0100, Maxime Ripard wrote:
> > >> > > @@ -900,7 +902,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
> > >> > >  exit_free_irq:
> > >> > >   free_irq(drv_data->irq, drv_data);
> > >> > >  exit_reset:
> > >> > > - if (pd->dev.of_node && !IS_ERR(drv_data->rstc))
> > >> > > + if (pd->dev.of_node && IS_ENABLED(CONFIG_RESET_CONTROLLER) &&
> > >> > > +     !IS_ERR(drv_data->rstc))
> > >> > >           reset_control_assert(drv_data->rstc);
> > >> >
> > >> > Another question is... why do we need to check pd->dev.of_node here?
> > >> > If CONFIG_RESET_CONTROLLER is set, we always try to get the reset
> > >> > controller node, so drv_data->rstc is either going to be a valid
> > >> > pointer, or it's going to be an error pointer - neither
> > >> > reset_control_get() nor devm_reset_control_get return NULL.
> > >>
> > >> Following back on this as I was doing the patch, actually,
> > >> drv_data->rstc will be NULL if we're not probed by DT, and hence never
> > >> call reset_control_get, that would set an error pointer.
> > >>
> > >> But then, we can use IS_ERR_OR_NULL on drv_data->rstc.
> > >
> > > I think you can also move the devm_reset_control_get() into the main
> > > probe function: you're only checking for -EPROBE_DEFER from it to fail,
> > > allowing other errors to continue with the driver init.  This means
> > > that on non-OF, devm_reset_control_get() will fail with -ENOENT.
> > 
> > Looping linux-next into the CC since this is the cause of the failure
> > in orion5x_defconfig there, and no point in anyone else re-doing the
> > same bisect.
> 
> I sent a fix for this that hasn't been picked up yet:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-March/239069.html
> 
> IIRC, Wolfram's away until Monday, so I guess it will be merged some
> time next week.

I think there is something wrong with an interface that makes you use
IS_ERR_OR_NULL(). If you are calling reset_control_get_optional(), that'
should not return an error when there is no reset controller listed
in the device tree. We should still have a way to propagate -EPROBE_DEFER,
or bail out if there is a reset controller but there is something wrong
with it, but otherwise I'd suggest just leaving NULL as a valid pointer
in drv_data->rstc and making sure that the reset controller functions
can just deal with a NULL argument, so you never have to check it again.

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] i2c: mv64xxx: Fix compilation breakage
Date: Sat, 22 Mar 2014 12:11:24 +0100	[thread overview]
Message-ID: <4177769.XedaQsoUgV@wuerfel> (raw)
In-Reply-To: <20140321191739.GT27873@lukather>

On Friday 21 March 2014 20:17:39 Maxime Ripard wrote:
> On Fri, Mar 21, 2014 at 11:49:59AM -0400, Paul Gortmaker wrote:
> > On Mon, Mar 10, 2014 at 7:29 AM, Russell King - ARM Linux
> > <linux@arm.linux.org.uk> wrote:
> > > On Mon, Mar 10, 2014 at 11:58:08AM +0100, Maxime Ripard wrote:
> > >> On Fri, Mar 07, 2014 at 04:08:36PM +0000, Russell King - ARM Linux wrote:
> > >> > On Fri, Mar 07, 2014 at 03:59:30PM +0100, Maxime Ripard wrote:
> > >> > > @@ -900,7 +902,8 @@ mv64xxx_i2c_probe(struct platform_device *pd)
> > >> > >  exit_free_irq:
> > >> > >   free_irq(drv_data->irq, drv_data);
> > >> > >  exit_reset:
> > >> > > - if (pd->dev.of_node && !IS_ERR(drv_data->rstc))
> > >> > > + if (pd->dev.of_node && IS_ENABLED(CONFIG_RESET_CONTROLLER) &&
> > >> > > +     !IS_ERR(drv_data->rstc))
> > >> > >           reset_control_assert(drv_data->rstc);
> > >> >
> > >> > Another question is... why do we need to check pd->dev.of_node here?
> > >> > If CONFIG_RESET_CONTROLLER is set, we always try to get the reset
> > >> > controller node, so drv_data->rstc is either going to be a valid
> > >> > pointer, or it's going to be an error pointer - neither
> > >> > reset_control_get() nor devm_reset_control_get return NULL.
> > >>
> > >> Following back on this as I was doing the patch, actually,
> > >> drv_data->rstc will be NULL if we're not probed by DT, and hence never
> > >> call reset_control_get, that would set an error pointer.
> > >>
> > >> But then, we can use IS_ERR_OR_NULL on drv_data->rstc.
> > >
> > > I think you can also move the devm_reset_control_get() into the main
> > > probe function: you're only checking for -EPROBE_DEFER from it to fail,
> > > allowing other errors to continue with the driver init.  This means
> > > that on non-OF, devm_reset_control_get() will fail with -ENOENT.
> > 
> > Looping linux-next into the CC since this is the cause of the failure
> > in orion5x_defconfig there, and no point in anyone else re-doing the
> > same bisect.
> 
> I sent a fix for this that hasn't been picked up yet:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2014-March/239069.html
> 
> IIRC, Wolfram's away until Monday, so I guess it will be merged some
> time next week.

I think there is something wrong with an interface that makes you use
IS_ERR_OR_NULL(). If you are calling reset_control_get_optional(), that'
should not return an error when there is no reset controller listed
in the device tree. We should still have a way to propagate -EPROBE_DEFER,
or bail out if there is a reset controller but there is something wrong
with it, but otherwise I'd suggest just leaving NULL as a valid pointer
in drv_data->rstc and making sure that the reset controller functions
can just deal with a NULL argument, so you never have to check it again.

	Arnd

  reply	other threads:[~2014-03-22 11:11 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 14:59 [PATCH] i2c: mv64xxx: Fix compilation breakage Maxime Ripard
2014-03-07 14:59 ` Maxime Ripard
2014-03-07 14:59 ` Maxime Ripard
2014-03-07 16:08 ` Russell King - ARM Linux
2014-03-07 16:08   ` Russell King - ARM Linux
2014-03-07 16:08   ` Russell King - ARM Linux
2014-03-07 17:19   ` Maxime Ripard
2014-03-07 17:19     ` Maxime Ripard
2014-03-07 17:29     ` Wolfram Sang
2014-03-07 17:29       ` Wolfram Sang
2014-03-07 17:52       ` Maxime Ripard
2014-03-07 17:52         ` Maxime Ripard
2014-03-07 17:52         ` Maxime Ripard
2014-03-10 10:58   ` Maxime Ripard
2014-03-10 10:58     ` Maxime Ripard
2014-03-10 11:29     ` Russell King - ARM Linux
2014-03-10 11:29       ` Russell King - ARM Linux
2014-03-10 11:29       ` Russell King - ARM Linux
2014-03-21 15:49       ` Paul Gortmaker
2014-03-21 15:49         ` Paul Gortmaker
2014-03-21 15:49         ` Paul Gortmaker
2014-03-21 19:17         ` Maxime Ripard
2014-03-21 19:17           ` Maxime Ripard
2014-03-22 11:11           ` Arnd Bergmann [this message]
2014-03-22 11:11             ` Arnd Bergmann
2014-03-22 11:11             ` Arnd Bergmann
2014-03-24  9:41             ` Maxime Ripard
2014-03-24  9:41               ` Maxime Ripard
2014-03-28  7:48               ` Wolfram Sang
2014-03-28  7:48                 ` Wolfram Sang
2014-03-24 13:33           ` Wolfram Sang
2014-03-24 13:33             ` Wolfram Sang
2014-03-24 13:33             ` Wolfram Sang
2014-03-24 14:03             ` Gregory CLEMENT
2014-03-24 14:03               ` Gregory CLEMENT
2014-03-24 14:03               ` Gregory CLEMENT

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=4177769.XedaQsoUgV@wuerfel \
    --to=arnd@arndb.de \
    --cc=kevin.z.m.zh@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=maxime.ripard@free-electrons.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=shuge@allwinnertech.com \
    --cc=sunny@allwinnertech.com \
    --cc=wsa@the-dreams.de \
    --cc=zhuzhenhua@allwinnertech.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.