summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-11 10:04:59 +0200
committerDominik Brodowski <linux@dominikbrodowski.net>2010-07-30 21:07:32 +0200
commit216d7cdd3b060518a2d4faf584eb15ef5af862b6 (patch)
tree5ab7b1de96ee277f5b1932ba192e9c80fd2418a7 /drivers
parent5716d415f8c5a17d44f6e1d5a1e4998f7306a93b (diff)
downloadlinux-216d7cdd3b060518a2d4faf584eb15ef5af862b6.tar.gz
linux-216d7cdd3b060518a2d4faf584eb15ef5af862b6.tar.bz2
linux-216d7cdd3b060518a2d4faf584eb15ef5af862b6.zip
pcmcia: simplify event callback
The event callback for handling 16bit PCMCIA cards only needs to be informed about a few events. Furthermore, send_event may already only be called with skt->skt_mutex held, which also protects against the module being removed behind the callback's back. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pcmcia/cs.c44
-rw-r--r--drivers/pcmcia/ds.c6
2 files changed, 10 insertions, 40 deletions
diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
index 976d80706eae..5ea196724f5b 100644
--- a/drivers/pcmcia/cs.c
+++ b/drivers/pcmcia/cs.c
@@ -264,8 +264,6 @@ EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
static int send_event(struct pcmcia_socket *s, event_t event, int priority)
{
- int ret;
-
if ((s->state & SOCKET_CARDBUS) && (event != CS_EVENT_CARD_REMOVAL))
return 0;
@@ -274,14 +272,8 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
if (!s->callback)
return 0;
- if (!try_module_get(s->callback->owner))
- return 0;
- ret = s->callback->event(s, event, priority);
-
- module_put(s->callback->owner);
-
- return ret;
+ return s->callback->event(s, event, priority);
}
static int socket_reset(struct pcmcia_socket *skt)
@@ -494,7 +486,6 @@ static int socket_suspend(struct pcmcia_socket *skt)
mutex_lock(&skt->ops_mutex);
skt->suspended_state = skt->state;
- send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW);
skt->socket = dead_socket;
skt->ops->set_socket(skt, &skt->socket);
if (skt->ops->suspend)
@@ -654,16 +645,8 @@ static int pccardd(void *__skt)
spin_unlock_irqrestore(&skt->thread_lock, flags);
mutex_lock(&skt->skt_mutex);
- if (events) {
- if (events & SS_DETECT)
- socket_detect_change(skt);
- if (events & SS_BATDEAD)
- send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW);
- if (events & SS_BATWARN)
- send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW);
- if (events & SS_READY)
- send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW);
- }
+ if (events & SS_DETECT)
+ socket_detect_change(skt);
if (sysfs_events) {
if (sysfs_events & PCMCIA_UEVENT_EJECT)
@@ -823,20 +806,13 @@ int pcmcia_reset_card(struct pcmcia_socket *skt)
break;
}
- ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW);
- if (ret == 0) {
- send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW);
- if (skt->callback)
- skt->callback->suspend(skt);
- mutex_lock(&skt->ops_mutex);
- ret = socket_reset(skt);
- mutex_unlock(&skt->ops_mutex);
- if (ret == 0) {
- send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW);
- if (skt->callback)
- skt->callback->resume(skt);
- }
- }
+ if (skt->callback)
+ skt->callback->suspend(skt);
+ mutex_lock(&skt->ops_mutex);
+ ret = socket_reset(skt);
+ mutex_unlock(&skt->ops_mutex);
+ if ((ret == 0) && (skt->callback))
+ skt->callback->resume(skt);
ret = 0;
} while (0);
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index d2ec45848413..bd58650b2736 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -1253,9 +1253,6 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
pcmcia_card_add(skt);
break;
- case CS_EVENT_EJECTION_REQUEST:
- break;
-
case CS_EVENT_PM_RESUME:
if (verify_cis_cache(skt) != 0) {
dev_dbg(&skt->dev, "cis mismatch - different card\n");
@@ -1273,9 +1270,6 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
}
break;
- case CS_EVENT_PM_SUSPEND:
- case CS_EVENT_RESET_PHYSICAL:
- case CS_EVENT_CARD_RESET:
default:
break;
}