Skip to contentSkip to conversation

PCMCIA insert on resume

PATCH Rodolfo Giometti 3 participants 3 messages Oct 24, 2007 – Oct 28, 2007 Pcmcia

lore
Share & tools
lore
#0 lore raw

Hello,

I don't understand why, on resume, the function socket_resume() (in drivers/pcmcia/cs.c) do:

       if (!(skt->state & SOCKET_PRESENT)) {
               skt->state &= ~SOCKET_SUSPEND;
               return socket_insert(skt);
       }

This cause a powered off socket before suspend to be powered on during resume.

To avoid such (erroneous?) behaviour I propose this patch:

drivers/pcmcia/cs.c +3 -4
index 729e37d..d69de74 100644
@@ -562,10 +562,8 @@ static int socket_resume(struct pcmcia_socket *skt)
        skt->ops->init(skt);
        skt->ops->set_socket(skt, &skt->socket);
 
-       if (!(skt->state & SOCKET_PRESENT)) {
-               skt->state &= ~SOCKET_SUSPEND;
-               return socket_insert(skt);
-       }
+       if (!(skt->state & SOCKET_PRESENT))
+               goto resume_exit;
 
        ret = socket_setup(skt, SS_COMA, resume_delay);
        if (ret == CS_SUCCESS) {
@@ -599,6 +597,7 @@ static int socket_resume(struct pcmcia_socket *skt)
                socket_shutdown(skt);
        }
 
+resume_exit:
        skt->state &= ~SOCKET_SUSPEND;
 
        return CS_SUCCESS;

With this patch if the socket was powered down before the suspend, at resume time it's not powered on and you need a "pccardctl insert" to activate the socket.

Ciao,

Rodolfo

Signature · 4 lines
GNU/Linux Solutions                  e-mail:    [email protected]
Linux Device Driver                             [email protected]
Embedded Systems                     		[email protected]
UNIX programming                     phone:     +39 349 2432127
#1 lore raw

Hi!

Quoted 39 lines

I don't understand why, on resume, the function socket_resume() (in drivers/pcmcia/cs.c) do:

       if (!(skt->state & SOCKET_PRESENT)) {
               skt->state &= ~SOCKET_SUSPEND;
               return socket_insert(skt);
       }

This cause a powered off socket before suspend to be powered on during resume.

To avoid such (erroneous?) behaviour I propose this patch:

drivers/pcmcia/cs.c +3 -4
index 729e37d..d69de74 100644
@@ -562,10 +562,8 @@ static int socket_resume(struct pcmcia_socket *skt)
        skt->ops->init(skt);
        skt->ops->set_socket(skt, &skt->socket);
 
-       if (!(skt->state & SOCKET_PRESENT)) {
-               skt->state &= ~SOCKET_SUSPEND;
-               return socket_insert(skt);
-       }
+       if (!(skt->state & SOCKET_PRESENT))
+               goto resume_exit;
 
        ret = socket_setup(skt, SS_COMA, resume_delay);
        if (ret == CS_SUCCESS) {
@@ -599,6 +597,7 @@ static int socket_resume(struct pcmcia_socket *skt)
                socket_shutdown(skt);
        }
 
+resume_exit:
        skt->state &= ~SOCKET_SUSPEND;
 
        return CS_SUCCESS;
Quoted 3 lines

With this patch if the socket was powered down before the suspend, at resume time it's not powered on and you need a "pccardctl insert" to activate the socket.

Seems okay to me, but I do not know much about pcmcia. Add signed-off-by, changelog at the beggining, cc me, rafael and akpm... ?
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw
Quoted 39 lines · Pavel Machek

Hi!

Quoted 37 lines

I don't understand why, on resume, the function socket_resume() (in drivers/pcmcia/cs.c) do:

       if (!(skt->state & SOCKET_PRESENT)) {
               skt->state &= ~SOCKET_SUSPEND;
               return socket_insert(skt);
       }

This cause a powered off socket before suspend to be powered on during resume.

To avoid such (erroneous?) behaviour I propose this patch:

drivers/pcmcia/cs.c +3 -4
index 729e37d..d69de74 100644
@@ -562,10 +562,8 @@ static int socket_resume(struct pcmcia_socket *skt)
        skt->ops->init(skt);
        skt->ops->set_socket(skt, &skt->socket);
 
-       if (!(skt->state & SOCKET_PRESENT)) {
-               skt->state &= ~SOCKET_SUSPEND;
-               return socket_insert(skt);
-       }
+       if (!(skt->state & SOCKET_PRESENT))
+               goto resume_exit;
 
        ret = socket_setup(skt, SS_COMA, resume_delay);
        if (ret == CS_SUCCESS) {
@@ -599,6 +597,7 @@ static int socket_resume(struct pcmcia_socket *skt)
                socket_shutdown(skt);
        }
 
+resume_exit:
        skt->state &= ~SOCKET_SUSPEND;
 
Quoted 8 lines
Quoted 5 lines
drivers/pcmcia/cs.c +0 -0
        return CS_SUCCESS;

With this patch if the socket was powered down before the suspend, at resume time it's not powered on and you need a "pccardctl insert" to activate the socket.

Seems okay to me, but I do not know much about pcmcia. Add signed-off-by, changelog at the beggining, cc me, rafael and akpm... ?

Actually, there are some objections wrt this patch from Russell King.

Greetings,
Rafael