Subject: [patch] NEC VRC4173 CARDU

From: Yoichi Yuasa <[email-masked]>
Date: Thu, 4 Sep 2003 01:10:19 +0900

Hello Ralf,

I made a patch for NEC VRC4173 CARDU(PCMCIA Controller).
This patch can be prevented from probing the already used slot.

Please apply this patch.

Yoichi
diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/drivers/pcmcia/vrc4173_cardu.c linux/drivers/pcmcia/vrc4173_cardu.c
--- linux.orig/drivers/pcmcia/vrc4173_cardu.c	Fri Apr 11 11:08:50 2003
+++ linux/drivers/pcmcia/vrc4173_cardu.c	Wed Sep  3 19:47:00 2003
@@ -6,7 +6,7 @@
  * 	NEC VRC4173 CARDU driver for Socket Services
  *	(This device doesn't support CardBus. it is supporting only 16bit PC Card.)
  *
- * Copyright 2002 Yoichi Yuasa <[email-masked]>
+ * Copyright 2002,2003 Yoichi Yuasa <[email-masked]>
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License as published by the
@@ -520,6 +520,9 @@
 
 	slot = vrc4173_cardu_slots++;
 	socket = &cardu_sockets[slot];
+	if (socket->noprobe != 0)
+		return -EBUSY;
+
 	sprintf(socket->name, "NEC VRC4173 CARDU%1d", slot+1);
 
 	if ((err = pci_enable_device(dev)) < 0)
@@ -564,6 +567,36 @@
 
 	return 0;
 }
+
+static int __devinit vrc4173_cardu_setup(char *options)
+{
+	if (options == NULL || *options == '\0')
+		return 0;
+
+	if (strncmp(options, "cardu1:", 7) == 0) {
+		options += 7;
+		if (*options != '\0') {
+			if (strncmp(options, "noprobe", 7) == 0) {
+				cardu_sockets[CARDU1].noprobe = 1;
+				options += 7;
+			}
+
+			if (*options != ',')
+				return 0;
+		} else
+			return 0;
+	}
+
+	if (strncmp(options, "cardu2:", 7) == 0) {
+		options += 7;
+		if ((*options != '\0') && (strncmp(options, "noprobe", 7) == 0))
+			cardu_sockets[CARDU2].noprobe = 1;
+	}
+
+	return 0;
+}
+
+__setup("vrc4173_cardu=", vrc4173_cardu_setup);
 
 static struct pci_device_id vrc4173_cardu_id_table[] __devinitdata = {
 	{	.vendor		= PCI_VENDOR_ID_NEC,
diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/drivers/pcmcia/vrc4173_cardu.h linux/drivers/pcmcia/vrc4173_cardu.h
--- linux.orig/drivers/pcmcia/vrc4173_cardu.h	Fri Apr 11 11:08:50 2003
+++ linux/drivers/pcmcia/vrc4173_cardu.h	Wed Sep  3 19:47:05 2003
@@ -35,6 +35,8 @@
 #include <pcmcia/ss.h>
 
 #define CARDU_MAX_SOCKETS	2
+#define CARDU1			0
+#define CARDU2			1
 
 /*
  * PCI Configuration Registers
@@ -229,6 +231,7 @@
  #define VPP_CNT_0V		0x00000000
 
 typedef struct vrc4173_socket {
+	int noprobe;
 	struct pci_dev *dev;
 	void *base;
 	void (*handler)(void *, unsigned int);
diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/drivers/pcmcia/vrc4173_cardu.c linux/drivers/pcmcia/vrc4173_cardu.c
--- linux.orig/drivers/pcmcia/vrc4173_cardu.c	Fri Apr 11 11:09:21 2003
+++ linux/drivers/pcmcia/vrc4173_cardu.c	Thu Sep  4 00:51:29 2003
@@ -6,7 +6,7 @@
  * 	NEC VRC4173 CARDU driver for Socket Services
  *	(This device doesn't support CardBus. it is supporting only 16bit PC Card.)
  *
- * Copyright 2002 Yoichi Yuasa <[email-masked]>
+ * Copyright 2002,2003 Yoichi Yuasa <[email-masked]>
  *
  *  This program is free software; you can redistribute it and/or modify it
  *  under the terms of the GNU General Public License as published by the
@@ -519,6 +519,9 @@
 
 	slot = vrc4173_cardu_slots++;
 	socket = &cardu_sockets[slot];
+	if (socket->noprobe != 0)
+		return -EBUSY;
+
 	sprintf(socket->name, "NEC VRC4173 CARDU%1d", slot+1);
 
 	if ((err = pci_enable_device(dev)) < 0)
@@ -563,6 +566,36 @@
 
 	return 0;
 }
+
+static int __devinit vrc4173_cardu_setup(char *options)
+{
+	if (options == NULL || *options == '\0')
+		return 0;
+
+	if (strncmp(options, "cardu1:", 7) == 0) {
+		options += 7;
+		if (*options != '\0') {
+			if (strncmp(options, "noprobe", 7) == 0) {
+				cardu_sockets[CARDU1].noprobe = 1;
+				options += 7;
+			}
+
+			if (*options != ',')
+				return 0;
+		} else
+			return 0;
+	}
+
+	if (strncmp(options, "cardu2:", 7) == 0) {
+		options += 7;
+		if ((*options != '\0') && (strncmp(options, "noprobe", 7) == 0))
+			cardu_sockets[CARDU2].noprobe = 1;
+	}
+
+	return 0;
+}
+
+__setup("vrc4173_cardu=", vrc4173_cardu_setup);
 
 static struct pci_device_id vrc4173_cardu_id_table[] __devinitdata = {
 	{	.vendor		= PCI_VENDOR_ID_NEC,
diff -aruN --exclude=CVS --exclude=.cvsignore linux.orig/drivers/pcmcia/vrc4173_cardu.h linux/drivers/pcmcia/vrc4173_cardu.h
--- linux.orig/drivers/pcmcia/vrc4173_cardu.h	Fri Apr 11 11:09:21 2003
+++ linux/drivers/pcmcia/vrc4173_cardu.h	Thu Sep  4 00:51:29 2003
@@ -35,6 +35,8 @@
 #include <pcmcia/ss.h>
 
 #define CARDU_MAX_SOCKETS	2
+#define CARDU1			0
+#define CARDU2			1
 
 /*
  * PCI Configuration Registers
@@ -229,6 +231,7 @@
  #define VPP_CNT_0V		0x00000000
 
 typedef struct vrc4173_socket {
+	int noprobe;
 	struct pci_dev *dev;
 	void *base;
 	void (*handler)(void *, unsigned int);

---

From: Yoichi Yuasa <[email-masked]>
Date: Sat, 6 Sep 2003 16:59:37 +0900

Hello Ralf,

Do these patches have any problem?

Yoichi

On Thu, 4 Sep 2003 01:10:19 +0900