[RFC][2/5] move pcmcia_bind_device
Dominik Brodowski
linux at brodo.de
Sat Nov 22 11:34:41 GMT 2003
pcmcia_bind_device was only used by ds.c, and it is only used for 16-bit
PCMCIA devices. So, move it to ds.c.
drivers/pcmcia/cs.c | 38 +-------------------------------------
drivers/pcmcia/ds.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
include/pcmcia/cs.h | 1 -
3 files changed, 45 insertions(+), 38 deletions(-)
diff -ruN linux-original/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c
--- linux-original/drivers/pcmcia/cs.c 2003-11-20 20:21:24.000000000 +0100
+++ linux/drivers/pcmcia/cs.c 2003-11-22 09:45:45.708092040 +0100
@@ -979,41 +979,6 @@
return CS_SUCCESS;
} /* access_configuration_register */
-/*======================================================================
-
- Bind_device() associates a device driver with a particular socket.
- It is normally called by Driver Services after it has identified
- a newly inserted card. An instance of that driver will then be
- eligible to register as a client of this socket.
-
-======================================================================*/
-
-int pcmcia_bind_device(bind_req_t *req)
-{
- client_t *client;
- struct pcmcia_socket *s;
-
- s = req->Socket;
- if (!s)
- return CS_BAD_SOCKET;
-
- client = (client_t *)kmalloc(sizeof(client_t), GFP_KERNEL);
- if (!client) return CS_OUT_OF_RESOURCE;
- memset(client, '\0', sizeof(client_t));
- client->client_magic = CLIENT_MAGIC;
- strlcpy(client->dev_info, (char *)req->dev_info, DEV_NAME_LEN);
- client->Socket = s;
- client->Function = req->Function;
- client->state = CLIENT_UNBOUND;
- client->erase_busy.next = &client->erase_busy;
- client->erase_busy.prev = &client->erase_busy;
- init_waitqueue_head(&client->mtd_req);
- client->next = s->clients;
- s->clients = client;
- DEBUG(1, "cs: bind_device(): client 0x%p, sock %p, dev %s\n",
- client, client->Socket, client->dev_info);
- return CS_SUCCESS;
-} /* bind_device */
/*======================================================================
@@ -2409,7 +2374,7 @@
case WriteMemory:
return pcmcia_write_memory(a1, a2, a3); break;
case BindDevice:
- return pcmcia_bind_device(a1); break;
+ return -ENOSYS; break;
case BindMTD:
return pcmcia_bind_mtd(a1); break;
case ReportError:
@@ -2444,7 +2409,6 @@
/* in alpha order */
EXPORT_SYMBOL(pcmcia_access_configuration_register);
EXPORT_SYMBOL(pcmcia_adjust_resource_info);
-EXPORT_SYMBOL(pcmcia_bind_device);
EXPORT_SYMBOL(pcmcia_bind_mtd);
EXPORT_SYMBOL(pcmcia_check_erase_queue);
EXPORT_SYMBOL(pcmcia_close_memory);
diff -ruN linux-original/drivers/pcmcia/ds.c linux/drivers/pcmcia/ds.c
--- linux-original/drivers/pcmcia/ds.c 2003-11-22 09:46:08.927562144 +0100
+++ linux/drivers/pcmcia/ds.c 2003-11-22 09:45:45.707092192 +0100
@@ -132,6 +132,50 @@
/*======================================================================*/
+/* code which was in cs.c before */
+
+/*======================================================================
+
+ Bind_device() associates a device driver with a particular socket.
+ It is normally called by Driver Services after it has identified
+ a newly inserted card. An instance of that driver will then be
+ eligible to register as a client of this socket.
+
+======================================================================*/
+
+static int pcmcia_bind_device(bind_req_t *req)
+{
+ client_t *client;
+ struct pcmcia_socket *s;
+
+ s = req->Socket;
+ if (!s)
+ return CS_BAD_SOCKET;
+
+ client = (client_t *) kmalloc(sizeof(client_t), GFP_KERNEL);
+ if (!client)
+ return CS_OUT_OF_RESOURCE;
+ memset(client, '\0', sizeof(client_t));
+ client->client_magic = CLIENT_MAGIC;
+ strlcpy(client->dev_info, (char *)req->dev_info, DEV_NAME_LEN);
+ client->Socket = s;
+ client->Function = req->Function;
+ client->state = CLIENT_UNBOUND;
+ client->erase_busy.next = &client->erase_busy;
+ client->erase_busy.prev = &client->erase_busy;
+ init_waitqueue_head(&client->mtd_req);
+ client->next = s->clients;
+ s->clients = client;
+ DEBUG(1, "cs: bind_device(): client 0x%p, sock %p, dev %s\n",
+ client, client->Socket, client->dev_info);
+ return CS_SUCCESS;
+} /* bind_device */
+
+
+/* end of code which was in cs.c before */
+
+/*======================================================================*/
+
static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info);
static struct pcmcia_bus_socket * get_socket_info_by_nr(unsigned int nr);
diff -ruN linux-original/include/pcmcia/cs.h linux/include/pcmcia/cs.h
--- linux-original/include/pcmcia/cs.h 2003-11-20 20:21:28.000000000 +0100
+++ linux/include/pcmcia/cs.h 2003-11-22 09:45:45.709091888 +0100
@@ -428,7 +428,6 @@
#endif
int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg);
-int pcmcia_bind_device(bind_req_t *req);
int pcmcia_bind_mtd(mtd_bind_t *req);
int pcmcia_deregister_client(client_handle_t handle);
int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config);
More information about the linux-pcmcia
mailing list