
From: Dominik Brodowski <linux@dominikbrodowski.de>

Add pcmcia_{put,get}_socket

Signed-off-by: Dominik Brodowski <linux@brodo.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/pcmcia/cs.c |   23 +++++++++++++++++++++++
 25-akpm/include/pcmcia/cs.h |    3 +++
 2 files changed, 26 insertions(+)

diff -puN drivers/pcmcia/cs.c~pcmcia-add-pcmcia_putget_socket drivers/pcmcia/cs.c
--- 25/drivers/pcmcia/cs.c~pcmcia-add-pcmcia_putget_socket	2004-12-03 18:44:34.111597448 -0800
+++ 25-akpm/drivers/pcmcia/cs.c	2004-12-03 18:44:34.118596384 -0800
@@ -172,6 +172,29 @@ int pcmcia_socket_dev_resume(struct devi
 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);
diff -puN include/pcmcia/cs.h~pcmcia-add-pcmcia_putget_socket include/pcmcia/cs.h
--- 25/include/pcmcia/cs.h~pcmcia-add-pcmcia_putget_socket	2004-12-03 18:44:34.113597144 -0800
+++ 25-akpm/include/pcmcia/cs.h	2004-12-03 18:44:34.118596384 -0800
@@ -426,6 +426,9 @@ int pcmcia_modify_window(window_handle_t
 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 */
_
