Unify the pcmcia_bind_mtd and bind_mtd functions. drivers/pcmcia/ds.c | 73 ++++++++++++---------------------------------------- include/pcmcia/cs.h | 7 ---- 2 files changed, 18 insertions(+), 62 deletions(-) diff -ruN linux-original/drivers/pcmcia/ds.c linux/drivers/pcmcia/ds.c --- linux-original/drivers/pcmcia/ds.c 2004-05-16 17:43:44.931527688 +0200 +++ linux/drivers/pcmcia/ds.c 2004-05-16 17:43:49.154885640 +0200 @@ -173,46 +173,6 @@ return CS_SUCCESS; } /* bind_device */ - -/*====================================================================== - - Bind_mtd() associates a device driver with a particular memory - region. It is normally called by Driver Services after it has - identified a memory device type. An instance of the corresponding - driver will then be able to register to control this region. - -======================================================================*/ - -static int pcmcia_bind_mtd(mtd_bind_t *req) -{ - struct pcmcia_socket *s; - memory_handle_t region; - - s = req->Socket; - if (!s) - return CS_BAD_SOCKET; - - if (req->Attributes & REGION_TYPE_AM) - region = s->a_region; - else - region = s->c_region; - - while (region) { - if (region->info.CardOffset == req->CardOffset) - break; - region = region->info.next; - } - if (!region || (region->mtd != NULL)) - return CS_BAD_OFFSET; - strlcpy(region->dev_info, (char *)req->dev_info, DEV_NAME_LEN); - - ds_dbg(1, "%s: bind_mtd: attr 0x%x, offset 0x%x, dev %s\n", - cs_socket_name(s), req->Attributes, req->CardOffset, - (char *)req->dev_info); - return CS_SUCCESS; -} /* bind_mtd */ - - /* String tables for error messages */ typedef struct lookup_t { @@ -547,22 +507,25 @@ static int bind_mtd(struct pcmcia_bus_socket *bus_sock, mtd_info_t *mtd_info) { - mtd_bind_t bind_req; - int ret; + struct pcmcia_socket *s = bus_sock->parent; + memory_handle_t region; - bind_req.dev_info = &mtd_info->dev_info; - bind_req.Attributes = mtd_info->Attributes; - bind_req.Socket = bus_sock->parent; - bind_req.CardOffset = mtd_info->CardOffset; - ret = pcmcia_bind_mtd(&bind_req); - if (ret != CS_SUCCESS) { - cs_error(NULL, BindMTD, ret); - printk(KERN_NOTICE "ds: unable to bind MTD '%s' to socket %d" - " offset 0x%x\n", - (char *)bind_req.dev_info, bus_sock->parent->sock, bind_req.CardOffset); - return -ENODEV; - } - return 0; + if (mtd_info->Attributes & REGION_TYPE_AM) + region = s->a_region; + else + region = s->c_region; + + while (region) { + if (region->info.CardOffset == mtd_info->CardOffset) + break; + region = region->info.next; + } + if (!region || (region->mtd != NULL)) + return -ENODEV; + + strlcpy(region->dev_info, mtd_info->dev_info, DEV_NAME_LEN); + + return 0; } /* bind_mtd */ /*====================================================================== diff -ruN linux-original/include/pcmcia/cs.h linux/include/pcmcia/cs.h --- linux-original/include/pcmcia/cs.h 2004-05-16 17:20:49.000000000 +0200 +++ linux/include/pcmcia/cs.h 2004-05-16 17:43:49.155885488 +0200 @@ -325,13 +325,6 @@ /* Flag to bind to all functions */ #define BIND_FN_ALL 0xff -typedef struct mtd_bind_t { - struct pcmcia_socket *Socket; - u_int Attributes; - u_int CardOffset; - dev_info_t *dev_info; -} mtd_bind_t; - /* Events */ #define CS_EVENT_PRI_LOW 0 #define CS_EVENT_PRI_HIGH 1