[patch 16/21] pcmcia: adjust_ and release_resources only for
non-statically mapped sockets
Dominik Brodowski
linux at dominikbrodowski.de
Fri Dec 17 05:09:50 EST 2004
re-direct calls to adjust_resource_info for MEM and IO.
Signed-off-by: Dominik Brodowski <linux at brodo.de>
---
drivers/pcmcia/rsrc_mgr.c | 34 +++++++++++++++++++++++++---------
include/pcmcia/ss.h | 3 +++
2 files changed, 28 insertions(+), 9 deletions(-)
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:07.648441464 +0100
+++ 2.6.10-rc3/drivers/pcmcia/rsrc_mgr.c 2004-12-05 10:26:07.808417144 +0100
@@ -940,6 +940,17 @@
/*====================================================================*/
+static int nonstatic_adjust_resource_info(struct pcmcia_socket *s, adjust_t *adj)
+{
+ switch (adj->Resource) {
+ case RES_MEMORY_RANGE:
+ return adjust_memory(s, adj);
+ case RES_IO_RANGE:
+ return adjust_io(s, adj);
+ }
+ return CS_UNSUPPORTED_FUNCTION;
+}
+
int pcmcia_adjust_resource_info(adjust_t *adj)
{
struct pcmcia_socket *s;
@@ -950,14 +961,8 @@
down_read(&pcmcia_socket_list_rwsem);
list_for_each_entry(s, &pcmcia_socket_list, socket_list) {
- switch (adj->Resource) {
- case RES_MEMORY_RANGE:
- ret = adjust_memory(s, adj);
- break;
- case RES_IO_RANGE:
- ret = adjust_io(s, adj);
- break;
- }
+ if (s->resource_ops->adjust_resource)
+ ret = s->resource_ops->adjust_resource(s, adj);
}
up_read(&pcmcia_socket_list_rwsem);
@@ -967,7 +972,7 @@
/*====================================================================*/
-void release_resource_db(struct pcmcia_socket *s)
+static void nonstatic_release_resource_db(struct pcmcia_socket *s)
{
resource_map_t *p, *q;
@@ -982,6 +987,7 @@
}
+
void pcmcia_validate_mem(struct pcmcia_socket *s)
{
if (s->resource_ops->validate_mem)
@@ -1013,12 +1019,20 @@
return NULL;
}
+void release_resource_db(struct pcmcia_socket *s)
+{
+ if (s->resource_ops->exit)
+ s->resource_ops->exit(s);
+}
+
struct pccard_resource_ops pccard_static_ops = {
.validate_mem = NULL,
.adjust_io_region = NULL,
.find_io = NULL,
.find_mem = NULL,
+ .adjust_resource = NULL,
+ .exit = NULL,
};
struct pccard_resource_ops pccard_nonstatic_ops = {
@@ -1026,4 +1040,6 @@
.adjust_io_region = nonstatic_adjust_io_region,
.find_io = nonstatic_find_io_region,
.find_mem = nonstatic_find_mem_region,
+ .adjust_resource = nonstatic_adjust_resource_info,
+ .exit = nonstatic_release_resource_db,
};
Index: 2.6.10-rc3/include/pcmcia/ss.h
===================================================================
--- 2.6.10-rc3.orig/include/pcmcia/ss.h 2004-12-05 10:26:07.649441312 +0100
+++ 2.6.10-rc3/include/pcmcia/ss.h 2004-12-05 10:26:07.809416992 +0100
@@ -127,6 +127,9 @@
struct resource* (*find_mem) (unsigned long base, unsigned long num,
unsigned long align, int low,
struct pcmcia_socket *s);
+ int (*adjust_resource) (struct pcmcia_socket *s,
+ adjust_t *adj);
+ void (*exit) (struct pcmcia_socket *s);
};
/*
More information about the linux-pcmcia
mailing list