All of lore.kernel.org
 help / color / mirror / Atom feed
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/2] dt: platform driver: Fill the resources before probe and defer if needed
Date: Mon, 21 Apr 2014 08:54:24 -0700	[thread overview]
Message-ID: <20140421155424.GD23945@atomide.com> (raw)
In-Reply-To: <CAL_JsqLvLTJwgsB-m0W72WxSUoTV4ubMdvM_a784J4k2eiK9AQ@mail.gmail.com>

* Rob Herring <robherring2@gmail.com> [140421 06:47]:
> On Fri, Apr 18, 2014 at 6:24 PM, Tony Lindgren <tony@atomide.com> wrote:
> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [140418 16:04]:
> >> On Fri, Apr 18, 2014 at 02:58:48PM -0700, Tony Lindgren wrote:
> >> > Oh come on, let's stop pretending it's not broken. And it's way worse with
> >> > device tree as there's nothing making sure the resources for a driver
> >> > are set up before the driver probes. And we've been unable to fix just
> >> > this issue alone for about six months now. It's also broken beyond that.
> >> > It's called of_platform_bus yet it won't even pass the platform_data
> >> > as auxdata to the devices on a sub-bus instantatiated like I2C.
> >>
> >> Isn't there a much simpler solution to the platform device IRQ problem?
> >>
> >> Rather than trying to fix it at the point where the resources are
> >> created, why not just *not* have DT create the IRQ resources in the
> >> first place, and instead have platform_get_irq() (which is the function
> >> which should be used to get an IRQ) be the actor to do whatever is
> >> necessary to return the IRQ(s) ?
> >
> > Yeah why not. I don't see why we would need to do all this of_* special
> > trickery for much anything beyond parsing the binding.
> 
> That can work, but it will still need something like
> of_find_irq_domain() to determine whether to return -EPROBE_DEFER or
> not.

Right. Naturally let's do whatever it takes to first fix this issue
in a minimal way first for the -rc cycle so we can do the longer term
changes needed.
 
> You could also go in the other direction and don't create the device
> until the resources can be resolved. Unlike any of the other
> solutions, that would work for amba bus as well although we may never
> have a case where we need this with the amba bus. This would require
> making of_platform_populate be callable multiple times, but there are
> already some other reasons for wanting to do that. Specifically, I
> would like the core code to call of_platform_populate with default
> options and then only platforms with non-default options need a call
> to of_platform_populate.

I like this idea as this would also probably remove the the numerous
dmesg errors we are currently getting for drivers reprobing with
-EPROBE_DEFER.

In the long term we should have platform bus just call a set of
standardized functions implemented by whatever the data source might
be. That way we can limit the use of of_* functions in device drivers
to just parsing of custom bindings in the drivers and use bus specific
functions for everything else.

> >> Yes, I know we have some drivers which use platform_get_resources() with
> >> IORESOURCE_IRQ, but they should really use the right accessor.  And those
> >> who just dereference the resource array directly... get what's coming
> >> (though of course they have to be fixed.)
> >
> > $ git grep IORESOURCE_IRQ drivers/ | grep platform_get_resource | wc -l
> > 179
> 
> Certainly, this is worthwhile clean-up no matter what the solution.

Yeah agreed. But let's also consider the IORESOURCE_IRQ as just another
source for for the bus or driver data in addition to the DT parsed data.
Both sources of data should work just fine with platform_bus even
without cleaning up the drivers.

Regards,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Russell King - ARM Linux
	<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Jean-Jacques Hiblot
	<jjhiblot-dLKeG7h1OhBDOHtkgc7UlQ@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Grant Likely
	<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH v3 2/2] dt: platform driver: Fill the resources before probe and defer if needed
Date: Mon, 21 Apr 2014 08:54:24 -0700	[thread overview]
Message-ID: <20140421155424.GD23945@atomide.com> (raw)
In-Reply-To: <CAL_JsqLvLTJwgsB-m0W72WxSUoTV4ubMdvM_a784J4k2eiK9AQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

* Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> [140421 06:47]:
> On Fri, Apr 18, 2014 at 6:24 PM, Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org> wrote:
> > * Russell King - ARM Linux <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org> [140418 16:04]:
> >> On Fri, Apr 18, 2014 at 02:58:48PM -0700, Tony Lindgren wrote:
> >> > Oh come on, let's stop pretending it's not broken. And it's way worse with
> >> > device tree as there's nothing making sure the resources for a driver
> >> > are set up before the driver probes. And we've been unable to fix just
> >> > this issue alone for about six months now. It's also broken beyond that.
> >> > It's called of_platform_bus yet it won't even pass the platform_data
> >> > as auxdata to the devices on a sub-bus instantatiated like I2C.
> >>
> >> Isn't there a much simpler solution to the platform device IRQ problem?
> >>
> >> Rather than trying to fix it at the point where the resources are
> >> created, why not just *not* have DT create the IRQ resources in the
> >> first place, and instead have platform_get_irq() (which is the function
> >> which should be used to get an IRQ) be the actor to do whatever is
> >> necessary to return the IRQ(s) ?
> >
> > Yeah why not. I don't see why we would need to do all this of_* special
> > trickery for much anything beyond parsing the binding.
> 
> That can work, but it will still need something like
> of_find_irq_domain() to determine whether to return -EPROBE_DEFER or
> not.

Right. Naturally let's do whatever it takes to first fix this issue
in a minimal way first for the -rc cycle so we can do the longer term
changes needed.
 
> You could also go in the other direction and don't create the device
> until the resources can be resolved. Unlike any of the other
> solutions, that would work for amba bus as well although we may never
> have a case where we need this with the amba bus. This would require
> making of_platform_populate be callable multiple times, but there are
> already some other reasons for wanting to do that. Specifically, I
> would like the core code to call of_platform_populate with default
> options and then only platforms with non-default options need a call
> to of_platform_populate.

I like this idea as this would also probably remove the the numerous
dmesg errors we are currently getting for drivers reprobing with
-EPROBE_DEFER.

In the long term we should have platform bus just call a set of
standardized functions implemented by whatever the data source might
be. That way we can limit the use of of_* functions in device drivers
to just parsing of custom bindings in the drivers and use bus specific
functions for everything else.

> >> Yes, I know we have some drivers which use platform_get_resources() with
> >> IORESOURCE_IRQ, but they should really use the right accessor.  And those
> >> who just dereference the resource array directly... get what's coming
> >> (though of course they have to be fixed.)
> >
> > $ git grep IORESOURCE_IRQ drivers/ | grep platform_get_resource | wc -l
> > 179
> 
> Certainly, this is worthwhile clean-up no matter what the solution.

Yeah agreed. But let's also consider the IORESOURCE_IRQ as just another
source for for the bus or driver data in addition to the DT parsed data.
Both sources of data should work just fine with platform_bus even
without cleaning up the drivers.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Rob Herring <robherring2@gmail.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Jean-Jacques Hiblot <jjhiblot@traphandler.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <robh+dt@kernel.org>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 2/2] dt: platform driver: Fill the resources before probe and defer if needed
Date: Mon, 21 Apr 2014 08:54:24 -0700	[thread overview]
Message-ID: <20140421155424.GD23945@atomide.com> (raw)
In-Reply-To: <CAL_JsqLvLTJwgsB-m0W72WxSUoTV4ubMdvM_a784J4k2eiK9AQ@mail.gmail.com>

* Rob Herring <robherring2@gmail.com> [140421 06:47]:
> On Fri, Apr 18, 2014 at 6:24 PM, Tony Lindgren <tony@atomide.com> wrote:
> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [140418 16:04]:
> >> On Fri, Apr 18, 2014 at 02:58:48PM -0700, Tony Lindgren wrote:
> >> > Oh come on, let's stop pretending it's not broken. And it's way worse with
> >> > device tree as there's nothing making sure the resources for a driver
> >> > are set up before the driver probes. And we've been unable to fix just
> >> > this issue alone for about six months now. It's also broken beyond that.
> >> > It's called of_platform_bus yet it won't even pass the platform_data
> >> > as auxdata to the devices on a sub-bus instantatiated like I2C.
> >>
> >> Isn't there a much simpler solution to the platform device IRQ problem?
> >>
> >> Rather than trying to fix it at the point where the resources are
> >> created, why not just *not* have DT create the IRQ resources in the
> >> first place, and instead have platform_get_irq() (which is the function
> >> which should be used to get an IRQ) be the actor to do whatever is
> >> necessary to return the IRQ(s) ?
> >
> > Yeah why not. I don't see why we would need to do all this of_* special
> > trickery for much anything beyond parsing the binding.
> 
> That can work, but it will still need something like
> of_find_irq_domain() to determine whether to return -EPROBE_DEFER or
> not.

