Commit 41a2609e authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: get a reference to ds-socket for each pcmcia_device

Obtain a reference to struct pcmcia_bus_socket for each pcmcia_device. This
means that pcmcia_device always holds an indirect reference to struct
pcmcia_socket as well.
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 7d21bed8
...@@ -479,6 +479,7 @@ static void pcmcia_release_dev(struct device *dev) ...@@ -479,6 +479,7 @@ static void pcmcia_release_dev(struct device *dev)
{ {
struct pcmcia_device *p_dev = to_pcmcia_dev(dev); struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
p_dev->socket->pcmcia->device_count = 0; p_dev->socket->pcmcia->device_count = 0;
pcmcia_put_bus_socket(p_dev->socket->pcmcia);
kfree(p_dev); kfree(p_dev);
} }
...@@ -693,6 +694,13 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info) ...@@ -693,6 +694,13 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
} }
memset(p_dev, 0, sizeof(struct pcmcia_device)); memset(p_dev, 0, sizeof(struct pcmcia_device));
s = pcmcia_get_bus_socket(s);
if (!s) {
ret = -ENODEV;
kfree(p_dev);
goto err_free_client;
}
p_dev->socket = s->parent; p_dev->socket = s->parent;
p_dev->device_no = (s->device_count++); p_dev->device_no = (s->device_count++);
p_dev->func = bind_info->function; p_dev->func = bind_info->function;
...@@ -706,6 +714,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info) ...@@ -706,6 +714,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
ret = device_register(&p_dev->dev); ret = device_register(&p_dev->dev);
if (ret) { if (ret) {
kfree(p_dev); kfree(p_dev);
pcmcia_put_bus_socket(s);
goto err_free_client; goto err_free_client;
} }
......
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