提交 2bc5a9bd 编写于 作者: D Dominik Brodowski 提交者: Linus Torvalds

[PATCH] pcmcia: reduce client_handle_t usage

Reduce the occurences of "client_handle_t" which is nothing else than a
pointer to struct pcmcia_device by now.
Signed-off-by: NDominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 e12a9a93
...@@ -158,17 +158,15 @@ static const lookup_t service_table[] = { ...@@ -158,17 +158,15 @@ static const lookup_t service_table[] = {
}; };
static int pcmcia_report_error(client_handle_t handle, error_info_t *err) static int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err)
{ {
int i; int i;
char *serv; char *serv;
if (!handle) if (!p_dev)
printk(KERN_NOTICE); printk(KERN_NOTICE);
else { else
struct pcmcia_device *p_dev = handle_to_pdev(handle);
printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id); printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id);
}
for (i = 0; i < ARRAY_SIZE(service_table); i++) for (i = 0; i < ARRAY_SIZE(service_table); i++)
if (service_table[i].key == err->func) if (service_table[i].key == err->func)
...@@ -193,10 +191,10 @@ static int pcmcia_report_error(client_handle_t handle, error_info_t *err) ...@@ -193,10 +191,10 @@ static int pcmcia_report_error(client_handle_t handle, error_info_t *err)
/*======================================================================*/ /*======================================================================*/
void cs_error(client_handle_t handle, int func, int ret) void cs_error(struct pcmcia_device *p_dev, int func, int ret)
{ {
error_info_t err = { func, ret }; error_info_t err = { func, ret };
pcmcia_report_error(handle, &err); pcmcia_report_error(p_dev, &err);
} }
EXPORT_SYMBOL(cs_error); EXPORT_SYMBOL(cs_error);
...@@ -574,8 +572,6 @@ static int pcmcia_card_add(struct pcmcia_socket *s) ...@@ -574,8 +572,6 @@ static int pcmcia_card_add(struct pcmcia_socket *s)
else else
no_funcs = 1; no_funcs = 1;
/* this doesn't handle multifunction devices on one pcmcia function
* yet. */
for (i=0; i < no_funcs; i++) for (i=0; i < no_funcs; i++)
pcmcia_device_add(s, i); pcmcia_device_add(s, i);
...@@ -994,9 +990,8 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) ...@@ -994,9 +990,8 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) int pcmcia_register_client(struct pcmcia_device **handle, client_reg_t *req)
{ {
struct pcmcia_device *client = NULL;
struct pcmcia_socket *s = NULL; struct pcmcia_socket *s = NULL;
struct pcmcia_device *p_dev = NULL; struct pcmcia_device *p_dev = NULL;
struct pcmcia_driver *p_drv = NULL; struct pcmcia_driver *p_drv = NULL;
...@@ -1024,7 +1019,6 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) ...@@ -1024,7 +1019,6 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
} }
p_drv = to_pcmcia_drv(p_dev->dev.driver); p_drv = to_pcmcia_drv(p_dev->dev.driver);
if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) { if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) {
client = p_dev;
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
goto found; goto found;
} }
...@@ -1035,7 +1029,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) ...@@ -1035,7 +1029,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
} }
found: found:
up_read(&pcmcia_socket_list_rwsem); up_read(&pcmcia_socket_list_rwsem);
if (!p_dev || !client) if (!p_dev)
return -ENODEV; return -ENODEV;
pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */ pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */
...@@ -1046,12 +1040,9 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) ...@@ -1046,12 +1040,9 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
p_dev->event_callback_args.client_handle = p_dev; p_dev->event_callback_args.client_handle = p_dev;
if (s->state & SOCKET_CARDBUS) if (!s->functions) {
client->state |= CLIENT_CARDBUS;
if ((!(s->state & SOCKET_CARDBUS)) && (s->functions == 0)) {
cistpl_longlink_mfc_t mfc; cistpl_longlink_mfc_t mfc;
if (pccard_read_tuple(s, client->func, CISTPL_LONGLINK_MFC, &mfc) if (pccard_read_tuple(s, p_dev->func, CISTPL_LONGLINK_MFC, &mfc)
== CS_SUCCESS) == CS_SUCCESS)
s->functions = mfc.nfn; s->functions = mfc.nfn;
else else
...@@ -1064,7 +1055,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) ...@@ -1064,7 +1055,7 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
} }
ds_dbg(1, "register_client(): client 0x%p, dev %s\n", ds_dbg(1, "register_client(): client 0x%p, dev %s\n",
client, p_dev->dev.bus_id); p_dev, p_dev->dev.bus_id);
if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) { if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) {
if (p_drv->event) if (p_drv->event)
...@@ -1112,26 +1103,25 @@ static int unbind_request(struct pcmcia_socket *s) ...@@ -1112,26 +1103,25 @@ static int unbind_request(struct pcmcia_socket *s)
return 0; return 0;
} /* unbind_request */ } /* unbind_request */
int pcmcia_deregister_client(client_handle_t handle) int pcmcia_deregister_client(struct pcmcia_device *p_dev)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s;
int i; int i;
struct pcmcia_device *p_dev = handle_to_pdev(handle);
s = SOCKET(handle); s = p_dev->socket;
ds_dbg(1, "deregister_client(%p)\n", handle); ds_dbg(1, "deregister_client(%p)\n", p_dev);
if (handle->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED)) if (p_dev->state & (CLIENT_IRQ_REQ|CLIENT_IO_REQ|CLIENT_CONFIG_LOCKED))
goto warn_out; goto warn_out;
for (i = 0; i < MAX_WIN; i++) for (i = 0; i < MAX_WIN; i++)
if (handle->state & CLIENT_WIN_REQ(i)) if (p_dev->state & CLIENT_WIN_REQ(i))
goto warn_out; goto warn_out;
if (handle->state & CLIENT_STALE) { if (p_dev->state & CLIENT_STALE) {
handle->state &= ~CLIENT_STALE; p_dev->state &= ~CLIENT_STALE;
pcmcia_put_dev(p_dev); pcmcia_put_dev(p_dev);
} else { } else {
handle->state = CLIENT_UNBOUND; p_dev->state = CLIENT_UNBOUND;
} }
return CS_SUCCESS; return CS_SUCCESS;
......
...@@ -28,53 +28,39 @@ ...@@ -28,53 +28,39 @@
#include "cs_internal.h" #include "cs_internal.h"
int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple) int pcmcia_get_first_tuple(struct pcmcia_device *p_dev, tuple_t *tuple)
{ {
struct pcmcia_socket *s; return pccard_get_first_tuple(p_dev->socket, p_dev->func, tuple);
s = SOCKET(handle);
return pccard_get_first_tuple(s, handle->func, tuple);
} }
EXPORT_SYMBOL(pcmcia_get_first_tuple); EXPORT_SYMBOL(pcmcia_get_first_tuple);
int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple) int pcmcia_get_next_tuple(struct pcmcia_device *p_dev, tuple_t *tuple)
{ {
struct pcmcia_socket *s; return pccard_get_next_tuple(p_dev->socket, p_dev->func, tuple);
s = SOCKET(handle);
return pccard_get_next_tuple(s, handle->func, tuple);
} }
EXPORT_SYMBOL(pcmcia_get_next_tuple); EXPORT_SYMBOL(pcmcia_get_next_tuple);
int pcmcia_get_tuple_data(client_handle_t handle, tuple_t *tuple) int pcmcia_get_tuple_data(struct pcmcia_device *p_dev, tuple_t *tuple)
{ {
struct pcmcia_socket *s; return pccard_get_tuple_data(p_dev->socket, tuple);
s = SOCKET(handle);
return pccard_get_tuple_data(s, tuple);
} }
EXPORT_SYMBOL(pcmcia_get_tuple_data); EXPORT_SYMBOL(pcmcia_get_tuple_data);
int pcmcia_parse_tuple(client_handle_t handle, tuple_t *tuple, cisparse_t *parse) int pcmcia_parse_tuple(struct pcmcia_device *p_dev, tuple_t *tuple, cisparse_t *parse)
{ {
return pccard_parse_tuple(tuple, parse); return pccard_parse_tuple(tuple, parse);
} }
EXPORT_SYMBOL(pcmcia_parse_tuple); EXPORT_SYMBOL(pcmcia_parse_tuple);
int pcmcia_validate_cis(client_handle_t handle, cisinfo_t *info) int pcmcia_validate_cis(struct pcmcia_device *p_dev, cisinfo_t *info)
{ {
struct pcmcia_socket *s; return pccard_validate_cis(p_dev->socket, p_dev->func, info);
s = SOCKET(handle);
return pccard_validate_cis(s, handle->func, info);
} }
EXPORT_SYMBOL(pcmcia_validate_cis); EXPORT_SYMBOL(pcmcia_validate_cis);
int pcmcia_reset_card(client_handle_t handle, client_req_t *req) int pcmcia_reset_card(struct pcmcia_device *p_dev, client_req_t *req)
{ {
struct pcmcia_socket *skt; return pccard_reset_card(p_dev->socket);
skt = SOCKET(handle);
if (!skt)
return CS_BAD_HANDLE;
return pccard_reset_card(skt);
} }
EXPORT_SYMBOL(pcmcia_reset_card); EXPORT_SYMBOL(pcmcia_reset_card);
...@@ -202,12 +202,11 @@ int pccard_access_configuration_register(struct pcmcia_socket *s, ...@@ -202,12 +202,11 @@ int pccard_access_configuration_register(struct pcmcia_socket *s,
return CS_SUCCESS; return CS_SUCCESS;
} /* pccard_access_configuration_register */ } /* pccard_access_configuration_register */
int pcmcia_access_configuration_register(client_handle_t handle, int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
conf_reg_t *reg) conf_reg_t *reg)
{ {
struct pcmcia_socket *s; return pccard_access_configuration_register(p_dev->socket,
s = SOCKET(handle); p_dev->func, reg);
return pccard_access_configuration_register(s, handle->func, reg);
} }
EXPORT_SYMBOL(pcmcia_access_configuration_register); EXPORT_SYMBOL(pcmcia_access_configuration_register);
...@@ -269,17 +268,11 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, ...@@ -269,17 +268,11 @@ int pccard_get_configuration_info(struct pcmcia_socket *s,
return CS_SUCCESS; return CS_SUCCESS;
} /* pccard_get_configuration_info */ } /* pccard_get_configuration_info */
int pcmcia_get_configuration_info(client_handle_t handle, int pcmcia_get_configuration_info(struct pcmcia_device *p_dev,
config_info_t *config) config_info_t *config)
{ {
struct pcmcia_socket *s; return pccard_get_configuration_info(p_dev->socket, p_dev->func,
config);
if (!config)
return CS_BAD_HANDLE;
s = SOCKET(handle);
if (!s)
return CS_BAD_HANDLE;
return pccard_get_configuration_info(s, handle->func, config);
} }
EXPORT_SYMBOL(pcmcia_get_configuration_info); EXPORT_SYMBOL(pcmcia_get_configuration_info);
...@@ -422,14 +415,14 @@ EXPORT_SYMBOL(pcmcia_map_mem_page); ...@@ -422,14 +415,14 @@ EXPORT_SYMBOL(pcmcia_map_mem_page);
* *
* Modify a locked socket configuration * Modify a locked socket configuration
*/ */
int pcmcia_modify_configuration(client_handle_t handle, int pcmcia_modify_configuration(struct pcmcia_device *p_dev,
modconf_t *mod) modconf_t *mod)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s;
config_t *c; config_t *c;
s = SOCKET(handle); s = p_dev->socket;
c = CONFIG(handle); c = CONFIG(p_dev);
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD; return CS_NO_CARD;
if (!(c->state & CONFIG_LOCKED)) if (!(c->state & CONFIG_LOCKED))
...@@ -466,24 +459,18 @@ int pcmcia_modify_configuration(client_handle_t handle, ...@@ -466,24 +459,18 @@ int pcmcia_modify_configuration(client_handle_t handle,
EXPORT_SYMBOL(pcmcia_modify_configuration); EXPORT_SYMBOL(pcmcia_modify_configuration);
int pcmcia_release_configuration(client_handle_t handle) int pcmcia_release_configuration(struct pcmcia_device *p_dev)
{ {
pccard_io_map io = { 0, 0, 0, 0, 1 }; pccard_io_map io = { 0, 0, 0, 0, 1 };
struct pcmcia_socket *s; struct pcmcia_socket *s = p_dev->socket;
int i; int i;
if (!(handle->state & CLIENT_CONFIG_LOCKED)) if (!(p_dev->state & CLIENT_CONFIG_LOCKED))
return CS_BAD_HANDLE; return CS_BAD_HANDLE;
handle->state &= ~CLIENT_CONFIG_LOCKED; p_dev->state &= ~CLIENT_CONFIG_LOCKED;
s = SOCKET(handle);
#ifdef CONFIG_CARDBUS if (!(p_dev->state & CLIENT_STALE)) {
if (handle->state & CLIENT_CARDBUS) config_t *c = CONFIG(p_dev);
return CS_SUCCESS;
#endif
if (!(handle->state & CLIENT_STALE)) {
config_t *c = CONFIG(handle);
if (--(s->lock_count) == 0) { if (--(s->lock_count) == 0) {
s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */
s->socket.Vpp = 0; s->socket.Vpp = 0;
...@@ -516,22 +503,16 @@ EXPORT_SYMBOL(pcmcia_release_configuration); ...@@ -516,22 +503,16 @@ EXPORT_SYMBOL(pcmcia_release_configuration);
* don't bother checking the port ranges against the current socket * don't bother checking the port ranges against the current socket
* values. * values.
*/ */
int pcmcia_release_io(client_handle_t handle, io_req_t *req) int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s = p_dev->socket;
if (!(handle->state & CLIENT_IO_REQ)) if (!(p_dev->state & CLIENT_IO_REQ))
return CS_BAD_HANDLE; return CS_BAD_HANDLE;
handle->state &= ~CLIENT_IO_REQ; p_dev->state &= ~CLIENT_IO_REQ;
s = SOCKET(handle);
#ifdef CONFIG_CARDBUS
if (handle->state & CLIENT_CARDBUS)
return CS_SUCCESS;
#endif
if (!(handle->state & CLIENT_STALE)) { if (!(p_dev->state & CLIENT_STALE)) {
config_t *c = CONFIG(handle); config_t *c = CONFIG(p_dev);
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED)
return CS_CONFIGURATION_LOCKED; return CS_CONFIGURATION_LOCKED;
if ((c->io.BasePort1 != req->BasePort1) || if ((c->io.BasePort1 != req->BasePort1) ||
...@@ -551,16 +532,15 @@ int pcmcia_release_io(client_handle_t handle, io_req_t *req) ...@@ -551,16 +532,15 @@ int pcmcia_release_io(client_handle_t handle, io_req_t *req)
EXPORT_SYMBOL(pcmcia_release_io); EXPORT_SYMBOL(pcmcia_release_io);
int pcmcia_release_irq(client_handle_t handle, irq_req_t *req) int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s = p_dev->socket;
if (!(handle->state & CLIENT_IRQ_REQ)) if (!(p_dev->state & CLIENT_IRQ_REQ))
return CS_BAD_HANDLE; return CS_BAD_HANDLE;
handle->state &= ~CLIENT_IRQ_REQ; p_dev->state &= ~CLIENT_IRQ_REQ;
s = SOCKET(handle);
if (!(handle->state & CLIENT_STALE)) { if (!(p_dev->state & CLIENT_STALE)) {
config_t *c = CONFIG(handle); config_t *c = CONFIG(p_dev);
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED)
return CS_CONFIGURATION_LOCKED; return CS_CONFIGURATION_LOCKED;
if (c->irq.Attributes != req->Attributes) if (c->irq.Attributes != req->Attributes)
...@@ -616,27 +596,21 @@ int pcmcia_release_window(window_handle_t win) ...@@ -616,27 +596,21 @@ int pcmcia_release_window(window_handle_t win)
EXPORT_SYMBOL(pcmcia_release_window); EXPORT_SYMBOL(pcmcia_release_window);
int pcmcia_request_configuration(client_handle_t handle, int pcmcia_request_configuration(struct pcmcia_device *p_dev,
config_req_t *req) config_req_t *req)
{ {
int i; int i;
u_int base; u_int base;
struct pcmcia_socket *s; struct pcmcia_socket *s = p_dev->socket;
config_t *c; config_t *c;
pccard_io_map iomap; pccard_io_map iomap;
s = SOCKET(handle);
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD; return CS_NO_CARD;
#ifdef CONFIG_CARDBUS
if (handle->state & CLIENT_CARDBUS)
return CS_UNSUPPORTED_MODE;
#endif
if (req->IntType & INT_CARDBUS) if (req->IntType & INT_CARDBUS)
return CS_UNSUPPORTED_MODE; return CS_UNSUPPORTED_MODE;
c = CONFIG(handle); c = CONFIG(p_dev);
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED)
return CS_CONFIGURATION_LOCKED; return CS_CONFIGURATION_LOCKED;
...@@ -737,7 +711,7 @@ int pcmcia_request_configuration(client_handle_t handle, ...@@ -737,7 +711,7 @@ int pcmcia_request_configuration(client_handle_t handle,
} }
c->state |= CONFIG_LOCKED; c->state |= CONFIG_LOCKED;
handle->state |= CLIENT_CONFIG_LOCKED; p_dev->state |= CLIENT_CONFIG_LOCKED;
return CS_SUCCESS; return CS_SUCCESS;
} /* pcmcia_request_configuration */ } /* pcmcia_request_configuration */
EXPORT_SYMBOL(pcmcia_request_configuration); EXPORT_SYMBOL(pcmcia_request_configuration);
...@@ -748,27 +722,17 @@ EXPORT_SYMBOL(pcmcia_request_configuration); ...@@ -748,27 +722,17 @@ EXPORT_SYMBOL(pcmcia_request_configuration);
* Request_io() reserves ranges of port addresses for a socket. * Request_io() reserves ranges of port addresses for a socket.
* I have not implemented range sharing or alias addressing. * I have not implemented range sharing or alias addressing.
*/ */
int pcmcia_request_io(client_handle_t handle, io_req_t *req) int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s = p_dev->socket;
config_t *c; config_t *c;
s = SOCKET(handle);
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD; return CS_NO_CARD;
if (handle->state & CLIENT_CARDBUS) {
#ifdef CONFIG_CARDBUS
handle->state |= CLIENT_IO_REQ;
return CS_SUCCESS;
#else
return CS_UNSUPPORTED_FUNCTION;
#endif
}
if (!req) if (!req)
return CS_UNSUPPORTED_MODE; return CS_UNSUPPORTED_MODE;
c = CONFIG(handle); c = CONFIG(p_dev);
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED)
return CS_CONFIGURATION_LOCKED; return CS_CONFIGURATION_LOCKED;
if (c->state & CONFIG_IO_REQ) if (c->state & CONFIG_IO_REQ)
...@@ -793,7 +757,7 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req) ...@@ -793,7 +757,7 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req)
c->io = *req; c->io = *req;
c->state |= CONFIG_IO_REQ; c->state |= CONFIG_IO_REQ;
handle->state |= CLIENT_IO_REQ; p_dev->state |= CLIENT_IO_REQ;
return CS_SUCCESS; return CS_SUCCESS;
} /* pcmcia_request_io */ } /* pcmcia_request_io */
EXPORT_SYMBOL(pcmcia_request_io); EXPORT_SYMBOL(pcmcia_request_io);
...@@ -816,17 +780,15 @@ static irqreturn_t test_action(int cpl, void *dev_id, struct pt_regs *regs) ...@@ -816,17 +780,15 @@ static irqreturn_t test_action(int cpl, void *dev_id, struct pt_regs *regs)
} }
#endif #endif
int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s = p_dev->socket;
config_t *c; config_t *c;
int ret = CS_IN_USE, irq = 0; int ret = CS_IN_USE, irq = 0;
struct pcmcia_device *p_dev = handle_to_pdev(handle);
s = SOCKET(handle);
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD; return CS_NO_CARD;
c = CONFIG(handle); c = CONFIG(p_dev);
if (c->state & CONFIG_LOCKED) if (c->state & CONFIG_LOCKED)
return CS_CONFIGURATION_LOCKED; return CS_CONFIGURATION_LOCKED;
if (c->state & CONFIG_IRQ_REQ) if (c->state & CONFIG_IRQ_REQ)
...@@ -890,7 +852,7 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) ...@@ -890,7 +852,7 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
s->irq.Config++; s->irq.Config++;
c->state |= CONFIG_IRQ_REQ; c->state |= CONFIG_IRQ_REQ;
handle->state |= CLIENT_IRQ_REQ; p_dev->state |= CLIENT_IRQ_REQ;
#ifdef CONFIG_PCMCIA_PROBE #ifdef CONFIG_PCMCIA_PROBE
pcmcia_used_irq[irq]++; pcmcia_used_irq[irq]++;
...@@ -906,14 +868,13 @@ EXPORT_SYMBOL(pcmcia_request_irq); ...@@ -906,14 +868,13 @@ EXPORT_SYMBOL(pcmcia_request_irq);
* Request_window() establishes a mapping between card memory space * Request_window() establishes a mapping between card memory space
* and system memory space. * and system memory space.
*/ */
int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh) int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh)
{ {
struct pcmcia_socket *s; struct pcmcia_socket *s = (*p_dev)->socket;
window_t *win; window_t *win;
u_long align; u_long align;
int w; int w;
s = (*handle)->socket;
if (!(s->state & SOCKET_PRESENT)) if (!(s->state & SOCKET_PRESENT))
return CS_NO_CARD; return CS_NO_CARD;
if (req->Attributes & (WIN_PAGED | WIN_SHARED)) if (req->Attributes & (WIN_PAGED | WIN_SHARED))
...@@ -942,7 +903,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle ...@@ -942,7 +903,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
win = &s->win[w]; win = &s->win[w];
win->magic = WINDOW_MAGIC; win->magic = WINDOW_MAGIC;
win->index = w; win->index = w;
win->handle = *handle; win->handle = *p_dev;
win->sock = s; win->sock = s;
if (!(s->features & SS_CAP_STATIC_MAP)) { if (!(s->features & SS_CAP_STATIC_MAP)) {
...@@ -951,7 +912,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle ...@@ -951,7 +912,7 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
if (!win->ctl.res) if (!win->ctl.res)
return CS_IN_USE; return CS_IN_USE;
} }
(*handle)->state |= CLIENT_WIN_REQ(w); (*p_dev)->state |= CLIENT_WIN_REQ(w);
/* Configure the socket controller */ /* Configure the socket controller */
win->ctl.map = w+1; win->ctl.map = w+1;
......
...@@ -77,12 +77,8 @@ typedef struct servinfo_t { ...@@ -77,12 +77,8 @@ typedef struct servinfo_t {
} servinfo_t; } servinfo_t;
typedef struct event_callback_args_t { typedef struct event_callback_args_t {
client_handle_t client_handle; struct pcmcia_device *client_handle;
void *info; void *client_data;
void *mtdrequest;
void *buffer;
void *misc;
void *client_data;
} event_callback_args_t; } event_callback_args_t;
/* for GetConfigurationInfo */ /* for GetConfigurationInfo */
...@@ -393,25 +389,25 @@ enum service { ...@@ -393,25 +389,25 @@ enum service {
struct pcmcia_socket; struct pcmcia_socket;
int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg); int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
int pcmcia_deregister_client(client_handle_t handle); int pcmcia_deregister_client(struct pcmcia_device *p_dev);
int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config); int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config);
int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
int pcmcia_get_status(client_handle_t handle, cs_status_t *status); int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status);
int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod); int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
int pcmcia_register_client(client_handle_t *handle, client_reg_t *req); int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
int pcmcia_release_configuration(client_handle_t handle); int pcmcia_release_configuration(struct pcmcia_device *p_dev);
int pcmcia_release_io(client_handle_t handle, io_req_t *req); int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req);
int pcmcia_release_irq(client_handle_t handle, irq_req_t *req); int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req);
int pcmcia_release_window(window_handle_t win); int pcmcia_release_window(window_handle_t win);
int pcmcia_request_configuration(client_handle_t handle, config_req_t *req); int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req);
int pcmcia_request_io(client_handle_t handle, io_req_t *req); int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
int pcmcia_request_irq(client_handle_t handle, irq_req_t *req); int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh); int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh);
int pcmcia_reset_card(client_handle_t handle, client_req_t *req); int pcmcia_reset_card(struct pcmcia_device *p_dev, client_req_t *req);
int pcmcia_suspend_card(struct pcmcia_socket *skt); int pcmcia_suspend_card(struct pcmcia_socket *skt);
int pcmcia_resume_card(struct pcmcia_socket *skt); int pcmcia_resume_card(struct pcmcia_socket *skt);
int pcmcia_eject_card(struct pcmcia_socket *skt); int pcmcia_eject_card(struct pcmcia_socket *skt);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册