Subject: Re: linux-next: Tree for September 3

From: Linus Torvalds <[email-masked]>
Date: Thu, 4 Sep 2008 02:03:21 -0700 (PDT)

On Thu, 4 Sep 2008, Andrew Morton wrote:
> 
> ooh look, I fixed something:
> 
> --- a/drivers/pcmcia/cs.c~a
> +++ a/drivers/pcmcia/cs.c
> @@ -477,6 +477,8 @@ static int socket_setup(struct pcmcia_so
>  	 */
>  	msleep(vcc_settle * 10);
>  
> +	msleep(100);
> +

Heh. I'm hoping that it would help to just change vcc_settle to 50 
instead?

>  	skt->ops->get_status(skt, &status);
>  	if (!(status & SS_POWERON)) {
>  		cs_err(skt, "unable to apply power.\n");
> _
> 
> we seem not to be giving that card enough settling time.  Or is it
> a characteristic of the controller?  

No, I think it's mainly the card.

> It's a module option, but google(linux "unable to apply power") gets
> 859 hits.  Maybe the default is too short..

I certainly don't think it would be wrong to change it to a longer 
timeout. Although I also suspect that we should in that case try to exit 
early too, ie change it to something like

	for (i = 0; i < vcc_settle; i++) {
		msleep(10);
		skt->ops->get_status(skt, &status);
		if (status & SS_POWERON)
			break;
	}

or similar. But if changing it to 50 fixes it for you, that's probably a 
good minimal change for now.

> btw, do we really need to spew all this?
> 
> pccard: card ejected from slot 0
> 3c59x 0000:07:00.0: restoring config space at offset 0xf (was 0xffffffff, writing 0x50a0115)
> 3c59x 0000:07:00.0: restoring config space at offset 0xe (was 0xffffffff, writing 0x0)
...

No.

Although it's really a KERN_DEBUG(), so most people shouldn't even notice. 
I do wonder why somebody does pci_restore_state() when the card is 
ejected..

Oh. It's literally drivers/net/3c59x.c: vortex_remove_one(). So it's not 
the PCI or Cardbus layer, it's the driver itself doing odd things. I don't 
think it's worth worrying about. It's trying to restore the state and 
disable the device that was unplugged and no longer exists ;)

(Which can definitely be a useful thing if the remove_one is done because 
of some user-initiated driver removal. So I do understand why the driver 
has that code, it just doesn't make sense when the removal is due to the 
hardware itself going away).

		Linus