[RFC][3/5] move pcmcia_bind_mtd

Dominik Brodowski linux at brodo.de
Sat Nov 22 11:34:57 GMT 2003


pcmcia_bind_mtd 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 |   40 +---------------------------------------
 drivers/pcmcia/ds.c |   38 ++++++++++++++++++++++++++++++++++++++
 include/pcmcia/cs.h |    1 -
 3 files changed, 39 insertions(+), 40 deletions(-)

diff -ruN linux-original/drivers/pcmcia/cs.c linux/drivers/pcmcia/cs.c
--- linux-original/drivers/pcmcia/cs.c	2003-11-22 09:47:49.454279760 +0100
+++ linux/drivers/pcmcia/cs.c	2003-11-22 09:52:09.077810984 +0100
@@ -980,42 +980,6 @@
 } /* access_configuration_register */
 
 
-/*======================================================================
-
-    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.
-    
-======================================================================*/
-
-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);
-    
-    DEBUG(1, "cs: bind_mtd(): attr 0x%x, offset 0x%x, dev %s\n",
-	  req->Attributes, req->CardOffset, (char *)req->dev_info);
-    return CS_SUCCESS;
-} /* bind_mtd */
-
 /*====================================================================*/
 
 int pcmcia_deregister_client(client_handle_t handle)
@@ -2374,9 +2338,8 @@
     case WriteMemory:
 	return pcmcia_write_memory(a1, a2, a3); break;
     case BindDevice:
-	return -ENOSYS; break;
     case BindMTD:
-	return pcmcia_bind_mtd(a1); break;
+	return -ENOSYS; break;
     case ReportError:
 	return pcmcia_report_error(a1, a2); break;
     case SuspendCard:
@@ -2409,7 +2372,6 @@
 /* in alpha order */
 EXPORT_SYMBOL(pcmcia_access_configuration_register);
 EXPORT_SYMBOL(pcmcia_adjust_resource_info);
-EXPORT_SYMBOL(pcmcia_bind_mtd);
 EXPORT_SYMBOL(pcmcia_check_erase_queue);
 EXPORT_SYMBOL(pcmcia_close_memory);
 EXPORT_SYMBOL(pcmcia_copy_memory);
diff -ruN linux-original/drivers/pcmcia/ds.c linux/drivers/pcmcia/ds.c
--- linux-original/drivers/pcmcia/ds.c	2003-11-22 09:47:49.493273832 +0100
+++ linux/drivers/pcmcia/ds.c	2003-11-22 09:52:09.060813568 +0100
@@ -172,6 +172,44 @@
 } /* 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);
+
+	DEBUG(1, "cs: bind_mtd(): attr 0x%x, offset 0x%x, dev %s\n",
+	      req->Attributes, req->CardOffset, (char *)req->dev_info);
+	return CS_SUCCESS;
+} /* bind_mtd */
+
+
 /* end of code which was in cs.c before */
 
 /*======================================================================*/
diff -ruN linux-original/include/pcmcia/cs.h linux/include/pcmcia/cs.h
--- linux-original/include/pcmcia/cs.h	2003-11-22 09:47:49.494273680 +0100
+++ linux/include/pcmcia/cs.h	2003-11-22 09:52:09.079810680 +0100
@@ -428,7 +428,6 @@
 #endif
 
 int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg);
-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);
 int pcmcia_get_card_services_info(servinfo_t *info);



More information about the linux-pcmcia mailing list