aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/cs.c')
-rw-r--r--drivers/pcmcia/cs.c36
1 files changed, 7 insertions, 29 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 5ea196724f5b..efa30b84a75a 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -252,30 +252,6 @@ struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr)
252} 252}
253EXPORT_SYMBOL(pcmcia_get_socket_by_nr); 253EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
254 254
255/*
256 * The central event handler. Send_event() sends an event to the
257 * 16-bit subsystem, which then calls the relevant device drivers.
258 * Parse_events() interprets the event bits from
259 * a card status change report. Do_shutdown() handles the high
260 * priority stuff associated with a card removal.
261 */
262
263/* NOTE: send_event needs to be called with skt->sem held. */
264
265static int send_event(struct pcmcia_socket *s, event_t event, int priority)
266{
267 if ((s->state & SOCKET_CARDBUS) && (event != CS_EVENT_CARD_REMOVAL))
268 return 0;
269
270 dev_dbg(&s->dev, "send_event(event %d, pri %d, callback 0x%p)\n",
271 event, priority, s->callback);
272
273 if (!s->callback)
274 return 0;
275
276 return s->callback->event(s, event, priority);
277}
278
279static int socket_reset(struct pcmcia_socket *skt) 255static int socket_reset(struct pcmcia_socket *skt)
280{ 256{
281 int status, i; 257 int status, i;
@@ -318,7 +294,8 @@ static void socket_shutdown(struct pcmcia_socket *s)
318 294
319 dev_dbg(&s->dev, "shutdown\n"); 295 dev_dbg(&s->dev, "shutdown\n");
320 296
321 send_event(s, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); 297 if (s->callback)
298 s->callback->remove(s);
322 299
323 mutex_lock(&s->ops_mutex); 300 mutex_lock(&s->ops_mutex);
324 s->state &= SOCKET_INUSE | SOCKET_PRESENT; 301 s->state &= SOCKET_INUSE | SOCKET_PRESENT;
@@ -469,7 +446,8 @@ static int socket_insert(struct pcmcia_socket *skt)
469 dev_dbg(&skt->dev, "insert done\n"); 446 dev_dbg(&skt->dev, "insert done\n");
470 mutex_unlock(&skt->ops_mutex); 447 mutex_unlock(&skt->ops_mutex);
471 448
472 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); 449 if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
450 skt->callback->add(skt);
473 } else { 451 } else {
474 mutex_unlock(&skt->ops_mutex); 452 mutex_unlock(&skt->ops_mutex);
475 socket_shutdown(skt); 453 socket_shutdown(skt);
@@ -546,8 +524,8 @@ static int socket_late_resume(struct pcmcia_socket *skt)
546 return 0; 524 return 0;
547 } 525 }
548#endif 526#endif
549 527 if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
550 send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); 528 skt->callback->early_resume(skt);
551 return 0; 529 return 0;
552} 530}
553 531
@@ -766,7 +744,7 @@ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c)
766 s->callback = c; 744 s->callback = c;
767 745
768 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) 746 if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT)
769 send_event(s, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); 747 s->callback->add(s);
770 } else 748 } else
771 s->callback = NULL; 749 s->callback = NULL;
772 err: 750 err: