Commit acb998c3 authored by Russell King's avatar Russell King

[PCMCIA] Move "owner" field to pcmcia_socket.

Move ->owner field from socket operations to pcmcia_socket.  (This
change is mainly for the SA11xx drivers, which use a core driver
for the chip, and a separate module for all the machine specific
bits.)
parent 947af82f
......@@ -235,11 +235,11 @@ static int register_callback(struct pcmcia_socket *s, void (*handler)(void *, un
{
int error;
if (handler && !try_module_get(s->ss_entry->owner))
if (handler && !try_module_get(s->owner))
return -ENODEV;
error = s->ss_entry->register_callback(s, handler, info);
if (!handler)
module_put(s->ss_entry->owner);
module_put(s->owner);
return error;
}
......
......@@ -64,7 +64,6 @@ static struct pci_driver i82092aa_pci_drv = {
/* the pccard structure and its functions */
static struct pccard_operations i82092aa_operations = {
.owner = THIS_MODULE,
.init = i82092aa_init,
.suspend = i82092aa_suspend,
.register_callback = i82092aa_register_callback,
......@@ -142,6 +141,7 @@ static int __init i82092aa_pci_probe(struct pci_dev *dev, const struct pci_devic
sockets[i].socket.map_size = 0x1000;
sockets[i].socket.irq_mask = 0;
sockets[i].socket.pci_irq = dev->irq;
sockets[i].socket.owner = THIS_MODULE;
sockets[i].number = i;
......
......@@ -1400,7 +1400,6 @@ static int pcic_suspend(struct pcmcia_socket *sock)
}
static struct pccard_operations pcic_operations = {
.owner = THIS_MODULE,
.init = pcic_init,
.suspend = pcic_suspend,
.register_callback = pcic_register_callback,
......@@ -1464,6 +1463,7 @@ static int __init init_i82365(void)
for (i = 0; i < sockets; i++) {
socket[i].socket.dev.dev = &i82365_device.dev;
socket[i].socket.ss_entry = &pcic_operations;
socket[i].socket.owner = THIS_MODULE;
socket[i].number = i;
ret = pcmcia_register_socket(&socket[i].socket);
if (ret && i--) {
......
......@@ -356,13 +356,10 @@ sa1100_pcmcia_register_callback(struct pcmcia_socket *sock,
struct sa1100_pcmcia_socket *skt = to_sa1100_socket(sock);
if (handler) {
if (!try_module_get(skt->ops->owner))
return -ENODEV;
skt->handler_info = info;
skt->handler = handler;
} else {
skt->handler = NULL;
module_put(skt->ops->owner);
}
return 0;
......@@ -655,7 +652,6 @@ static CLASS_DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
static struct pccard_operations sa11xx_pcmcia_operations = {
.owner = THIS_MODULE,
.init = sa1100_pcmcia_sock_init,
.suspend = sa1100_pcmcia_suspend,
.register_callback = sa1100_pcmcia_register_callback,
......@@ -765,6 +761,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, in
memset(skt, 0, sizeof(*skt));
skt->socket.ss_entry = &sa11xx_pcmcia_operations;
skt->socket.owner = ops->owner;
skt->socket.dev.dev = dev;
INIT_WORK(&skt->work, sa1100_pcmcia_task_handler, skt);
......
......@@ -437,6 +437,7 @@ static int __init init_tcic(void)
socket_table[sockets].info = NULL;
socket_table[sockets].id = get_tcic_id();
socket_table[sockets].socket.owner = THIS_MODULE;
/* only 16-bit cards, memory windows must be size-aligned */
/* No PCI or CardBus support */
socket_table[sockets].socket.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN;
......@@ -915,7 +916,6 @@ static int tcic_suspend(struct pcmcia_socket *sock)
}
static struct pccard_operations tcic_operations = {
.owner = THIS_MODULE,
.init = tcic_init,
.suspend = tcic_suspend,
.register_callback = tcic_register_callback,
......
......@@ -782,7 +782,6 @@ static int yenta_register_callback(struct pcmcia_socket *sock, void (*handler)(v
static struct pccard_operations yenta_socket_operations = {
.owner = THIS_MODULE,
.init = yenta_init,
.suspend = yenta_suspend,
.register_callback = yenta_register_callback,
......@@ -860,6 +859,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i
socket->socket.ss_entry = &yenta_socket_operations;
socket->socket.dev.dev = &dev->dev;
socket->socket.driver_data = socket;
socket->socket.owner = THIS_MODULE;
/* prepare struct yenta_socket */
socket->dev = dev;
......
......@@ -119,7 +119,6 @@ typedef struct cb_bridge_map {
struct pcmcia_socket;
struct pccard_operations {
struct module *owner;
int (*init)(struct pcmcia_socket *sock);
int (*suspend)(struct pcmcia_socket *sock);
int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
......@@ -169,6 +168,7 @@ struct config_t;
struct region_t;
struct pcmcia_socket {
struct module *owner;
spinlock_t lock;
struct pccard_operations * ss_entry;
socket_state_t socket;
......
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