Right. Naturally let's do whatever it takes to first fix this issue
in a minimal way first for the -rc cycle so we can do the longer term
changes needed.
 
> You could also go in the other direction and don't create the device
> until the resources can be resolved. Unlike any of the other
> solutions, that would work for amba bus as well although we may never
> have a case where we need this with the amba bus. This would require
> making of_platform_populate be callable multiple times, but there are
> already some other reasons for wanting to do that. Specifically, I
> would like the core code to call of_platform_populate with default
> options and then only platforms with non-default options need a call
> to of_platform_populate.

I like this idea as this would also probably remove the the numerous
dmesg errors we are currently getting for drivers reprobing with
-EPROBE_DEFER.

In the long term we should have platform bus just call a set of
standardized functions implemented by whatever the data source might
be. That way we can limit the use of of_* functions in device drivers
to just parsing of custom bindings in the drivers and use bus specific
functions for everything else.

> >> Yes, I know we have some drivers which use platform_get_resources() with
> >> IORESOURCE_IRQ, but they should really use the right accessor.  And those
> >> who just dereference the resource array directly... get what's coming
> >> (though of course they have to be fixed.)
> >
> > $ git grep IORESOURCE_IRQ drivers/ | grep platform_get_resource | wc -l
> > 179
> 
> Certainly, this is worthwhile clean-up no matter what the solution.

Yeah agreed. But let's also consider the IORESOURCE_IRQ as just another
source for for the bus or driver data in addition to the DT parsed data.
Both sources of data should work just fine with platform_bus even
without cleaning up the drivers.

Regards,

Tony

  reply	other threads:[~2014-04-21 15:54 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  9:57 [PATCH] dt: platform driver: Fill the resources before probe and defer if needed Jean-Jacques Hiblot
2014-02-13  9:57 ` Jean-Jacques Hiblot
2014-02-13  9:57 ` Jean-Jacques Hiblot
2014-02-13 10:06 ` Jean-Jacques Hiblot
2014-02-13 10:06   ` Jean-Jacques Hiblot
2014-02-18 20:22 ` Greg KH
2014-02-18 20:22   ` Greg KH
2014-02-18 22:34   ` Grant Likely
2014-02-18 22:34     ` Grant Likely
2014-02-20 15:30 ` Grant Likely
2014-02-20 15:30   ` Grant Likely
2014-02-20 15:30   ` Grant Likely
     [not found]   ` < 1392988720-20976-1-git-send-email-jjhiblot@traphandler.com>
     [not found]     ` <20140308073758 .DA63FC408EC@trevor.secretlab.ca>
     [not found]       ` < CACh+v5P=tcc-h_9r7Btwyu+jWjwH2ocmW4VCgDYqY7VMWsHuOA@mail.gmail.com>
     [not found]         ` < 20140317142443.A2447C40A85@trevor.secretlab.ca>
     [not found]     ` < 902E09E6452B0E43903E4F2D568737AB0B9D2959@DFRE01.ent.ti.com>
     [not found]       ` < CACh+v5MPTx6nwVj1s3krntJqQ6DMTQ2hQ93Hc+rRNAuFa9+qPw@mail.gmail.com>
2014-02-21 13:18   ` [PATCH v2] " Jean-Jacques Hiblot
2014-02-21 13:18     ` Jean-Jacques Hiblot
2014-02-21 15:37     ` Strashko, Grygorii
2014-02-21 15:37       ` Strashko, Grygorii
2014-02-21 15:37       ` Strashko, Grygorii
2014-02-21 16:22       ` Jean-Jacques Hiblot
2014-02-21 16:22         ` Jean-Jacques Hiblot
2014-02-27 16:43         ` Jean-Jacques Hiblot
2014-02-27 16:43           ` Jean-Jacques Hiblot
2014-02-27 16:43           ` Jean-Jacques Hiblot
2014-03-08  7:32           ` Grant Likely
2014-03-08  7:32             ` Grant Likely
2014-03-08  7:32             ` Grant Likely
2014-02-27 15:01     ` Ludovic Desroches
2014-02-27 15:01       ` Ludovic Desroches
2014-02-27 15:01       ` Ludovic Desroches
2014-03-08  7:37     ` Grant Likely
2014-03-08  7:37       ` Grant Likely
2014-03-08  7:37       ` Grant Likely
2014-03-08 11:59       ` Russell King - ARM Linux
2014-03-08 11:59         ` Russell King - ARM Linux
2014-03-08 11:59         ` Russell King - ARM Linux
2014-03-17 11:07       ` Jean-Jacques Hiblot
2014-03-17 11:07         ` Jean-Jacques Hiblot
2014-03-17 11:07         ` Jean-Jacques Hiblot
2014-03-17 14:24         ` Grant Likely
2014-03-17 14:24           ` Grant Likely
2014-03-17 14:24           ` Grant Likely
2014-03-17 15:20           ` Jean-Jacques Hiblot
2014-03-17 15:20             ` Jean-Jacques Hiblot
2014-03-20 16:11             ` Grant Likely
2014-03-20 16:11               ` Grant Likely
2014-03-20 16:11               ` Grant Likely
2014-03-21 14:46               ` [PATCH v3 0/2] " Jean-Jacques Hiblot
2014-03-21 14:46                 ` Jean-Jacques Hiblot
2014-03-21 14:46                 ` Jean-Jacques Hiblot
2014-03-21 14:46                 ` [PATCH v3 1/2] of: irq: Added of_find_irq_domain() to get the domain of an irq Jean-Jacques Hiblot
2014-03-21 14:46                   ` Jean-Jacques Hiblot
2014-03-21 14:46                   ` Jean-Jacques Hiblot
2014-03-21 14:46                 ` [PATCH v3 2/2] dt: platform driver: Fill the resources before probe and defer if needed Jean-Jacques Hiblot
2014-03-21 14:46                   ` Jean-Jacques Hiblot
2014-04-11 17:28                   ` Rob Herring
2014-04-11 17:28                     ` Rob Herring
2014-04-18 20:52                     ` Tony Lindgren
2014-04-18 20:52                       ` Tony Lindgren
2014-04-18 20:52                       ` Tony Lindgren
2014-04-18 21:39                       ` Rob Herring
2014-04-18 21:39                         ` Rob Herring
2014-04-18 21:39                         ` Rob Herring
2014-04-18 21:58                         ` Tony Lindgren
2014-04-18 21:58                           ` Tony Lindgren
2014-04-18 21:58                           ` Tony Lindgren
2014-04-18 23:03                           ` Russell King - ARM Linux
2014-04-18 23:03                             ` Russell King - ARM Linux
2014-04-18 23:03                             ` Russell King - ARM Linux
2014-04-18 23:24                             ` Tony Lindgren
2014-04-18 23:24                               ` Tony Lindgren
2014-04-18 23:24                               ` Tony Lindgren
2014-04-21 13:47                               ` Rob Herring
2014-04-21 13:47                                 ` Rob Herring
2014-04-21 15:54                                 ` Tony Lindgren [this message]
2014-04-21 15:54                                   ` Tony Lindgren
2014-04-21 15:54                                   ` Tony Lindgren
2014-04-21 19:01                                   ` Rob Herring
2014-04-21 19:01                                     ` Rob Herring
2014-04-21 19:01                                     ` Rob Herring
2014-04-21 20:25                                     ` Tony Lindgren
2014-04-21 20:25                                       ` Tony Lindgren
2014-04-21 20:25                                       ` Tony Lindgren
2014-04-22  3:05                                       ` Tony Lindgren
2014-04-22  3:05                                         ` Tony Lindgren
2014-04-22  3:05                                         ` Tony Lindgren
2014-04-22  4:57                                         ` Tony Lindgren
2014-04-22  4:57                                           ` Tony Lindgren
2014-04-23 22:03                                           ` Rob Herring
2014-04-23 22:03                                             ` Rob Herring
2014-04-23 22:03                                             ` Rob Herring
2014-04-23 17:38                                     ` Russell King - ARM Linux
2014-04-23 17:38                                       ` Russell King - ARM Linux
2014-04-23 17:38                                       ` Russell King - ARM Linux
2014-04-23 15:02                                 ` Grant Likely
2014-04-23 15:02                                   ` Grant Likely

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=20140421155424.GD23945@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.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.