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_nostatic" which contains the resource database handling code, and it will only need to be loaded for the drivers which need it. Signed-off-by: Dominik Brodowski drivers/pcmcia/cs.c | 6 +++++- drivers/pcmcia/cs_internal.h | 2 ++ drivers/pcmcia/rsrc_mgr.c | 17 ++++++++++++++++- include/pcmcia/ss.h | 5 +++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff -ruN linux-original/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c --- linux-original/drivers/pcmcia/cs.c 2004-11-07 13:15:01.449183056 +0100 +++ linux/drivers/pcmcia/cs.c 2004-11-07 13:15:25.166577464 +0100 @@ -250,7 +250,11 @@ 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; diff -ruN linux-original/drivers/pcmcia/cs_internal.h linux/drivers/pcmcia/cs_internal.h --- linux-original/drivers/pcmcia/cs_internal.h 2004-11-07 13:15:01.449183056 +0100 +++ linux/drivers/pcmcia/cs_internal.h 2004-11-07 13:15:25.166577464 +0100 @@ -144,6 +144,8 @@ 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; diff -ruN linux-original/drivers/pcmcia/rsrc_mgr.c linux/drivers/pcmcia/rsrc_mgr.c --- linux-original/drivers/pcmcia/rsrc_mgr.c 2004-11-07 13:15:01.450182904 +0100 +++ linux/drivers/pcmcia/rsrc_mgr.c 2004-11-07 13:15:25.168577160 +0100 @@ -473,11 +473,12 @@ #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) +{ + 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 @@ 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, +}; diff -ruN linux-original/include/pcmcia/ss.h linux/include/pcmcia/ss.h --- linux-original/include/pcmcia/ss.h 2004-11-07 13:15:01.451182752 +0100 +++ linux/include/pcmcia/ss.h 2004-11-07 13:15:25.168577160 +0100 @@ -115,6 +115,10 @@ 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 @@ /* 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 */