Commit 23d2f5db authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Linus Torvalds

[PATCH] pcmcia: validate_mem only for non-statically mapped sockets

validate_mem() does only make sense for !SS_CAP_STATIC_MAP sockets. Therefore,
re-direct validate_mem() calls only for those. The newly added redirection 
layer will allow for a "library" module named "rsrc_nonstatic" which contains 
the resource database handling code, and it will only need to be loaded for
the drivers which need it.
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 dd9b7756
......@@ -250,7 +250,11 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
socket->cis_mem.flags = 0;
socket->cis_mem.speed = cis_speed;
/* init resource database */
/* init resource handling */
if (socket->features & SS_CAP_STATIC_MAP)
socket->resource_ops = &pccard_static_ops;
else
socket->resource_ops = &pccard_nonstatic_ops;
socket->mem_db.next = &socket->mem_db;
socket->io_db.next = &socket->io_db;
......
......@@ -144,6 +144,8 @@ int try_irq(u_int Attributes, int irq, int specific);
void undo_irq(u_int Attributes, int irq);
int adjust_resource_info(client_handle_t handle, adjust_t *adj);
void release_resource_db(struct pcmcia_socket *s);
extern struct pccard_resource_ops pccard_static_ops;
extern struct pccard_resource_ops pccard_nonstatic_ops;
/* In socket_sysfs.c */
extern struct class_interface pccard_sysfs_interface;
......
......@@ -473,11 +473,12 @@ static void validate_mem(struct pcmcia_socket *s, unsigned int probe_mask)
#endif /* CONFIG_PCMCIA_PROBE */
/*
* Locking note: this is the only place where we take
* both rsrc_sem and skt_sem.
*/
void pcmcia_validate_mem(struct pcmcia_socket *s)
static void pcmcia_nonstatic_validate_mem(struct pcmcia_socket *s)
{
if (probe_mem) {
unsigned int probe_mask;
......@@ -503,6 +504,11 @@ void pcmcia_validate_mem(struct pcmcia_socket *s)
}
}
void pcmcia_validate_mem(struct pcmcia_socket *s)
{
if (s->resource_ops->validate_mem)
s->resource_ops->validate_mem(s);
}
EXPORT_SYMBOL(pcmcia_validate_mem);
struct pcmcia_align_data {
......@@ -981,3 +987,12 @@ void release_resource_db(struct pcmcia_socket *s)
kfree(p);
}
}
struct pccard_resource_ops pccard_static_ops = {
.validate_mem = NULL,
};
struct pccard_resource_ops pccard_nonstatic_ops = {
.validate_mem = pcmcia_nonstatic_validate_mem,
};
......@@ -115,6 +115,10 @@ struct pccard_operations {
int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
};
struct pccard_resource_ops {
void (*validate_mem) (struct pcmcia_socket *s);
};
/*
* Calls to set up low-level "Socket Services" drivers
*/
......@@ -194,6 +198,7 @@ struct pcmcia_socket {
/* socket operations */
struct pccard_operations * ops;
struct pccard_resource_ops * resource_ops;
/* Zoom video behaviour is so chip specific its not worth adding
this to _ops */
......
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