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: 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(-) Index: 2.6.10-rc3/drivers/pcmcia/cs.c =================================================================== --- 2.6.10-rc3.orig/drivers/pcmcia/cs.c 2004-12-05 10:26:06.911553488 +0100 +++ 2.6.10-rc3/drivers/pcmcia/cs.c 2004-12-05 10:26:07.121521568 +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; Index: 2.6.10-rc3/drivers/pcmcia/cs_internal.h =================================================================== --- 2.6.10-rc3.orig/drivers/pcmcia/cs_internal.h 2004-12-05 10:26:06.912553336 +0100 +++ 2.6.10-rc3/drivers/pcmcia/cs_internal.h 2004-12-05 10:26:07.121521568 +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; Index: 2.6.10-rc3/drivers/pcmcia/rsrc_mgr.c =================================================================== --- 2.6.10-rc3.orig/drivers/pcmcia/rsrc_mgr.c 2004-12-05 10:26:06.913553184 +0100 +++ 2.6.10-rc3/drivers/pcmcia/rsrc_mgr.c 2004-12-05 10:26:07.122521416 +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, +}; Index: 2.6.10-rc3/include/pcmcia/ss.h =================================================================== --- 2.6.10-rc3.orig/include/pcmcia/ss.h 2004-12-05 10:26:06.914553032 +0100 +++ 2.6.10-rc3/include/pcmcia/ss.h 2004-12-05 10:26:07.123521264 +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 */