All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: "MyungJoo Ham" <myungjoo.ham@samsung.com>,
	linux-kernel@vger.kernel.org,
	"Randy Dunlap" <rdunlap@xenotime.net>,
	"Mike Lockwood" <lockwood@android.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Kyungmin Park" <kyungmin.park@samsung.com>,
	"Donggeun Kim" <dg77.kim@samsung.com>, "Greg KH" <gregkh@suse.de>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"MyungJoo Ham" <myungjoo.ham@gmail.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Morten CHRISTIANSEN" <morten.christiansen@stericsson.com>
Subject: Re: [PATCH v2 0/3] introduce External Connector Class (extcon)
Date: Tue, 20 Dec 2011 16:58:51 +1100	[thread overview]
Message-ID: <20111220165851.1ee09b28@notabene.brown> (raw)
In-Reply-To: <20111220010109.GO2860@opensource.wolfsonmicro.com>

[-- Attachment #1: Type: text/plain, Size: 2573 bytes --]

On Tue, 20 Dec 2011 01:01:09 +0000 Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:

> On Sun, Dec 18, 2011 at 06:15:50PM +1100, NeilBrown wrote:
> > On Thu, 15 Dec 2011 14:51:55 +0800 Mark Brown
> 
> > > Grant has a proposal for this which revolves around devices trying to
> > > acquire their resources and returning a "please retry" error code if
> > > they don't have all their dependencies.  Half the problem here is that
> 
> > A possibility I have been thinking about is to multithread do_initcalls() and
> > have the various request functions (gpio_request, regulator_get, request_irq,
> > etc) optionally block if the resource isn't available.
> 
> That seems to be logically the same in terms of what it actually does
> but introduces concurrency which wasn't there before which means that
> things could get reordered for random reasons.  That seems like it'd not
> be great for robustness.

Logically similar..

One important difference is that (if I understand it correctly), the "please
retry" error need to be propagated up a lot further than it currently is so
that would be quite intrusive.

While my approach does introduce concurrency which wasn't there before, any
driver that can be built as a module must allow for concurrency in the init
function so I suspect (or hope) people normally make that code thread-safe.

I have some code that almost works (will post when it does work).  The only
real issue I have found (apart from personal incompetence) is that we really
need to know up-front what resources are going to be available so we know
whether to wait or to fail (waiting until 'everything is finished' won't work
as there could be several things still waiting at the end and we don't know if
one is waiting for another, of if they are waiting for things that won't
appear).

I imagine that ultimately we can depend on a device-tree file to list every
resource (gpio, irq, regulator) that is relevant here and can write the code
to wait-or-fail accordingly.

> 
> > Do we need to talk about devices that haven't been enumerated yet? or was
> > that just if we wanted to create an explicit dependency graph?
> 
> You need to know about devices that aren't enumerated yet.

I'm still not quite sure what you mean.  In my (limited) experience you need
to know about resources, not devices, and they have names.
And there is some precedent in regulator supply lists for naming devices
before they are enumerated.  So I'm not seeing the problem that you are
seeing.

Thanks,
NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2011-12-20  5:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 10:28 [PATCH v2 0/3] introduce External Connector Class (extcon) MyungJoo Ham
2011-12-14 10:28 ` [PATCH v2 1/3] Extcon (external connector): import Android's switch class and modify MyungJoo Ham
2011-12-15  1:01   ` Greg KH
2011-12-15  5:41     ` MyungJoo Ham
2011-12-15  7:18       ` Greg KH
2011-12-16  5:38         ` MyungJoo Ham
2011-12-16 18:18           ` Greg KH
2011-12-14 10:28 ` [PATCH v2 2/3] Extcon: support notification based on the state changes MyungJoo Ham
2011-12-14 10:28 ` [PATCH v2 3/3] Extcon: support multiple states at a device MyungJoo Ham
2011-12-15  2:32 ` [PATCH v2 0/3] introduce External Connector Class (extcon) NeilBrown
2011-12-15  6:36   ` MyungJoo Ham
2011-12-15 20:20     ` NeilBrown
2011-12-15  6:51   ` Mark Brown
2011-12-18  7:15     ` NeilBrown
2011-12-20  1:01       ` Mark Brown
2011-12-20  5:58         ` NeilBrown [this message]

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=20111220165851.1ee09b28@notabene.brown \
    --to=neilb@suse.de \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dg77.kim@samsung.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gregkh@suse.de \
    --cc=kyungmin.park@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lockwood@android.com \
    --cc=morten.christiansen@stericsson.com \
    --cc=myungjoo.ham@gmail.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=rdunlap@xenotime.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.