Commit 7d21bed8 authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: grab a reference to the cs-socket in ds

Grab a reference of struct pcmcia_socket for every struct pcmcia_bus_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 b504f217
...@@ -385,6 +385,7 @@ static struct pcmcia_bus_socket * get_socket_info_by_nr(unsigned int nr); ...@@ -385,6 +385,7 @@ static struct pcmcia_bus_socket * get_socket_info_by_nr(unsigned int nr);
static void pcmcia_release_bus_socket(struct kref *refcount) static void pcmcia_release_bus_socket(struct kref *refcount)
{ {
struct pcmcia_bus_socket *s = container_of(refcount, struct pcmcia_bus_socket, refcount); struct pcmcia_bus_socket *s = container_of(refcount, struct pcmcia_bus_socket, refcount);
pcmcia_put_socket(s->parent);
kfree(s); kfree(s);
} }
...@@ -1243,7 +1244,7 @@ static struct file_operations ds_fops = { ...@@ -1243,7 +1244,7 @@ static struct file_operations ds_fops = {
static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev)
{ {
struct pcmcia_socket *socket = class_dev->class_data; struct pcmcia_socket *socket = class_get_devdata(class_dev);
struct pcmcia_bus_socket *s; struct pcmcia_bus_socket *s;
int ret; int ret;
...@@ -1251,6 +1252,15 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) ...@@ -1251,6 +1252,15 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev)
if(!s) if(!s)
return -ENOMEM; return -ENOMEM;
memset(s, 0, sizeof(struct pcmcia_bus_socket)); memset(s, 0, sizeof(struct pcmcia_bus_socket));
/* get reference to parent socket */
s->parent = pcmcia_get_socket(socket);
if (!s->parent) {
printk(KERN_ERR "PCMCIA obtaining reference to socket %p failed\n", socket);
kfree (s);
return -ENODEV;
}
kref_init(&s->refcount); kref_init(&s->refcount);
/* /*
...@@ -1263,9 +1273,6 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) ...@@ -1263,9 +1273,6 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev)
init_waitqueue_head(&s->request); init_waitqueue_head(&s->request);
INIT_LIST_HEAD(&s->devices_list); INIT_LIST_HEAD(&s->devices_list);
/* initialize data */
s->parent = socket;
/* Set up hotline to Card Services */ /* Set up hotline to Card Services */
s->callback.owner = THIS_MODULE; s->callback.owner = THIS_MODULE;
s->callback.event = &ds_event; s->callback.event = &ds_event;
...@@ -1285,7 +1292,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) ...@@ -1285,7 +1292,7 @@ static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev)
static void pcmcia_bus_remove_socket(struct class_device *class_dev) static void pcmcia_bus_remove_socket(struct class_device *class_dev)
{ {
struct pcmcia_socket *socket = class_dev->class_data; struct pcmcia_socket *socket = class_get_devdata(class_dev);
if (!socket || !socket->pcmcia) if (!socket || !socket->pcmcia)
return; return;
......
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