[PATCHES 2.5] pcmcia: add struct pcmcia_device

Dominik Brodowski linux at brodo.de
Sat Apr 19 17:39:50 BST 2003


On Sat, Apr 19, 2003 at 02:46:35PM +0100, Russell King wrote:
> > +	    if (resources_available) {
> > +		    /* gotta go */
> > +		    ioctl_resources_count = -ioctl_resources_count;
> 
> I can see this going horribly wrong.  I'd much prefer that we didn't
> guess what's going on, but used something which told us positively
> what the status is.  If that means we need to add extra functions to
> rsrc_mgr.c, then that's the right answer.

I disagree. There's no way rsrc_mgr.c can know whether the resource
initialization is ongoing, done, or whether cardmgr is in the process of
unloading (or, worse, resetting). It's not enough to know that one mem and
one io area are available. And so, ds.c _needs_ to analyze what input it 
gets from cardmgr. Here's what cardmgr does:

read /etc/pcmcia/config.opts
ioctl - DS_ADJUST_RESOURCE_INFO
some-other-stuff
...
# user decides to "reset" cardmgr using a call to SIGHUP
_exactly_ the same DS_ADJUST_RESOURCE_INFO calls, only add/remove inversed, are
   passed to ds_ioctl.
re-read /etc/pcmcia/config.opts
ioctl - DS_ADJUST_RESOURCE_INFO
some-other-stuff
...
# user decides to kill cardmgr
_exactly_ the same DS_ADJUST_RESOURCE_INFO calls as after SIGHUP, only 
   add/remove inversed, are passed to ds_ioctl.

Of course, it would be better if cardmgr told us about the state of the
resources. Or, even better, if the whole resource management code was the
way you want it to be :) But as long as this isn't done I want to keep near
to 100% backwards-compatibility.

> can suspend the insert processing if resources aren't available (via
> your favourite method) and then call pcmcia_resources_available() to
> cause the state machine to re-test the resource state.  (see my
> socket map-type patch for an example of this.)

AFAICS this won't help. Even if by some state machine mechanism ds.c can
learn that there are enough resources available for some things like CIS 
parsing, it will be in a highly unreliable state: it won't know whether the
whole resource setting process is done. (and this time, we need to take
special care for non-statically mapped sockets!)

> Also, for the sysfs_output patch:

<snip>

> The overall size may be smaller if you do:
> 
> static struct device_attribute *pcmcia_dev_attrs[] = {

> 	for (i = 0; i < ARRAY_SIZE(pcmcia_dev_attrs); i++)
> 		device_create_file(&p_dev->dev, pcmcia_dev_attrs[i]);

Thanks - will update the patch accordingly.

	Dominik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20030419/bffe241b/attachment.bin


More information about the linux-pcmcia mailing list