Commit b504f217 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: add pcmcia_(put,get)_socket

Add pcmcia_{put,get}_socket
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ba37b93
......@@ -172,6 +172,29 @@ int pcmcia_socket_dev_resume(struct device *dev)
EXPORT_SYMBOL(pcmcia_socket_dev_resume);
struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt)
{
struct class_device *cl_dev = class_device_get(&skt->dev);
if (!cl_dev)
return NULL;
skt = class_get_devdata(cl_dev);
if (!try_module_get(skt->owner)) {
class_device_put(&skt->dev);
return NULL;
}
return (skt);
}
EXPORT_SYMBOL(pcmcia_get_socket);
void pcmcia_put_socket(struct pcmcia_socket *skt)
{
module_put(skt->owner);
class_device_put(&skt->dev);
}
EXPORT_SYMBOL(pcmcia_put_socket);
static void pcmcia_release_socket(struct class_device *class_dev)
{
struct pcmcia_socket *socket = class_get_devdata(class_dev);
......
......@@ -426,6 +426,9 @@ int pcmcia_modify_window(window_handle_t win, modwin_t *req);
int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask);
#endif
struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt);
void pcmcia_put_socket(struct pcmcia_socket *skt);
#endif /* __KERNEL__ */
#endif /* _LINUX_CS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment