From: David Gibson <david@gibson.dropbear.id.au>
To: Manuel Estrada Sainz <ranty@debian.org>
Cc: Greg KH <greg@kroah.com>, Oliver Neukum <oliver@neukum.org>,
LKML <linux-kernel@vger.kernel.org>,
Simon Kelley <simon@thekelleys.org.uk>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
"Downing, Thomas" <Thomas.Downing@ipc.com>,
jt@hpl.hp.com, Pavel Roskin <proski@gnu.org>
Subject: Re: request_firmware() hotplug interface, third round.
Date: Sat, 17 May 2003 19:07:05 +1000 [thread overview]
Message-ID: <20030517090705.GA16092@zax> (raw)
In-Reply-To: <20030517084612.GC3808@ranty.ddts.net>
On Sat, May 17, 2003 at 10:46:12AM +0200, Manuel Estrada Sainz wrote:
> On Sat, May 17, 2003 at 02:44:59PM +1000, David Gibson wrote:
> > On Fri, May 16, 2003 at 05:03:38PM -0700, Greg Kroah-Hartman wrote:
> > > On Sat, May 17, 2003 at 01:55:15AM +0200, Oliver Neukum wrote:
> > > >
> > > > > > - echo 1 > /sysfs/class/firmware/dev_name/loading
> > > > > > - cat whatever_fw > /sysfs/class/firmware/dev_name/data
> > > > > > - echo 0 > /sysfs/class/firmware/dev_name/loading
> > > > >
> > > > > Nice, but can't you get rid of the loading file by just relying on
> > > > > open() and close()? Oh wait, sysfs doesn't pass that down to you, hm,
> > > > > looks like you need that info. But does the new binary interface in
> > > > > sysfs that just got merged into the tree provide that info for you?
> > > >
> > > > But what if the close() is due to irregular termination?
> > > > If the script is killed, do you download half a firmware?
> > >
> > > Good point. Actually I don't think that the binary interface for sysfs
> > > passes open and close down to the lower levels, so it's a moot point.
> > >
> > > echo... works for me.
> >
> > I think we'd be better off checking for this case by requiring the
> > firmware to include a length field and adapting the binary interface
> > so that we can see the open/close boundary. The "loading" thing is
> > pretty damn ugly.
>
> I did look for open/close first and finally added the 'loading' because
> I didn't have them.
>
> I don't thing it is so ugly, but if I could see open/close and the
> consensus is that 'loading' should go, I'll do it.
Hmm... on consideration I don't think it's as ugly as I first
thought. But I think I have a better idea, see below...
> > Plus with the "loading" file, a interrupted load will just appear to
> > be unterminated - and if the scripts run again they'll have to check
> > that the loading file was 0 to start with - and if it isn't there's
> > nothing they can do except wait for the dead load to time out.
>
> The script will not automatically run at least until the timeout is
> expired.
>
> But in case you are doing things by hand, how about:
>
> $ echo cancel > .../loading
>
> or if you want to keep the content numeric:
>
> $ echo -1 > .../loading
>
> This will also allow the regular script to just cancel the load in case
> of error, like if the firmware image is not available or a read error
> happened while reading it.
>
> I'll implement that and the other stuff that came out of Oliver's
> comments later today and post the new code.
>
> > Better to catch the close, check the length, then return the firmware
> > or throw the junk image away as appropriate.
>
> If 'loading' stays the above should fix your timeout issue, and if it
> goes, yes, that is probably the way to go.
How about combining these two ideas: instead of "loading" and "data"
we have "size" and "data". First you write the size, then the data -
the driver accepts it once it gets the expected number of bytes.
Writing a new size throws away any partial image that's there, and
restarts the upload. Writing 0 cancels the upload entirely, and the
driver will presumably fail to initialize (or maybe use a default
image if it has one).
There's another question - what happens if userspace tries to write an
image when the driver hasn't requested one through hotplug?
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
next prev parent reply other threads:[~2003-05-17 8:54 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-15 20:03 request_firmware() hotplug interface, third round Manuel Estrada Sainz
2003-05-16 8:07 ` Oliver Neukum
2003-05-16 9:56 ` Manuel Estrada Sainz
2003-05-16 15:53 ` Oliver Neukum
2003-05-16 18:31 ` Manuel Estrada Sainz
2003-05-16 22:22 ` Oliver Neukum
2003-05-17 0:59 ` Manuel Estrada Sainz
2003-05-17 4:00 ` Robert White
2003-05-17 13:23 ` Alan Cox
2003-05-17 14:57 ` Manuel Estrada Sainz
2003-05-16 18:49 ` Jean Tourrilhes
2003-05-16 22:24 ` Oliver Neukum
2003-05-16 23:21 ` Greg KH
2003-05-16 16:09 ` Alan Cox
2003-05-16 22:13 ` Oliver Neukum
2003-05-17 4:50 ` David Gibson
2003-05-17 7:02 ` Oliver Neukum
2003-05-17 8:21 ` David Gibson
2003-05-16 13:13 ` Ingo Oeser
2003-05-16 17:07 ` Manuel Estrada Sainz
2003-05-16 22:36 ` Greg KH
2003-05-16 23:37 ` Manuel Estrada Sainz
2003-05-16 23:59 ` Greg KH
2003-05-17 4:47 ` David Gibson
2003-05-17 8:54 ` Manuel Estrada Sainz
2003-05-16 23:55 ` Oliver Neukum
2003-05-17 0:03 ` Greg KH
2003-05-17 2:42 ` Robert White
2003-05-17 4:44 ` David Gibson
2003-05-17 8:46 ` Manuel Estrada Sainz
2003-05-17 9:07 ` David Gibson [this message]
2003-05-17 9:50 ` Manuel Estrada Sainz
2003-05-17 10:30 ` Manuel Estrada Sainz
2003-05-20 5:21 ` David Gibson
2003-05-20 8:07 ` Manuel Estrada Sainz
2003-05-21 4:21 ` Greg KH
2003-05-21 7:06 ` Manuel Estrada Sainz
2003-05-17 10:51 ` Manuel Estrada Sainz
2003-05-17 13:21 ` Ingo Oeser
2003-05-17 15:15 ` Manuel Estrada Sainz
[not found] ` <Pine.LNX.4.55.0305151623520.2885@marabou.research.att.com>
2003-05-16 9:27 ` Manuel Estrada Sainz
2003-05-16 22:39 ` Greg KH
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=20030517090705.GA16092@zax \
--to=david@gibson.dropbear.id.au \
--cc=Thomas.Downing@ipc.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=jt@hpl.hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver@neukum.org \
--cc=proski@gnu.org \
--cc=ranty@debian.org \
--cc=simon@thekelleys.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox