Index: 2.6.10/drivers/pcmcia/ds.c =================================================================== --- 2.6.10.orig/drivers/pcmcia/ds.c 2004-12-29 18:39:54.816223523 +0100 +++ 2.6.10/drivers/pcmcia/ds.c 2004-12-29 18:39:59.004609607 +0100 @@ -218,16 +218,15 @@ }; -int pcmcia_report_error(client_handle_t handle, error_info_t *err) +int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err) { int i; char *serv; - if (!handle) + if (!p_dev) printk(KERN_NOTICE); else { - struct pcmcia_device *p_dev = handle_to_pdev(handle); - printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id); + printk(KERN_NOTICE "pcmcia: %s: ", p_dev->dev.bus_id); } for (i = 0; i < ARRAY_SIZE(service_table); i++) @@ -254,10 +253,10 @@ /*======================================================================*/ -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 }; - pcmcia_report_error(handle, &err); + pcmcia_report_error(p_dev, &err); } EXPORT_SYMBOL(cs_error); @@ -629,8 +628,6 @@ else no_funcs = 1; - /* this doesn't handle multifunction devices on one pcmcia function - * yet. */ for (i=0; i < no_funcs; i++) pcmcia_device_add(s->pcmcia, i); @@ -1152,9 +1149,8 @@ } /* bind_request */ -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; struct pcmcia_bus_socket *skt = NULL; struct pcmcia_device *p_dev = NULL; @@ -1186,7 +1182,6 @@ } p_drv = to_pcmcia_drv(p_dev->dev.driver); if (!strncmp(p_drv->drv.name, (char *)req->dev_info, DEV_NAME_LEN)) { - client = p_dev; spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); goto found; } @@ -1197,7 +1192,7 @@ } found: up_read(&pcmcia_socket_list_rwsem); - if (!p_dev || !client) + if (!p_dev) return -ENODEV; pcmcia_put_bus_socket(skt); /* safe, as we already hold a reference from bind_device */ @@ -1206,12 +1201,9 @@ p_dev->event_callback_args = req->event_callback_args; p_dev->event_callback_args.client_handle = p_dev; - if (s->state & SOCKET_CARDBUS) - client->state |= CLIENT_CARDBUS; - - if ((!(s->state & SOCKET_CARDBUS)) && (s->functions == 0)) { + if (!s->functions) { 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) s->functions = mfc.nfn; else @@ -1223,8 +1215,8 @@ memset(s->config, 0, sizeof(config_t) * s->functions); } - ds_dbg(1, "register_client(): client 0x%p, dev %s\n", - client, p_dev->dev.bus_id); + ds_dbg(1, "register_client(): p_dev 0x%p, dev %s\n", + p_dev, p_dev->dev.bus_id); if ((s->state & (SOCKET_PRESENT|SOCKET_CARDBUS)) == SOCKET_PRESENT) { if (p_drv->event) @@ -1374,26 +1366,25 @@ return 0; } /* unbind_request */ -int pcmcia_deregister_client(client_handle_t handle) +int pcmcia_deregister_client(struct pcmcia_device *p_dev) { struct pcmcia_socket *s; int i; - struct pcmcia_device *p_dev = handle_to_pdev(handle); - s = SOCKET(handle); - ds_dbg(1, "deregister_client(%p)\n", handle); + s = p_dev->socket; + 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; 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; - if (handle->state & CLIENT_STALE) { - handle->state &= ~CLIENT_STALE; + if (p_dev->state & CLIENT_STALE) { + p_dev->state &= ~CLIENT_STALE; pcmcia_put_dev(p_dev); } else { - handle->state = CLIENT_UNBOUND; + p_dev->state = CLIENT_UNBOUND; } return CS_SUCCESS; Index: 2.6.10/drivers/pcmcia/pcmcia_compat.c =================================================================== --- 2.6.10.orig/drivers/pcmcia/pcmcia_compat.c 2004-12-29 18:39:05.191497313 +0100 +++ 2.6.10/drivers/pcmcia/pcmcia_compat.c 2004-12-29 18:39:59.004609607 +0100 @@ -28,84 +28,60 @@ #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; - s = SOCKET(handle); - return pccard_get_first_tuple(s, handle->func, tuple); + return pccard_get_first_tuple(p_dev->socket, p_dev->func, 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; - s = SOCKET(handle); - return pccard_get_next_tuple(s, handle->func, tuple); + return pccard_get_next_tuple(p_dev->socket, p_dev->func, 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; - s = SOCKET(handle); - return pccard_get_tuple_data(s, tuple); + return pccard_get_tuple_data(p_dev->socket, tuple); } 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); } 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; - s = SOCKET(handle); - return pccard_validate_cis(s, handle->func, info); + return pccard_validate_cis(p_dev->socket, p_dev->func, info); } EXPORT_SYMBOL(pcmcia_validate_cis); -int pcmcia_get_configuration_info(client_handle_t handle, +int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config) { - struct pcmcia_socket *s; - - if (!config) - return CS_BAD_HANDLE; - s = SOCKET(handle); - if (!s) - return CS_BAD_HANDLE; - return pccard_get_configuration_info(s, handle->func, config); + return pccard_get_configuration_info(p_dev->socket, p_dev->func, config); } EXPORT_SYMBOL(pcmcia_get_configuration_info); -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; - - skt = SOCKET(handle); - if (!skt) - return CS_BAD_HANDLE; - - return pccard_reset_card(skt); + return pccard_reset_card(p_dev->socket); } EXPORT_SYMBOL(pcmcia_reset_card); -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) { - struct pcmcia_socket *s; - s = SOCKET(handle); - return pccard_get_status(s, handle->func, status); + return pccard_get_status(p_dev->socket, p_dev->func, status); } EXPORT_SYMBOL(pcmcia_get_status); -int pcmcia_access_configuration_register(client_handle_t handle, +int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg) { - struct pcmcia_socket *s; - s = SOCKET(handle); - return pccard_access_configuration_register(s, handle->func, reg); + return pccard_access_configuration_register(p_dev->socket, p_dev->func, + reg); } EXPORT_SYMBOL(pcmcia_access_configuration_register); Index: 2.6.10/drivers/pcmcia/pcmcia_resource.c =================================================================== --- 2.6.10.orig/drivers/pcmcia/pcmcia_resource.c 2004-12-29 18:39:05.192497167 +0100 +++ 2.6.10/drivers/pcmcia/pcmcia_resource.c 2004-12-29 18:39:59.009608874 +0100 @@ -312,13 +312,14 @@ /* * 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) { struct pcmcia_socket *s; config_t *c; - s = SOCKET(handle); c = CONFIG(handle); + s = p_dev->socket; + c = CONFIG(p_dev); if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; if (!(c->state & CONFIG_LOCKED)) @@ -355,19 +356,19 @@ 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 }; struct pcmcia_socket *s; int i; - if (!(handle->state & CLIENT_CONFIG_LOCKED)) + if (!(p_dev->state & CLIENT_CONFIG_LOCKED)) return CS_BAD_HANDLE; - handle->state &= ~CLIENT_CONFIG_LOCKED; - s = SOCKET(handle); + p_dev->state &= ~CLIENT_CONFIG_LOCKED; + s = p_dev->socket; - if (!(handle->state & CLIENT_STALE)) { - config_t *c = CONFIG(handle); + if (!(p_dev->state & CLIENT_STALE)) { + config_t *c = CONFIG(p_dev); if (--(s->lock_count) == 0) { s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ s->socket.Vpp = 0; @@ -399,17 +400,17 @@ * don't bother checking the port ranges against the current socket * 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; - if (!(handle->state & CLIENT_IO_REQ)) + if (!(p_dev->state & CLIENT_IO_REQ)) return CS_BAD_HANDLE; - handle->state &= ~CLIENT_IO_REQ; - s = SOCKET(handle); + p_dev->state &= ~CLIENT_IO_REQ; + s = p_dev->socket; - if (!(handle->state & CLIENT_STALE)) { - config_t *c = CONFIG(handle); + if (!(p_dev->state & CLIENT_STALE)) { + config_t *c = CONFIG(p_dev); if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; if ((c->io.BasePort1 != req->BasePort1) || @@ -429,16 +430,16 @@ 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; - if (!(handle->state & CLIENT_IRQ_REQ)) + if (!(p_dev->state & CLIENT_IRQ_REQ)) return CS_BAD_HANDLE; - handle->state &= ~CLIENT_IRQ_REQ; - s = SOCKET(handle); + p_dev->state &= ~CLIENT_IRQ_REQ; + s = SOCKET(p_dev); - if (!(handle->state & CLIENT_STALE)) { - config_t *c = CONFIG(handle); + if (!(p_dev->state & CLIENT_STALE)) { + config_t *c = CONFIG(p_dev); if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; if (c->irq.Attributes != req->Attributes) @@ -490,7 +491,7 @@ 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) { int i; @@ -499,13 +500,13 @@ config_t *c; pccard_io_map iomap; - s = SOCKET(handle); + s = p_dev->socket; if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; if (req->IntType & INT_CARDBUS) return CS_UNSUPPORTED_MODE; - c = CONFIG(handle); + c = CONFIG(p_dev); if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; @@ -606,7 +607,7 @@ } c->state |= CONFIG_LOCKED; - handle->state |= CLIENT_CONFIG_LOCKED; + p_dev->state |= CLIENT_CONFIG_LOCKED; return CS_SUCCESS; } /* request_configuration */ EXPORT_SYMBOL(pcmcia_request_configuration); @@ -616,18 +617,18 @@ * Request_io() reserves ranges of port addresses for a socket. * 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; config_t *c; - s = SOCKET(handle); + s = p_dev->socket; if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; if (!req) return CS_UNSUPPORTED_MODE; - c = CONFIG(handle); + c = CONFIG(p_dev); if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; if (c->state & CONFIG_IO_REQ) @@ -652,7 +653,7 @@ c->io = *req; c->state |= CONFIG_IO_REQ; - handle->state |= CLIENT_IO_REQ; + p_dev->state |= CLIENT_IO_REQ; return CS_SUCCESS; } /* request_io */ EXPORT_SYMBOL(pcmcia_request_io); @@ -674,17 +675,16 @@ } #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; config_t *c; int ret = CS_IN_USE, irq = 0; - struct pcmcia_device *p_dev = handle_to_pdev(handle); - s = SOCKET(handle); + s = p_dev->socket; if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; - c = CONFIG(handle); + c = CONFIG(p_dev); if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; if (c->state & CONFIG_IRQ_REQ) @@ -736,7 +736,7 @@ s->irq.Config++; c->state |= CONFIG_IRQ_REQ; - handle->state |= CLIENT_IRQ_REQ; + p_dev->state |= CLIENT_IRQ_REQ; return CS_SUCCESS; } /* pcmcia_request_irq */ EXPORT_SYMBOL(pcmcia_request_irq); @@ -746,14 +746,14 @@ * Request_window() establishes a mapping between card 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; window_t *win; u_long align; int w; - s = (*handle)->socket; + s = (*p_dev)->socket; if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; if (req->Attributes & (WIN_PAGED | WIN_SHARED)) @@ -783,7 +783,7 @@ win = &s->win[w]; win->magic = WINDOW_MAGIC; win->index = w; - win->handle = *handle; + win->handle = (*p_dev); win->sock = s; if (!(s->features & SS_CAP_STATIC_MAP)) { @@ -792,7 +792,7 @@ if (!win->ctl.res) return CS_IN_USE; } - (*handle)->state |= CLIENT_WIN_REQ(w); + (*p_dev)->state |= CLIENT_WIN_REQ(w); /* Configure the socket controller */ win->ctl.map = w+1; Index: 2.6.10/include/pcmcia/cs.h =================================================================== --- 2.6.10.orig/include/pcmcia/cs.h 2004-12-29 18:38:32.424300195 +0100 +++ 2.6.10/include/pcmcia/cs.h 2004-12-29 18:39:59.024606675 +0100 @@ -77,12 +77,8 @@ } servinfo_t; typedef struct event_callback_args_t { - client_handle_t client_handle; - void *info; - void *mtdrequest; - void *buffer; - void *misc; - void *client_data; + struct pcmcia_device *client_handle; + void *client_data; } event_callback_args_t; /* for GetConfigurationInfo */ @@ -393,31 +389,31 @@ struct pcmcia_socket; -int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg); -int pcmcia_deregister_client(client_handle_t handle); -int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config); +int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); +int pcmcia_deregister_client(struct pcmcia_device *p_dev); +int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); int pcmcia_get_card_services_info(servinfo_t *info); 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_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_map_mem_page(window_handle_t win, memreq_t *req); -int pcmcia_modify_configuration(client_handle_t handle, modconf_t *mod); -int pcmcia_register_client(client_handle_t *handle, client_reg_t *req); -int pcmcia_release_configuration(client_handle_t handle); -int pcmcia_release_io(client_handle_t handle, io_req_t *req); -int pcmcia_release_irq(client_handle_t handle, irq_req_t *req); +int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); +int pcmcia_register_client(struct pcmcia_device **p_dev, client_reg_t *req); +int pcmcia_release_configuration(struct pcmcia_device *p_dev); +int pcmcia_release_io(struct pcmcia_device *p_dev, io_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_request_configuration(client_handle_t handle, config_req_t *req); -int pcmcia_request_io(client_handle_t handle, io_req_t *req); -int pcmcia_request_irq(client_handle_t handle, irq_req_t *req); -int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh); -int pcmcia_reset_card(client_handle_t handle, client_req_t *req); +int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req); +int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); +int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); +int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh); +int pcmcia_reset_card(struct pcmcia_device *p_dev, client_req_t *req); int pcmcia_suspend_card(struct pcmcia_socket *skt); int pcmcia_resume_card(struct pcmcia_socket *skt); int pcmcia_eject_card(struct pcmcia_socket *skt); int pcmcia_insert_card(struct pcmcia_socket *skt); -int pcmcia_report_error(client_handle_t handle, error_info_t *err); +int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err); struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt); void pcmcia_put_socket(struct pcmcia_socket *skt);