public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro
@ 2007-04-29 20:53 Jiri Slaby
  2007-04-29 20:54 ` [PATCH 2/21] Char: cyclades, switch to pci probing Jiri Slaby
                   ` (20 more replies)
  0 siblings, 21 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, use IS_CYC_Z macro

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 167ae9073fef562913c9d68d32da883da5444fbc
tree 5d5795a789e6ce98a5a1226cf88e2b98b1d9a12a
parent b462f2fd89bff92e55be6a5317a3be0ad6a93ad8
author Jiri Slaby <jirislaby@gmail.com> Tue, 24 Apr 2007 21:40:00 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:14:54 +0200

 drivers/char/cyclades.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 9d22d58..d3b42e8 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -3616,11 +3616,6 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
 			((status & CyCTS) ? TIOCM_CTS : 0);
 	} else {
 		base_addr = cy_card[card].base_addr;
-
-		if (cy_card[card].num_chips != -1) {
-			return -EINVAL;
-		}
-
 		firm_id = cy_card[card].base_addr + ID_ADDRESS;
 		if (ISZLOADED(cy_card[card])) {
 			zfw_ctrl = cy_card[card].base_addr +
@@ -4513,7 +4508,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 	unsigned short chip_number;
 	int index, port;
 
-	if (cinfo->num_chips == -1) {	/* Cyclades-Z */
+	if (IS_CYC_Z(*cinfo)) {	/* Cyclades-Z */
 		mailbox = readl(&((struct RUNTIME_9060 __iomem *)
 				     cinfo->ctl_addr)->mail_box_0);
 		nports = (mailbox == ZE_V1) ? ZE_V1_NPORTS : 8;
@@ -5346,12 +5341,12 @@ static void __devexit cy_pci_release(struct pci_dev *pdev)
 	unsigned int i;
 
 	/* non-Z with old PLX */
-	if (cinfo->num_chips != -1 && (readb(cinfo->base_addr + CyPLX_VER) &
-				0x0f) == PLX_9050)
+	if (!IS_CYC_Z(*cinfo) && (readb(cinfo->base_addr + CyPLX_VER) & 0x0f) ==
+			PLX_9050)
 		cy_writeb(cinfo->ctl_addr + 0x4c, 0);
 	else
 #ifndef CONFIG_CYZ_INTR
-		if (cinfo->num_chips != -1)
+		if (!IS_CYC_Z(*cinfo))
 #endif
 		cy_writew(cinfo->ctl_addr + 0x68,
 				readw(cinfo->ctl_addr + 0x68) & ~0x0900);
@@ -5361,7 +5356,7 @@ static void __devexit cy_pci_release(struct pci_dev *pdev)
 		pci_iounmap(pdev, cinfo->ctl_addr);
 	if (cinfo->irq
 #ifndef CONFIG_CYZ_INTR
-		&& cinfo->num_chips != -1 /* not a Z card */
+		&& !IS_CYC_Z(*cinfo)
 #endif /* CONFIG_CYZ_INTR */
 		)
 		free_irq(cinfo->irq, cinfo);
@@ -5582,7 +5577,7 @@ static void __exit cy_cleanup_module(void)
 				iounmap(cy_card[i].ctl_addr);
 			if (cy_card[i].irq
 #ifndef CONFIG_CYZ_INTR
-				&& cy_card[i].num_chips != -1 /* not a Z card */
+				&& !IS_CYC_Z(cy_card[i])
 #endif /* CONFIG_CYZ_INTR */
 				)
 				free_irq(cy_card[i].irq, &cy_card[i]);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/21] Char: cyclades, switch to pci probing
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
@ 2007-04-29 20:54 ` Jiri Slaby
  2007-04-29 20:54 ` [PATCH 3/21] Char: cyclades, depends on PCI or ISA Jiri Slaby
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, switch to pci probing

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit c5c2e708444ec573636733bb28ecd66d1753aa8f
tree 219a4d452e3e208c27031ed29506ee108feef833
parent 167ae9073fef562913c9d68d32da883da5444fbc
author Jiri Slaby <jirislaby@gmail.com> Tue, 24 Apr 2007 23:47:07 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:14:56 +0200

 drivers/char/cyclades.c |   65 ++++++++++++-----------------------------------
 1 files changed, 17 insertions(+), 48 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index d3b42e8..249f443 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -5297,46 +5297,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 
 	return 0;
 }
-#endif
 
-/*
- * ---------------------------------------------------------------------
- * cy_detect_pci() - Test PCI bus presence and Cyclom-Ye/PCI.
- * sets global variables and return the number of PCI boards found.
- * ---------------------------------------------------------------------
- */
-static int __init cy_detect_pci(void)
+static void __devexit cy_pci_remove(struct pci_dev *pdev)
 {
-#ifdef CONFIG_PCI
-	struct pci_dev *pdev = NULL;
-	unsigned int i, device_id, dev_index = 0;
-
-	for (i = 0; i < NR_CARDS; i++) {
-		/* look for a Cyclades card by vendor and device id */
-		while ((device_id = cy_pci_dev_id[dev_index].device) != 0) {
-			if ((pdev = pci_get_device(PCI_VENDOR_ID_CYCLADES,
-						   device_id, pdev)) == NULL) {
-				dev_index++;	/* try next device id */
-			} else {
-				break;	/* found a board */
-			}
-		}
-
-		if (device_id == 0)
-			break;
-
-		i -= !!cy_pci_probe(pdev, &cy_pci_dev_id[dev_index]);
-	}
-
-	return i;
-#else
-	return 0;
-#endif				/* ifdef CONFIG_PCI */
-}				/* cy_detect_pci */
-
-static void __devexit cy_pci_release(struct pci_dev *pdev)
-{
-#ifdef CONFIG_PCI
 	struct cyclades_card *cinfo = pci_get_drvdata(pdev);
 	unsigned int i;
 
@@ -5370,9 +5333,16 @@ static void __devexit cy_pci_release(struct pci_dev *pdev)
 	for (i = cinfo->first_line; i < cinfo->first_line +
 			cinfo->nports; i++)
 		tty_unregister_device(cy_serial_driver, i);
-#endif
 }
 
+static struct pci_driver cy_pci_driver = {
+	.name = "cyclades",
+	.id_table = cy_pci_dev_id,
+	.probe = cy_pci_probe,
+	.remove = __devexit_p(cy_pci_remove)
+};
+#endif
+
 /*
  * This routine prints out the appropriate serial driver version number
  * and identifies which options were configured into this driver.
@@ -5533,13 +5503,12 @@ static int __init cy_init(void)
 	/* look for isa boards */
 	nboards = cy_detect_isa();
 
+#ifdef CONFIG_PCI
 	/* look for pci boards */
-	nboards += cy_detect_pci();
-
-	if (nboards == 0) {
-		retval = -ENODEV;
+	retval = pci_register_driver(&cy_pci_driver);
+	if (retval && !nboards)
 		goto err_unr;
-	}
+#endif
 
 	return 0;
 err_unr:
@@ -5564,12 +5533,12 @@ static void __exit cy_cleanup_module(void)
 
 	put_tty_driver(cy_serial_driver);
 
+#ifdef CONFIG_PCI
+	pci_unregister_driver(&cy_pci_driver);
+#endif
+
 	for (i = 0; i < NR_CARDS; i++) {
 		if (cy_card[i].base_addr) {
-			if (cy_card[i].pdev) {
-				cy_pci_release(cy_card[i].pdev);
-				continue;
-			}
 			/* clear interrupt */
 			cy_writeb(cy_card[i].base_addr + Cy_ClrIntr, 0);
 			iounmap(cy_card[i].base_addr);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/21] Char: cyclades, depends on PCI or ISA
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
  2007-04-29 20:54 ` [PATCH 2/21] Char: cyclades, switch to pci probing Jiri Slaby
@ 2007-04-29 20:54 ` Jiri Slaby
  2007-04-29 20:55 ` [PATCH 4/21] Char: cyclades, unexport struct cyclades_card Jiri Slaby
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:54 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, depends on PCI or ISA

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 3441ca636014ff919d5b2b2e920b76dbe7ed9686
tree ce47d830269c31d539649d2e270eb1cce765e546
parent c5c2e708444ec573636733bb28ecd66d1753aa8f
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 11:33:32 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:14:57 +0200

 drivers/char/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index cf72828..73442e0 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -127,7 +127,7 @@ config ROCKETPORT
 
 config CYCLADES
 	tristate "Cyclades async mux support"
-	depends on SERIAL_NONSTANDARD
+	depends on SERIAL_NONSTANDARD && (PCI || ISA)
 	---help---
 	  This driver supports Cyclades Z and Y multiserial boards.
 	  You would need something like this to connect more than two modems to

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/21] Char: cyclades, unexport struct cyclades_card
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
  2007-04-29 20:54 ` [PATCH 2/21] Char: cyclades, switch to pci probing Jiri Slaby
  2007-04-29 20:54 ` [PATCH 3/21] Char: cyclades, depends on PCI or ISA Jiri Slaby
@ 2007-04-29 20:55 ` Jiri Slaby
  2007-04-29 20:56 ` [PATCH 5/21] Char: cyclades, remove useless fileds from cyclades_card Jiri Slaby
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, unexport struct cyclades_card

Do not export internal card data to userspace. cytune doesn't use this
anyway.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 166b3f753df7acfa71c32b1069e78317f532b0f7
tree c124038b4c9749bd161bde189829700957b98a4f
parent 3441ca636014ff919d5b2b2e920b76dbe7ed9686
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 14:09:57 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:14:58 +0200

 drivers/char/cyclades.c  |    8 --------
 include/linux/cyclades.h |   15 ++-------------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 249f443..1b4ff13 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4049,14 +4049,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
 	case CYGETRTSDTR_INV:
 		ret_val = info->rtsdtr_inv;
 		break;
-	case CYGETCARDINFO:
-		if (copy_to_user(argp, &cy_card[info->card],
-				 sizeof(struct cyclades_card))) {
-			ret_val = -EFAULT;
-			break;
-		}
-		ret_val = 0;
-		break;
 	case CYGETCD1400VER:
 		ret_val = info->chip_rev;
 		break;
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index f0ad61f..e76f486 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -110,7 +110,6 @@ struct cyclades_idle_stats {
 #define CYZSETPOLLCYCLE		0x43590e
 #define CYZGETPOLLCYCLE		0x43590f
 #define CYGETCD1400VER		0x435910
-#define CYGETCARDINFO		0x435911
 #define	CYSETWAIT		0x435912
 #define	CYGETWAIT		0x435913
 
@@ -506,8 +505,9 @@ struct ZFW_CTRL {
 /****************** ****************** *******************/
 #endif
 
+#ifdef __KERNEL__
+
 /* Per card data structure */
-struct resource;
 struct cyclades_card {
     unsigned long base_phys;
     unsigned long ctl_phys;
@@ -520,20 +520,9 @@ struct cyclades_card {
     int bus_index;	/* address shift - 0 for ISA, 1 for PCI */
     int	intr_enabled;	/* FW Interrupt flag - 0 disabled, 1 enabled */
     struct pci_dev *pdev;
-#ifdef __KERNEL__
     spinlock_t card_lock;
-#else
-    unsigned long filler;
-#endif
 };
 
-struct cyclades_chip {
-  int filler;
-};
-
-
-#ifdef __KERNEL__
-
 /***************************************
  * Memory access functions/macros      *
  * (required to support Alpha systems) *

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/21] Char: cyclades, remove useless fileds from cyclades_card
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (2 preceding siblings ...)
  2007-04-29 20:55 ` [PATCH 4/21] Char: cyclades, unexport struct cyclades_card Jiri Slaby
@ 2007-04-29 20:56 ` Jiri Slaby
  2007-04-29 20:57 ` [PATCH 6/21] Char: cyclades, irq is int Jiri Slaby
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:56 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, remove useless fileds from cyclades_card

pde, ctl_phys and base_phys are useless -- they are never used.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 85e1e6d0a4acbcedf00e9f2fc6b71d66179dc382
tree 2dac7ea5d42dab587e046c9b91354ea5a467a2ed
parent 166b3f753df7acfa71c32b1069e78317f532b0f7
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 14:13:30 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:15:00 +0200

 drivers/char/cyclades.c  |    9 ---------
 include/linux/cyclades.h |    3 ---
 2 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 1b4ff13..a79a4b2 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4914,15 +4914,12 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 #endif				/* CONFIG_CYZ_INTR */
 
 	/* set cy_card */
-	cy_card[j].base_phys = cy_pci_phys2;
-	cy_card[j].ctl_phys = cy_pci_phys0;
 	cy_card[j].base_addr = cy_pci_addr2;
 	cy_card[j].ctl_addr = cy_pci_addr0;
 	cy_card[j].irq = (int)cy_pci_irq;
 	cy_card[j].bus_index = 1;
 	cy_card[j].first_line = cy_next_channel;
 	cy_card[j].num_chips = -1;
-	cy_card[j].pdev = pdev;
 	cy_init_card(&cy_card[j], j);
 	pci_set_drvdata(pdev, &cy_card[j]);
 
@@ -5066,15 +5063,12 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		}
 
 		/* set cy_card */
-		cy_card[j].base_phys = (ulong) cy_pci_phys2;
-		cy_card[j].ctl_phys = (ulong) cy_pci_phys0;
 		cy_card[j].base_addr = cy_pci_addr2;
 		cy_card[j].ctl_addr = cy_pci_addr0;
 		cy_card[j].irq = (int)cy_pci_irq;
 		cy_card[j].bus_index = 1;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = cy_pci_nchan / 4;
-		cy_card[j].pdev = pdev;
 		cy_init_card(&cy_card[j], j);
 		pci_set_drvdata(pdev, &cy_card[j]);
 
@@ -5253,15 +5247,12 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 #endif				/* CONFIG_CYZ_INTR */
 
 		/* set cy_card */
-		cy_card[j].base_phys = cy_pci_phys2;
-		cy_card[j].ctl_phys = cy_pci_phys0;
 		cy_card[j].base_addr = cy_pci_addr2;
 		cy_card[j].ctl_addr = cy_pci_addr0;
 		cy_card[j].irq = (int)cy_pci_irq;
 		cy_card[j].bus_index = 1;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = -1;
-		cy_card[j].pdev = pdev;
 		cy_init_card(&cy_card[j], j);
 		pci_set_drvdata(pdev, &cy_card[j]);
 
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index e76f486..e06cd47 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -509,8 +509,6 @@ struct ZFW_CTRL {
 
 /* Per card data structure */
 struct cyclades_card {
-    unsigned long base_phys;
-    unsigned long ctl_phys;
     void __iomem *base_addr;
     void __iomem *ctl_addr;
     int irq;
@@ -519,7 +517,6 @@ struct cyclades_card {
     int nports;		/* Number of ports in the card */
     int bus_index;	/* address shift - 0 for ISA, 1 for PCI */
     int	intr_enabled;	/* FW Interrupt flag - 0 disabled, 1 enabled */
-    struct pci_dev *pdev;
     spinlock_t card_lock;
 };
 

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 6/21] Char: cyclades, irq is int
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (3 preceding siblings ...)
  2007-04-29 20:56 ` [PATCH 5/21] Char: cyclades, remove useless fileds from cyclades_card Jiri Slaby
@ 2007-04-29 20:57 ` Jiri Slaby
  2007-04-29 20:57 ` [PATCH 7/21] Char: cyclades, printk cleanups Jiri Slaby
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, irq is int

don't fetch it to uchar

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 34705e1c32f10d42a1d4b7e2b3da93321bd20625
tree d32188cad2366036c71f140b123d50c8f748b3fa
parent 85e1e6d0a4acbcedf00e9f2fc6b71d66179dc382
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 14:15:57 +0200
committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:15:01 +0200

 drivers/char/cyclades.c |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index a79a4b2..c12dbb1 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4916,7 +4916,7 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 	/* set cy_card */
 	cy_card[j].base_addr = cy_pci_addr2;
 	cy_card[j].ctl_addr = cy_pci_addr0;
-	cy_card[j].irq = (int)cy_pci_irq;
+	cy_card[j].irq = cy_pci_irq;
 	cy_card[j].bus_index = 1;
 	cy_card[j].first_line = cy_next_channel;
 	cy_card[j].num_chips = -1;
@@ -4929,8 +4929,7 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 	if ((cy_pci_irq != 0) && (cy_pci_irq != 255))
 		printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
 			j + 1, (ulong) cy_pci_phys2,
-			(ulong) (cy_pci_phys2 + CyPCI_Ze_win - 1),
-			(int)cy_pci_irq);
+			(ulong) (cy_pci_phys2 + CyPCI_Ze_win - 1), cy_pci_irq);
 	else
 #endif				/* CONFIG_CYZ_INTR */
 		printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, ",
@@ -4950,7 +4949,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		const struct pci_device_id *ent)
 {
 	unsigned char cyy_rev_id;
-	unsigned char cy_pci_irq;
+	int cy_pci_irq;
 	__u32 cy_pci_phys0, cy_pci_phys2, mailbox;
 	void __iomem *cy_pci_addr0, *cy_pci_addr2;
 	unsigned int device_id;
@@ -4976,8 +4975,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 #ifdef CY_PCI_DEBUG
 		printk("Cyclom-Y/PCI (bus=0x0%x, pci_id=0x%x, ",
 			pdev->bus->number, pdev->devfn);
-		printk("rev_id=%d) IRQ%d\n",
-			cyy_rev_id, (int)cy_pci_irq);
+		printk("rev_id=%d) IRQ%d\n", cyy_rev_id, cy_pci_irq);
 		printk("Cyclom-Y/PCI:found  winaddr=0x%lx "
 			"ctladdr=0x%lx\n",
 			(ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
@@ -5003,7 +5001,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 			printk("Cyclom-Y/PCI (bus=0x0%x, pci_id=0x%x, ",
 				pdev->bus->number, pdev->devfn);
 			printk("rev_id=%d) IRQ%d\n",
-				cyy_rev_id, (int)cy_pci_irq);
+				cyy_rev_id, cy_pci_irq);
 			printk("Cyclom-Y/PCI:found  winaddr=0x%lx "
 				"ctladdr=0x%lx\n",
 				(ulong)cy_pci_phys2,
@@ -5065,7 +5063,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		/* set cy_card */
 		cy_card[j].base_addr = cy_pci_addr2;
 		cy_card[j].ctl_addr = cy_pci_addr0;
-		cy_card[j].irq = (int)cy_pci_irq;
+		cy_card[j].irq = cy_pci_irq;
 		cy_card[j].bus_index = 1;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = cy_pci_nchan / 4;
@@ -5101,8 +5099,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		/* print message */
 		printk("Cyclom-Y/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
 			j + 1, (ulong)cy_pci_phys2,
-			(ulong) (cy_pci_phys2 + CyPCI_Ywin - 1),
-			(int)cy_pci_irq);
+			(ulong) (cy_pci_phys2 + CyPCI_Ywin - 1), cy_pci_irq);
 		printk("%d channels starting from port %d.\n",
 			cy_pci_nchan, cy_next_channel);
 		for (j = cy_next_channel;
@@ -5114,8 +5111,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		/* print message */
 		printk("Cyclades-Z/PCI (bus=0x0%x, pci_id=0x%x, ",
 			pdev->bus->number, pdev->devfn);
-		printk("rev_id=%d) IRQ%d\n",
-			cyy_rev_id, (int)cy_pci_irq);
+		printk("rev_id=%d) IRQ%d\n", cyy_rev_id, cy_pci_irq);
 		printk("Cyclades-Z/PCI: found winaddr=0x%lx "
 			"ctladdr=0x%lx\n",
 			(ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
@@ -5126,8 +5122,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 #ifdef CY_PCI_DEBUG
 		printk("Cyclades-Z/PCI (bus=0x0%x, pci_id=0x%x, ",
 			pdev->bus->number, pdev->devfn);
-		printk("rev_id=%d) IRQ%d\n",
-			cyy_rev_id, (int)cy_pci_irq);
+		printk("rev_id=%d) IRQ%d\n", cyy_rev_id, cy_pci_irq);
 		printk("Cyclades-Z/PCI: found winaddr=0x%lx "
 			"ctladdr=0x%lx\n",
 			(ulong) cy_pci_phys2, (ulong) cy_pci_phys0);
@@ -5144,8 +5139,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		   re-write it to the PCI config. registers.
 		   This will remain here until we find a permanent
 		   fix. */
-		pci_write_config_byte(pdev, PCI_INTERRUPT_LINE,
-					cy_pci_irq);
+		pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, cy_pci_irq);
 
 		mailbox = (__u32)readl(&((struct RUNTIME_9060 __iomem *)
 				cy_pci_addr0)->mail_box_0);
@@ -5249,7 +5243,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		/* set cy_card */
 		cy_card[j].base_addr = cy_pci_addr2;
 		cy_card[j].ctl_addr = cy_pci_addr0;
-		cy_card[j].irq = (int)cy_pci_irq;
+		cy_card[j].irq = cy_pci_irq;
 		cy_card[j].bus_index = 1;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = -1;
@@ -5263,7 +5257,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 			printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, "
 				"IRQ%d, ", j + 1, (ulong)cy_pci_phys2,
 				(ulong) (cy_pci_phys2 + CyPCI_Zwin - 1),
-				(int)cy_pci_irq);
+				cy_pci_irq);
 		else
 #endif				/* CONFIG_CYZ_INTR */
 			printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, ",

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 7/21] Char: cyclades, printk cleanups
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (4 preceding siblings ...)
  2007-04-29 20:57 ` [PATCH 6/21] Char: cyclades, irq is int Jiri Slaby
@ 2007-04-29 20:57 ` Jiri Slaby
  2007-04-29 20:58 ` [PATCH 8/21] Char: cyclades, mark cyy_init_card as __devinit, not __init Jiri Slaby
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, printk cleanups

- add printk KERN_ levels to each printk
- substitute printk with dev_* when device struct is available

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit af4b7e8923a0ea9ca7427667977500484a3ca661
tree b9e0a44ecc03ce00874229fa218e5fa16a0d1a46
parent 34705e1c32f10d42a1d4b7e2b3da93321bd20625
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 19:01:57 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:46:56 +0200

 drivers/char/cyclades.c |  530 ++++++++++++++++++++---------------------------
 1 files changed, 220 insertions(+), 310 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index c12dbb1..7a15300 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -860,21 +860,21 @@ static inline int serial_paranoia_check(struct cyclades_port *info,
 {
 #ifdef SERIAL_PARANOIA_CHECK
 	if (!info) {
-		printk("cyc Warning: null cyclades_port for (%s) in %s\n",
-				name, routine);
+		printk(KERN_WARNING "cyc Warning: null cyclades_port for (%s) "
+				"in %s\n", name, routine);
 		return 1;
 	}
 
 	if ((long)info < (long)(&cy_port[0]) ||
 			(long)(&cy_port[NR_PORTS]) < (long)info) {
-		printk("cyc Warning: cyclades_port out of range for (%s) in "
-				"%s\n", name, routine);
+		printk(KERN_WARNING "cyc Warning: cyclades_port out of range "
+				"for (%s) in %s\n", name, routine);
 		return 1;
 	}
 
 	if (info->magic != CYCLADES_MAGIC) {
-		printk("cyc Warning: bad magic number for serial struct (%s) "
-				"in %s\n", name, routine);
+		printk(KERN_WARNING "cyc Warning: bad magic number for serial "
+				"struct (%s) in %s\n", name, routine);
 		return 1;
 	}
 #endif
@@ -1047,7 +1047,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 
 	if (status & CySRReceive) {	/* reception interrupt */
 #ifdef CY_DEBUG_INTERRUPTS
-		printk("cyy_interrupt: rcvd intr, chip %d\n\r", chip);
+		printk(KERN_DEBUG "cyy_interrupt: rcvd intr, chip %d\n", chip);
 #endif
 		/* determine the channel & change to that context */
 		spin_lock(&cinfo->card_lock);
@@ -1212,7 +1212,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 		   is empty, we know we can always stuff a dozen
 		   characters. */
 #ifdef CY_DEBUG_INTERRUPTS
-		printk("cyy_interrupt: xmit intr, chip %d\n\r", chip);
+		printk(KERN_DEBUG "cyy_interrupt: xmit intr, chip %d\n", chip);
 #endif
 
 		/* determine the channel & change to that context */
@@ -1436,7 +1436,7 @@ static irqreturn_t cyy_interrupt(int irq, void *dev_id)
 
 	if ((cinfo = (struct cyclades_card *)dev_id) == 0) {
 #ifdef CY_DEBUG_INTERRUPTS
-		printk("cyy_interrupt: spurious interrupt %d\n\r", irq);
+		printk(KERN_DEBUG "cyy_interrupt: spurious interrupt %d\n",irq);
 #endif
 		return IRQ_NONE;	/* spurious interrupt */
 	}
@@ -1820,8 +1820,8 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
 		case C_CM_INTBACK2:
 			/* Reception Interrupt */
 #ifdef CY_DEBUG_INTERRUPTS
-			printk("cyz_interrupt: rcvd intr, card %d, "
-					"port %ld\n\r", info->card, channel);
+			printk(KERN_DEBUG "cyz_interrupt: rcvd intr, card %d, "
+					"port %ld\n", info->card, channel);
 #endif
 			cyz_handle_rx(info, ch_ctrl, buf_ctrl);
 			break;
@@ -1830,8 +1830,8 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
 		case C_CM_INTBACK:
 			/* Transmission Interrupt */
 #ifdef CY_DEBUG_INTERRUPTS
-			printk("cyz_interrupt: xmit intr, card %d, "
-					"port %ld\n\r", info->card, channel);
+			printk(KERN_DEBUG "cyz_interrupt: xmit intr, card %d, "
+					"port %ld\n", info->card, channel);
 #endif
 			cyz_handle_tx(info, ch_ctrl, buf_ctrl);
 			break;
@@ -1856,14 +1856,15 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id)
 
 	if ((cinfo = (struct cyclades_card *)dev_id) == 0) {
 #ifdef CY_DEBUG_INTERRUPTS
-		printk("cyz_interrupt: spurious interrupt %d\n\r", irq);
+		printk(KERN_DEBUG "cyz_interrupt: spurious interrupt %d\n",irq);
 #endif
 		return IRQ_NONE;	/* spurious interrupt */
 	}
 
 	if (!ISZLOADED(*cinfo)) {
 #ifdef CY_DEBUG_INTERRUPTS
-		printk("cyz_interrupt: board not yet loaded (IRQ%d).\n\r", irq);
+		printk(KERN_DEBUG "cyz_interrupt: board not yet loaded "
+				"(IRQ%d).\n", irq);
 #endif
 		return IRQ_NONE;
 	}
@@ -1885,7 +1886,7 @@ static void cyz_rx_restart(unsigned long arg)
 	CY_LOCK(info, flags);
 	retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK2, 0L);
 	if (retval != 0) {
-		printk("cyc:cyz_rx_restart retval on ttyC%d was %x\n",
+		printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n",
 			info->line, retval);
 	}
 	cyz_rx_full_timer[info->line].function = NULL;
@@ -2000,10 +2001,9 @@ static int startup(struct cyclades_port *info)
 				(cy_chip_offset[chip] << index);
 
 #ifdef CY_DEBUG_OPEN
-		printk("cyc startup card %d, chip %d, channel %d, "
-				"base_addr %lx\n",
-				card, chip, channel, (long)base_addr);
-		/**/
+		printk(KERN_DEBUG "cyc startup card %d, chip %d, channel %d, "
+				"base_addr %p\n",
+				card, chip, channel, base_addr);
 #endif
 		CY_LOCK(info, flags);
 
@@ -2021,8 +2021,8 @@ static int startup(struct cyclades_port *info)
 		cy_writeb(base_addr + (CyMSVR2 << index), CyDTR);
 
 #ifdef CY_DEBUG_DTR
-		printk("cyc:startup raising DTR\n");
-		printk("     status: 0x%x, 0x%x\n",
+		printk(KERN_DEBUG "cyc:startup raising DTR\n");
+		printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 			readb(base_addr + (CyMSVR1 << index)),
 			readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -2063,9 +2063,8 @@ static int startup(struct cyclades_port *info)
 		ch_ctrl = zfw_ctrl->ch_ctrl;
 
 #ifdef CY_DEBUG_OPEN
-		printk("cyc startup Z card %d, channel %d, base_addr %lx\n",
-			card, channel, (long)base_addr);
-		/**/
+		printk(KERN_DEBUG "cyc startup Z card %d, channel %d, "
+			"base_addr %p\n", card, channel, base_addr);
 #endif
 		CY_LOCK(info, flags);
 
@@ -2091,16 +2090,16 @@ static int startup(struct cyclades_port *info)
 
 		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L);
 		if (retval != 0) {
-			printk("cyc:startup(1) retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:startup(1) retval on ttyC%d was "
+				"%x\n", info->line, retval);
 		}
 
 		/* Flush RX buffers before raising DTR and RTS */
 		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_RX,
 				0L);
 		if (retval != 0) {
-			printk("cyc:startup(2) retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:startup(2) retval on ttyC%d was "
+				"%x\n", info->line, retval);
 		}
 
 		/* set timeout !!! */
@@ -2111,11 +2110,11 @@ static int startup(struct cyclades_port *info)
 		retval = cyz_issue_cmd(&cy_card[info->card], channel,
 				C_CM_IOCTLM, 0L);
 		if (retval != 0) {
-			printk("cyc:startup(3) retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was "
+				"%x\n", info->line, retval);
 		}
 #ifdef CY_DEBUG_DTR
-		printk("cyc:startup raising Z DTR\n");
+		printk(KERN_DEBUG "cyc:startup raising Z DTR\n");
 #endif
 
 		/* enable send, recv, modem !!! */
@@ -2135,7 +2134,7 @@ static int startup(struct cyclades_port *info)
 	}
 
 #ifdef CY_DEBUG_OPEN
-	printk(" cyc startup done\n");
+	printk(KERN_DEBUG "cyc startup done\n");
 #endif
 	return 0;
 
@@ -2172,8 +2171,8 @@ static void start_xmit(struct cyclades_port *info)
 		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK,
 				0L);
 		if (retval != 0) {
-			printk("cyc:start_xmit retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was "
+				"%x\n", info->line, retval);
 		}
 		CY_UNLOCK(info, flags);
 #else				/* CONFIG_CYZ_INTR */
@@ -2206,9 +2205,9 @@ static void shutdown(struct cyclades_port *info)
 				(cy_chip_offset[chip] << index);
 
 #ifdef CY_DEBUG_OPEN
-		printk("cyc shutdown Y card %d, chip %d, channel %d, "
-				"base_addr %lx\n",
-				card, chip, channel, (long)base_addr);
+		printk(KERN_DEBUG "cyc shutdown Y card %d, chip %d, "
+				"channel %d, base_addr %p\n",
+				card, chip, channel, base_addr);
 #endif
 
 		CY_LOCK(info, flags);
@@ -2227,8 +2226,8 @@ static void shutdown(struct cyclades_port *info)
 			cy_writeb(base_addr + (CyMSVR1 << index), ~CyRTS);
 			cy_writeb(base_addr + (CyMSVR2 << index), ~CyDTR);
 #ifdef CY_DEBUG_DTR
-			printk("cyc shutdown dropping DTR\n");
-			printk("     status: 0x%x, 0x%x\n",
+			printk(KERN_DEBUG "cyc shutdown dropping DTR\n");
+			printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -2251,8 +2250,8 @@ static void shutdown(struct cyclades_port *info)
 
 		base_addr = cy_card[card].base_addr;
 #ifdef CY_DEBUG_OPEN
-		printk("cyc shutdown Z card %d, channel %d, base_addr %lx\n",
-			card, channel, (long)base_addr);
+		printk(KERN_DEBUG "cyc shutdown Z card %d, channel %d, "
+			"base_addr %p\n", card, channel, base_addr);
 #endif
 
 		firm_id = base_addr + ID_ADDRESS;
@@ -2281,11 +2280,11 @@ static void shutdown(struct cyclades_port *info)
 			retval = cyz_issue_cmd(&cy_card[info->card], channel,
 					C_CM_IOCTLM, 0L);
 			if (retval != 0) {
-				printk("cyc:shutdown retval on ttyC%d was %x\n",
-					info->line, retval);
+				printk(KERN_ERR"cyc:shutdown retval on ttyC%d "
+					"was %x\n", info->line, retval);
 			}
 #ifdef CY_DEBUG_DTR
-			printk("cyc:shutdown dropping Z DTR\n");
+			printk(KERN_DEBUG "cyc:shutdown dropping Z DTR\n");
 #endif
 		}
 
@@ -2298,7 +2297,7 @@ static void shutdown(struct cyclades_port *info)
 	}
 
 #ifdef CY_DEBUG_OPEN
-	printk(" cyc shutdown done\n");
+	printk(KERN_DEBUG "cyc shutdown done\n");
 #endif
 }				/* shutdown */
 
@@ -2352,17 +2351,16 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 	retval = 0;
 	add_wait_queue(&info->open_wait, &wait);
 #ifdef CY_DEBUG_OPEN
-	printk("cyc block_til_ready before block: ttyC%d, count = %d\n",
-		info->line, info->count);
-	/**/
+	printk(KERN_DEBUG "cyc block_til_ready before block: ttyC%d, "
+		"count = %d\n", info->line, info->count);
 #endif
 	CY_LOCK(info, flags);
 	if (!tty_hung_up_p(filp))
 		info->count--;
 	CY_UNLOCK(info, flags);
 #ifdef CY_DEBUG_COUNT
-	printk("cyc block_til_ready: (%d): decrementing count to %d\n",
-		current->pid, info->count);
+	printk(KERN_DEBUG "cyc block_til_ready: (%d): decrementing count to "
+		"%d\n", current->pid, info->count);
 #endif
 	info->blocked_open++;
 
@@ -2382,8 +2380,9 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				cy_writeb(base_addr + (CyMSVR2 << index),
 					  CyDTR);
 #ifdef CY_DEBUG_DTR
-				printk("cyc:block_til_ready raising DTR\n");
-				printk("     status: 0x%x, 0x%x\n",
+				printk(KERN_DEBUG "cyc:block_til_ready raising "
+					"DTR\n");
+				printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 					readb(base_addr + (CyMSVR1 << index)),
 					readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -2414,10 +2413,9 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				break;
 			}
 #ifdef CY_DEBUG_OPEN
-			printk("cyc block_til_ready blocking: ttyC%d, "
-					"count = %d\n",
-					info->line, info->count);
-			/**/
+			printk(KERN_DEBUG "cyc block_til_ready blocking: "
+				"ttyC%d, count = %d\n",
+				info->line, info->count);
 #endif
 			schedule();
 		}
@@ -2448,12 +2446,13 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				retval = cyz_issue_cmd(&cy_card[info->card],
 					channel, C_CM_IOCTLM, 0L);
 				if (retval != 0) {
-					printk("cyc:block_til_ready retval on "
-						"ttyC%d was %x\n",
+					printk(KERN_ERR "cyc:block_til_ready "
+						"retval on ttyC%d was %x\n",
 						info->line, retval);
 				}
 #ifdef CY_DEBUG_DTR
-				printk("cyc:block_til_ready raising Z DTR\n");
+				printk(KERN_DEBUG "cyc:block_til_ready raising "
+					"Z DTR\n");
 #endif
 			}
 
@@ -2474,10 +2473,9 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				break;
 			}
 #ifdef CY_DEBUG_OPEN
-			printk("cyc block_til_ready blocking: ttyC%d, "
-					"count = %d\n",
-					info->line, info->count);
-			/**/
+			printk(KERN_DEBUG "cyc block_til_ready blocking: "
+				"ttyC%d, count = %d\n",
+				info->line, info->count);
 #endif
 			schedule();
 		}
@@ -2487,15 +2485,14 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 	if (!tty_hung_up_p(filp)) {
 		info->count++;
 #ifdef CY_DEBUG_COUNT
-		printk("cyc:block_til_ready (%d): incrementing count to %d\n",
-			current->pid, info->count);
+		printk(KERN_DEBUG "cyc:block_til_ready (%d): incrementing "
+			"count to %d\n", current->pid, info->count);
 #endif
 	}
 	info->blocked_open--;
 #ifdef CY_DEBUG_OPEN
-	printk("cyc:block_til_ready after blocking: ttyC%d, count = %d\n",
-		info->line, info->count);
-	/**/
+	printk(KERN_DEBUG "cyc:block_til_ready after blocking: ttyC%d, "
+		"count = %d\n", info->line, info->count);
 #endif
 	if (retval)
 		return retval;
@@ -2535,12 +2532,13 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 					Z_FPGA_CHECK(*cinfo)) &&
 					(ZFIRM_HLT == readl(
 						&firm_id->signature))) {
-				printk("cyc:Cyclades-Z Error: you need an "
-					"external power supply for this number "
-					"of ports.\n\rFirmware halted.\r\n");
+				printk(KERN_ERR "cyc:Cyclades-Z Error: you "
+					"need an external power supply for "
+					"this number of ports.\nFirmware "
+					"halted.\n");
 			} else {
-				printk("cyc:Cyclades-Z firmware not yet "
-					"loaded\n");
+				printk(KERN_ERR "cyc:Cyclades-Z firmware not "
+					"yet loaded\n");
 			}
 			return -ENODEV;
 		}
@@ -2566,8 +2564,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 				retval = cyz_issue_cmd(cinfo, 0,
 						C_CM_IRQ_ENBL, 0L);
 				if (retval != 0) {
-					printk("cyc:IRQ enable retval was %x\n",
-						retval);
+					printk(KERN_ERR "cyc:IRQ enable retval "
+						"was %x\n", retval);
 				}
 				cinfo->nports =
 					(int)readl(&board_ctrl->n_channel);
@@ -2580,7 +2578,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 			return -ENODEV;
 	}
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_open ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_open ttyC%d\n", info->line);
 #endif
 	tty->driver_data = info;
 	info->tty = tty;
@@ -2588,12 +2586,12 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 		return -ENODEV;
 	}
 #ifdef CY_DEBUG_OPEN
-	printk("cyc:cy_open ttyC%d, count = %d\n", info->line, info->count);
-	/**/
+	printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line,
+			info->count);
 #endif
 	info->count++;
 #ifdef CY_DEBUG_COUNT
-	printk("cyc:cy_open (%d): incrementing count to %d\n",
+	printk(KERN_DEBUG "cyc:cy_open (%d): incrementing count to %d\n",
 		current->pid, info->count);
 #endif
 
@@ -2617,8 +2615,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 	retval = block_til_ready(tty, filp, info);
 	if (retval) {
 #ifdef CY_DEBUG_OPEN
-		printk("cyc:cy_open returning after block_til_ready with %d\n",
-			retval);
+		printk(KERN_DEBUG "cyc:cy_open returning after block_til_ready "
+			"with %d\n", retval);
 #endif
 		return retval;
 	}
@@ -2626,8 +2624,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 	info->throttle = 0;
 
 #ifdef CY_DEBUG_OPEN
-	printk(" cyc:cy_open done\n");
-	/**/
+	printk(KERN_DEBUG "cyc:cy_open done\n");
 #endif
 	return 0;
 }				/* cy_open */
@@ -2678,8 +2675,8 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 	if (!timeout || timeout > 2 * info->timeout)
 		timeout = 2 * info->timeout;
 #ifdef CY_DEBUG_WAIT_UNTIL_SENT
-	printk("In cy_wait_until_sent(%d) check=%lu...", timeout, char_time);
-	printk("jiff=%lu...", jiffies);
+	printk(KERN_DEBUG "In cy_wait_until_sent(%d) check=%d, jiff=%lu...",
+		timeout, char_time, jiffies);
 #endif
 	card = info->card;
 	channel = (info->line) - (cy_card[card].first_line);
@@ -2691,7 +2688,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
 		while (readb(base_addr + (CySRER << index)) & CyTxRdy) {
 #ifdef CY_DEBUG_WAIT_UNTIL_SENT
-			printk("Not clean (jiff=%lu)...", jiffies);
+			printk(KERN_DEBUG "Not clean (jiff=%lu)...", jiffies);
 #endif
 			if (msleep_interruptible(jiffies_to_msecs(char_time)))
 				break;
@@ -2705,7 +2702,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 	/* Run one more char cycle */
 	msleep_interruptible(jiffies_to_msecs(char_time * 5));
 #ifdef CY_DEBUG_WAIT_UNTIL_SENT
-	printk("Clean (jiff=%lu)...done\n", jiffies);
+	printk(KERN_DEBUG "Clean (jiff=%lu)...done\n", jiffies);
 #endif
 }
 
@@ -2718,7 +2715,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 	unsigned long flags;
 
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_close ttyC%d\n", info->line);
+	printk(KERN_DEBUG "cyc:cy_close ttyC%d\n", info->line);
 #endif
 
 	if (!info || serial_paranoia_check(info, tty->name, "cy_close")) {
@@ -2732,7 +2729,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 		return;
 	}
 #ifdef CY_DEBUG_OPEN
-	printk("cyc:cy_close ttyC%d, count = %d\n", info->line, info->count);
+	printk(KERN_DEBUG "cyc:cy_close ttyC%d, count = %d\n", info->line,
+		info->count);
 #endif
 	if ((tty->count == 1) && (info->count != 1)) {
 		/*
@@ -2742,17 +2740,17 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 		 * one, we've got real problems, since it means the
 		 * serial port won't be shutdown.
 		 */
-		printk("cyc:cy_close: bad serial port count; tty->count is 1, "
-			"info->count is %d\n", info->count);
+		printk(KERN_ERR "cyc:cy_close: bad serial port count; "
+			"tty->count is 1, info->count is %d\n", info->count);
 		info->count = 1;
 	}
 #ifdef CY_DEBUG_COUNT
-	printk("cyc:cy_close at (%d): decrementing count to %d\n",
+	printk(KERN_DEBUG  "cyc:cy_close at (%d): decrementing count to %d\n",
 		current->pid, info->count - 1);
 #endif
 	if (--info->count < 0) {
 #ifdef CY_DEBUG_COUNT
-		printk("cyc:cyc_close setting count to 0\n");
+		printk(KERN_DEBUG "cyc:cyc_close setting count to 0\n");
 #endif
 		info->count = 0;
 	}
@@ -2805,8 +2803,8 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 			retval = cyz_issue_cmd(&cy_card[info->card], channel,
 						C_CM_IOCTLW, 0L);
 			if (retval != 0) {
-				printk("cyc:cy_close retval on ttyC%d was %x\n",
-					info->line, retval);
+				printk(KERN_DEBUG "cyc:cy_close retval on "
+					"ttyC%d was %x\n", info->line, retval);
 			}
 			CY_UNLOCK(info, flags);
 			interruptible_sleep_on(&info->shutdown_wait);
@@ -2838,7 +2836,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 	wake_up_interruptible(&info->close_wait);
 
 #ifdef CY_DEBUG_OTHER
-	printk(" cyc:cy_close done\n");
+	printk(KERN_DEBUG "cyc:cy_close done\n");
 #endif
 
 	CY_UNLOCK(info, flags);
@@ -2864,7 +2862,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
 	int c, ret = 0;
 
 #ifdef CY_DEBUG_IO
-	printk("cyc:cy_write ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_write ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_write")) {
@@ -2914,7 +2912,7 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch)
 	unsigned long flags;
 
 #ifdef CY_DEBUG_IO
-	printk("cyc:cy_put_char ttyC%d\n", info->line);
+	printk(KERN_DEBUG "cyc:cy_put_char ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_put_char"))
@@ -2946,7 +2944,7 @@ static void cy_flush_chars(struct tty_struct *tty)
 	struct cyclades_port *info = tty->driver_data;
 
 #ifdef CY_DEBUG_IO
-	printk("cyc:cy_flush_chars ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_flush_chars ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_flush_chars"))
@@ -2971,7 +2969,7 @@ static int cy_write_room(struct tty_struct *tty)
 	int ret;
 
 #ifdef CY_DEBUG_IO
-	printk("cyc:cy_write_room ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_write_room ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_write_room"))
@@ -2997,7 +2995,8 @@ static int cy_chars_in_buffer(struct tty_struct *tty)
 	if (!IS_CYC_Z(cy_card[card])) {
 #endif				/* Z_EXT_CHARS_IN_BUFFER */
 #ifdef CY_DEBUG_IO
-		printk("cyc:cy_chars_in_buffer ttyC%d %d\n", info->line, info->xmit_cnt);	/* */
+		printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n",
+			info->line, info->xmit_cnt);
 #endif
 		return info->xmit_cnt;
 #ifdef Z_EXT_CHARS_IN_BUFFER
@@ -3023,7 +3022,8 @@ static int cy_chars_in_buffer(struct tty_struct *tty)
 		else
 			char_count = tx_put - tx_get + tx_bufsize;
 #ifdef CY_DEBUG_IO
-		printk("cyc:cy_chars_in_buffer ttyC%d %d\n", info->line, info->xmit_cnt + char_count);	/* */
+		printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n",
+			info->line, info->xmit_cnt + char_count);
 #endif
 		return info->xmit_cnt + char_count;
 	}
@@ -3296,8 +3296,8 @@ static void set_line_char(struct cyclades_port *info)
 					  ~CyDTR);
 			}
 #ifdef CY_DEBUG_DTR
-			printk("cyc:set_line_char dropping DTR\n");
-			printk("     status: 0x%x, 0x%x\n",
+			printk(KERN_DEBUG "cyc:set_line_char dropping DTR\n");
+			printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -3310,8 +3310,8 @@ static void set_line_char(struct cyclades_port *info)
 					  CyDTR);
 			}
 #ifdef CY_DEBUG_DTR
-			printk("cyc:set_line_char raising DTR\n");
-			printk("     status: 0x%x, 0x%x\n",
+			printk(KERN_DEBUG "cyc:set_line_char raising DTR\n");
+			printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -3426,8 +3426,8 @@ static void set_line_char(struct cyclades_port *info)
 
 		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L);
 		if (retval != 0) {
-			printk("cyc:set_line_char retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:set_line_char retval on ttyC%d "
+				"was %x\n", info->line, retval);
 		}
 
 		/* CD sensitivity */
@@ -3441,20 +3441,20 @@ static void set_line_char(struct cyclades_port *info)
 			cy_writel(&ch_ctrl->rs_control,
 				  readl(&ch_ctrl->rs_control) & ~C_RS_DTR);
 #ifdef CY_DEBUG_DTR
-			printk("cyc:set_line_char dropping Z DTR\n");
+			printk(KERN_DEBUG "cyc:set_line_char dropping Z DTR\n");
 #endif
 		} else {
 			cy_writel(&ch_ctrl->rs_control,
 				  readl(&ch_ctrl->rs_control) | C_RS_DTR);
 #ifdef CY_DEBUG_DTR
-			printk("cyc:set_line_char raising Z DTR\n");
+			printk(KERN_DEBUG "cyc:set_line_char raising Z DTR\n");
 #endif
 		}
 
 		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTLM,0L);
 		if (retval != 0) {
-			printk("cyc:set_line_char(2) retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:set_line_char(2) retval on ttyC%d "
+				"was %x\n", info->line, retval);
 		}
 
 		if (info->tty) {
@@ -3702,8 +3702,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 					  CyDTR);
 			}
 #ifdef CY_DEBUG_DTR
-			printk("cyc:set_modem_info raising DTR\n");
-			printk("     status: 0x%x, 0x%x\n",
+			printk(KERN_DEBUG "cyc:set_modem_info raising DTR\n");
+			printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -3722,8 +3722,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 			}
 
 #ifdef CY_DEBUG_DTR
-			printk("cyc:set_modem_info dropping DTR\n");
-			printk("     status: 0x%x, 0x%x\n",
+			printk(KERN_DEBUG "cyc:set_modem_info dropping DTR\n");
+			printk(KERN_DEBUG "     status: 0x%x, 0x%x\n",
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
@@ -3759,7 +3759,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 					readl(&ch_ctrl[channel].rs_control) |
 					C_RS_DTR);
 #ifdef CY_DEBUG_DTR
-				printk("cyc:set_modem_info raising Z DTR\n");
+				printk(KERN_DEBUG "cyc:set_modem_info raising "
+					"Z DTR\n");
 #endif
 				CY_UNLOCK(info, flags);
 			}
@@ -3769,7 +3770,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 					readl(&ch_ctrl[channel].rs_control) &
 					~C_RS_DTR);
 #ifdef CY_DEBUG_DTR
-				printk("cyc:set_modem_info clearing Z DTR\n");
+				printk(KERN_DEBUG "cyc:set_modem_info clearing "
+					"Z DTR\n");
 #endif
 				CY_UNLOCK(info, flags);
 			}
@@ -3780,8 +3782,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 		retval = cyz_issue_cmd(&cy_card[info->card],
 					channel, C_CM_IOCTLM, 0L);
 		if (retval != 0) {
-			printk("cyc:set_modem_info retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d "
+				"was %x\n", info->line, retval);
 		}
 		CY_UNLOCK(info, flags);
 	}
@@ -3831,16 +3833,17 @@ static void cy_break(struct tty_struct *tty, int break_state)
 				info->line - cy_card[info->card].first_line,
 				C_CM_SET_BREAK, 0L);
 			if (retval != 0) {
-				printk("cyc:cy_break (set) retval on ttyC%d "
-					"was %x\n", info->line, retval);
+				printk(KERN_ERR "cyc:cy_break (set) retval on "
+					"ttyC%d was %x\n", info->line, retval);
 			}
 		} else {
 			retval = cyz_issue_cmd(&cy_card[info->card],
 				info->line - cy_card[info->card].first_line,
 				C_CM_CLR_BREAK, 0L);
 			if (retval != 0) {
-				printk("cyc:cy_break (clr) retval on ttyC%d "
-					"was %x\n", info->line, retval);
+				printk(KERN_DEBUG "cyc:cy_break (clr) retval "
+					"on ttyC%d was %x\n", info->line,
+					retval);
 			}
 		}
 	}
@@ -4004,7 +4007,8 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
 		return -ENODEV;
 
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n", info->line, cmd, arg);	/* */
+	printk(KERN_DEBUG "cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n",
+		info->line, cmd, arg);
 #endif
 
 	switch (cmd) {
@@ -4164,7 +4168,7 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
 	}
 
 #ifdef CY_DEBUG_OTHER
-	printk(" cyc:cy_ioctl done\n");
+	printk(KERN_DEBUG "cyc:cy_ioctl done\n");
 #endif
 
 	return ret_val;
@@ -4181,7 +4185,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
 	struct cyclades_port *info = tty->driver_data;
 
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_set_termios ttyC%d\n", info->line);
+	printk(KERN_DEBUG "cyc:cy_set_termios ttyC%d\n", info->line);
 #endif
 
 	if (tty->termios->c_cflag == old_termios->c_cflag &&
@@ -4251,7 +4255,7 @@ static void cy_throttle(struct tty_struct *tty)
 #ifdef CY_DEBUG_THROTTLE
 	char buf[64];
 
-	printk("cyc:throttle %s: %d....ttyC%d\n", tty_name(tty, buf),
+	printk(KERN_DEBUG "cyc:throttle %s: %ld...ttyC%d\n", tty_name(tty, buf),
 			tty->ldisc.chars_in_buffer(tty), info->line);
 #endif
 
@@ -4309,8 +4313,8 @@ static void cy_unthrottle(struct tty_struct *tty)
 #ifdef CY_DEBUG_THROTTLE
 	char buf[64];
 
-	printk("cyc:unthrottle %s: %d....ttyC%d\n", tty_name(tty, buf),
-		tty->ldisc.chars_in_buffer(tty), info->line);
+	printk(KERN_DEBUG "cyc:unthrottle %s: %ld...ttyC%d\n",
+		tty_name(tty, buf), tty->ldisc.chars_in_buffer(tty),info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_unthrottle")) {
@@ -4363,7 +4367,7 @@ static void cy_stop(struct tty_struct *tty)
 	unsigned long flags;
 
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_stop ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_stop ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_stop"))
@@ -4398,7 +4402,7 @@ static void cy_start(struct tty_struct *tty)
 	unsigned long flags;
 
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_start ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_start ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_start"))
@@ -4430,7 +4434,7 @@ static void cy_flush_buffer(struct tty_struct *tty)
 	unsigned long flags;
 
 #ifdef CY_DEBUG_IO
-	printk("cyc:cy_flush_buffer ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_flush_buffer ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_flush_buffer"))
@@ -4449,8 +4453,8 @@ static void cy_flush_buffer(struct tty_struct *tty)
 		retval =
 		    cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_TX, 0L);
 		if (retval != 0) {
-			printk("cyc: flush_buffer retval on ttyC%d was %x\n",
-				info->line, retval);
+			printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d "
+				"was %x\n", info->line, retval);
 		}
 		CY_UNLOCK(info, flags);
 	}
@@ -4465,7 +4469,7 @@ static void cy_hangup(struct tty_struct *tty)
 	struct cyclades_port *info = tty->driver_data;
 
 #ifdef CY_DEBUG_OTHER
-	printk("cyc:cy_hangup ttyC%d\n", info->line);	/* */
+	printk(KERN_DEBUG "cyc:cy_hangup ttyC%d\n", info->line);
 #endif
 
 	if (serial_paranoia_check(info, tty->name, "cy_hangup"))
@@ -4476,7 +4480,8 @@ static void cy_hangup(struct tty_struct *tty)
 	info->event = 0;
 	info->count = 0;
 #ifdef CY_DEBUG_COUNT
-	printk("cyc:cy_hangup (%d): setting count to 0\n", current->pid);
+	printk(KERN_DEBUG "cyc:cy_hangup (%d): setting count to 0\n",
+		current->pid);
 #endif
 	info->tty = NULL;
 	info->flags &= ~ASYNC_NORMAL_ACTIVE;
@@ -4569,7 +4574,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 		if (!timer_pending(&cyz_timerlist)) {
 			mod_timer(&cyz_timerlist, jiffies + 1);
 #ifdef CY_PCI_DEBUG
-			printk("Cyclades-Z polling initialized\n");
+			printk(KERN_DEBUG "Cyclades-Z polling initialized\n");
 #endif
 		}
 #endif				/* CONFIG_CYZ_INTR */
@@ -4778,18 +4783,17 @@ static int __init cy_detect_isa(void)
 			/* find out the board's irq by probing */
 			cy_isa_irq = detect_isa_irq(cy_isa_address);
 		if (cy_isa_irq == 0) {
-			printk("Cyclom-Y/ISA found at 0x%lx ",
+			printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but the "
+				"IRQ could not be detected.\n",
 				(unsigned long)cy_isa_address);
-			printk("but the IRQ could not be detected.\n");
 			continue;
 		}
 
 		if ((cy_next_channel + cy_isa_nchan) > NR_PORTS) {
-			printk("Cyclom-Y/ISA found at 0x%lx ",
+			printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but no "
+				"more channels are available. Change NR_PORTS "
+				"in cyclades.c and recompile kernel.\n",
 				(unsigned long)cy_isa_address);
-			printk("but no more channels are available.\n");
-			printk("Change NR_PORTS in cyclades.c and recompile "
-					"kernel.\n");
 			return nboard;
 		}
 		/* fill the next cy_card structure available */
@@ -4798,20 +4802,19 @@ static int __init cy_detect_isa(void)
 				break;
 		}
 		if (j == NR_CARDS) {	/* no more cy_cards available */
-			printk("Cyclom-Y/ISA found at 0x%lx ",
+			printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but no "
+				"more cards can be used. Change NR_CARDS in "
+				"cyclades.c and recompile kernel.\n",
 				(unsigned long)cy_isa_address);
-			printk("but no more cards can be used .\n");
-			printk("Change NR_CARDS in cyclades.c and recompile "
-					"kernel.\n");
 			return nboard;
 		}
 
 		/* allocate IRQ */
 		if (request_irq(cy_isa_irq, cyy_interrupt,
 				IRQF_DISABLED, "Cyclom-Y", &cy_card[j])) {
-			printk("Cyclom-Y/ISA found at 0x%lx ",
-				(unsigned long)cy_isa_address);
-			printk("but could not allocate IRQ#%d.\n", cy_isa_irq);
+			printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but "
+				"could not allocate IRQ#%d.\n",
+				(unsigned long)cy_isa_address, cy_isa_irq);
 			return nboard;
 		}
 
@@ -4825,13 +4828,12 @@ static int __init cy_detect_isa(void)
 		cy_init_card(&cy_card[j], j);
 		nboard++;
 
-		/* print message */
-		printk("Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d, ",
+		printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: "
+			"%d channels starting from port %d\n",
 			j + 1, (unsigned long)cy_isa_address,
 			(unsigned long)(cy_isa_address + (CyISA_Ywin - 1)),
-			cy_isa_irq);
-		printk("%d channels starting from port %d.\n",
-			cy_isa_nchan, cy_next_channel);
+			cy_isa_irq, cy_isa_nchan, cy_next_channel);
+
 		for (j = cy_next_channel;
 				j < cy_next_channel + cy_isa_nchan; j++)
 			tty_register_device(cy_serial_driver, j, NULL);
@@ -4869,20 +4871,15 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 	cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Ze_win);
 
 	readl(&cy_pci_addr0->mail_box_0);
-#ifdef CY_PCI_DEBUG
-	printk("Cyclades-Z/PCI: relocate winaddr=0x%lx ctladdr=0x%lx\n",
-		(ulong)cy_pci_addr2, (ulong)cy_pci_addr0);
-	printk("Cyclades-Z/PCI: New Cyclades-Z board.  FPGA not "
-			"loaded\n");
-#endif
+	dev_dbg(&pdev->dev, "new Cyclades-Z board.  FPGA not loaded\n");
+
 	/* This must be the new Cyclades-Ze/PCI. */
 	cy_pci_nchan = ZE_V1_NPORTS;
 
 	if ((cy_next_channel + cy_pci_nchan) > NR_PORTS) {
-		printk("Cyclades-Ze/PCI found at 0x%lx but no channels "
+		dev_err(&pdev->dev, "Cyclades-Ze/PCI found, but no channels "
 			"are available.\nChange NR_PORTS in cyclades.c "
-			"and recompile kernel.\n",
-			(ulong) cy_pci_phys2);
+			"and recompile kernel.\n");
 		return -EIO;
 	}
 
@@ -4892,10 +4889,9 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 			break;
 	}
 	if (j == NR_CARDS) {	/* no more cy_cards available */
-		printk("Cyclades-Ze/PCI found at 0x%lx but no more "
+		dev_err(&pdev->dev, "Cyclades-Ze/PCI found, but no more "
 			"cards can be used.\nChange NR_CARDS in "
-			"cyclades.c and recompile kernel.\n",
-			(ulong) cy_pci_phys2);
+			"cyclades.c and recompile kernel.\n");
 		return -EIO;
 	}
 #ifdef CONFIG_CYZ_INTR
@@ -4904,10 +4900,7 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 		if (request_irq(cy_pci_irq, cyz_interrupt,
 				IRQF_SHARED, "Cyclades-Z",
 				&cy_card[j])) {
-			printk("Cyclom-Ze/PCI found at 0x%lx ",
-				(ulong) cy_pci_phys2);
-			printk("but could not allocate IRQ%d.\n",
-				cy_pci_irq);
+			dev_err(&pdev->dev, "could not allocate IRQ.\n");
 			return -EIO;
 		}
 	}
@@ -4923,21 +4916,9 @@ static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
 	cy_init_card(&cy_card[j], j);
 	pci_set_drvdata(pdev, &cy_card[j]);
 
-	/* print message */
-#ifdef CONFIG_CYZ_INTR
-	/* don't report IRQ if board is no IRQ */
-	if ((cy_pci_irq != 0) && (cy_pci_irq != 255))
-		printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
-			j + 1, (ulong) cy_pci_phys2,
-			(ulong) (cy_pci_phys2 + CyPCI_Ze_win - 1), cy_pci_irq);
-	else
-#endif				/* CONFIG_CYZ_INTR */
-		printk("Cyclades-Ze/PCI #%d: 0x%lx-0x%lx, ",
-			j + 1, (ulong) cy_pci_phys2,
-			(ulong) (cy_pci_phys2 + CyPCI_Ze_win - 1));
+	dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting "
+		"from port %d.\n", j + 1, cy_pci_nchan, cy_next_channel);
 
-	printk("%d channels starting from port %d.\n",
-		cy_pci_nchan, cy_next_channel);
 	for (j = cy_next_channel; j < cy_next_channel + cy_pci_nchan; j++)
 		tty_register_device(cy_serial_driver, j, &pdev->dev);
 	cy_next_channel += cy_pci_nchan;
@@ -4972,17 +4953,10 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 
 	if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo ||
 			device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
-#ifdef CY_PCI_DEBUG
-		printk("Cyclom-Y/PCI (bus=0x0%x, pci_id=0x%x, ",
-			pdev->bus->number, pdev->devfn);
-		printk("rev_id=%d) IRQ%d\n", cyy_rev_id, cy_pci_irq);
-		printk("Cyclom-Y/PCI:found  winaddr=0x%lx "
-			"ctladdr=0x%lx\n",
-			(ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
-#endif
+		dev_dbg(&pdev->dev, "Cyclom-Y/PCI found\n");
 
 		if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
-			printk("  Warning: PCI I/O bit incorrectly "
+			dev_warn(&pdev->dev, "PCI I/O bit incorrectly "
 				"set. Ignoring it...\n");
 			pdev->resource[2].flags &= ~IORESOURCE_IO;
 		}
@@ -4992,47 +4966,33 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		   with other drivers accessing it. */
 		retval = pci_request_regions(pdev, "Cyclom-Y");
 		if (retval) {
-			printk(KERN_ERR "cyclades: failed to reserve "
-					"PCI resources\n");
+			dev_err(&pdev->dev, "failed to reserve resources\n");
 			return retval;
 		}
 #if defined(__alpha__)
 		if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) {	/* below 1M? */
-			printk("Cyclom-Y/PCI (bus=0x0%x, pci_id=0x%x, ",
-				pdev->bus->number, pdev->devfn);
-			printk("rev_id=%d) IRQ%d\n",
-				cyy_rev_id, cy_pci_irq);
-			printk("Cyclom-Y/PCI:found  winaddr=0x%lx "
-				"ctladdr=0x%lx\n",
-				(ulong)cy_pci_phys2,
-				(ulong)cy_pci_phys0);
-			printk("Cyclom-Y/PCI not supported for low "
-				"addresses in Alpha systems.\n");
+			dev_err(&pdev->dev, "Cyclom-Y/PCI not supported for "
+				"low addresses on Alpha systems.\n");
 			return -EIO;
 		}
 #endif
 		cy_pci_addr0 = pci_iomap(pdev, 0, CyPCI_Yctl);
 		cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Ywin);
 
-#ifdef CY_PCI_DEBUG
-		printk("Cyclom-Y/PCI: relocate winaddr=0x%lx "
-			"ctladdr=0x%lx\n",
-			(u_long)cy_pci_addr2, (u_long)cy_pci_addr0);
-#endif
+		dev_dbg(&pdev->dev, "Cyclom-Y/PCI: relocate winaddr=0x%p "
+			"ctladdr=0x%p\n", cy_pci_addr2, cy_pci_addr0);
+
 		cy_pci_nchan = (unsigned short)(CyPORTS_PER_CHIP *
 				cyy_init_card(cy_pci_addr2, 1));
 		if (cy_pci_nchan == 0) {
-			printk("Cyclom-Y PCI host card with ");
-			printk("no Serial-Modules at 0x%lx.\n",
-				(ulong) cy_pci_phys2);
+			dev_err(&pdev->dev, "Cyclom-Y PCI host card with no "
+					"Serial-Modules\n");
 			return -EIO;
 		}
 		if ((cy_next_channel + cy_pci_nchan) > NR_PORTS) {
-			printk("Cyclom-Y/PCI found at 0x%lx ",
-				(ulong) cy_pci_phys2);
-			printk("but no channels are available.\n");
-			printk("Change NR_PORTS in cyclades.c and "
-					"recompile kernel.\n");
+			dev_err(&pdev->dev, "Cyclom-Y/PCI found, but no "
+				"channels are available. Change NR_PORTS in "
+				"cyclades.c and recompile kernel.\n");
 			return -EIO;
 		}
 		/* fill the next cy_card structure available */
@@ -5041,11 +5001,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 				break;
 		}
 		if (j == NR_CARDS) {	/* no more cy_cards available */
-			printk("Cyclom-Y/PCI found at 0x%lx ",
-				(ulong) cy_pci_phys2);
-			printk("but no more cards can be used.\n");
-			printk("Change NR_CARDS in cyclades.c and "
-					"recompile kernel.\n");
+			dev_err(&pdev->dev, "Cyclom-Y/PCI found, but no more "
+				"cards can be used. Change NR_CARDS in "
+				"cyclades.c and recompile kernel.\n");
 			return -EIO;
 		}
 
@@ -5053,10 +5011,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		retval = request_irq(cy_pci_irq, cyy_interrupt,
 				IRQF_SHARED, "Cyclom-Y", &cy_card[j]);
 		if (retval) {
-			printk("Cyclom-Y/PCI found at 0x%lx ",
-				(ulong) cy_pci_phys2);
-			printk("but could not allocate IRQ%d.\n",
-				cy_pci_irq);
+			dev_err(&pdev->dev, "could not allocate IRQ\n");
 			return retval;
 		}
 
@@ -5096,37 +5051,22 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 			break;
 		}
 
-		/* print message */
-		printk("Cyclom-Y/PCI #%d: 0x%lx-0x%lx, IRQ%d, ",
-			j + 1, (ulong)cy_pci_phys2,
-			(ulong) (cy_pci_phys2 + CyPCI_Ywin - 1), cy_pci_irq);
-		printk("%d channels starting from port %d.\n",
-			cy_pci_nchan, cy_next_channel);
+		dev_info(&pdev->dev, "Cyclom-Y/PCI #%d found: %d channels "
+			"starting from port %d.\n", j + 1, cy_pci_nchan,
+			cy_next_channel);
+
 		for (j = cy_next_channel;
 				j < cy_next_channel + cy_pci_nchan; j++)
 			tty_register_device(cy_serial_driver, j, &pdev->dev);
 
 		cy_next_channel += cy_pci_nchan;
 	} else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo) {
-		/* print message */
-		printk("Cyclades-Z/PCI (bus=0x0%x, pci_id=0x%x, ",
-			pdev->bus->number, pdev->devfn);
-		printk("rev_id=%d) IRQ%d\n", cyy_rev_id, cy_pci_irq);
-		printk("Cyclades-Z/PCI: found winaddr=0x%lx "
-			"ctladdr=0x%lx\n",
-			(ulong)cy_pci_phys2, (ulong)cy_pci_phys0);
-		printk("Cyclades-Z/PCI not supported for low "
-			"addresses\n");
+		dev_err(&pdev->dev, "Cyclades-Z/PCI not supported for "
+			"low addresses\n");
 		return -EIO;
 	} else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi) {
-#ifdef CY_PCI_DEBUG
-		printk("Cyclades-Z/PCI (bus=0x0%x, pci_id=0x%x, ",
-			pdev->bus->number, pdev->devfn);
-		printk("rev_id=%d) IRQ%d\n", cyy_rev_id, cy_pci_irq);
-		printk("Cyclades-Z/PCI: found winaddr=0x%lx "
-			"ctladdr=0x%lx\n",
-			(ulong) cy_pci_phys2, (ulong) cy_pci_phys0);
-#endif
+		dev_dbg(&pdev->dev, "Cyclades-Z/PCI found\n");
+
 		cy_pci_addr0 = pci_iomap(pdev, 0, CyPCI_Zctl);
 
 		/* Disable interrupts on the PLX before resetting it */
@@ -5145,7 +5085,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 				cy_pci_addr0)->mail_box_0);
 
 		if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
-			printk("  Warning: PCI I/O bit incorrectly "
+			dev_warn(&pdev->dev, "PCI I/O bit incorrectly "
 				"set. Ignoring it...\n");
 			pdev->resource[2].flags &= ~IORESOURCE_IO;
 		}
@@ -5155,8 +5095,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		   with other drivers accessing it. */
 		retval = pci_request_regions(pdev, "Cyclades-Z");
 		if (retval) {
-			printk(KERN_ERR "cyclades: failed to reserve "
-				"PCI resources\n");
+			dev_err(&pdev->dev, "failed to reserve resources\n");
 			return retval;
 		}
 
@@ -5168,28 +5107,24 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 			cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Zwin);
 		}
 
+		dev_dbg(&pdev->dev, "Cyclades-Z/PCI: relocate winaddr=0x%p "
+			"ctladdr=0x%p\n", cy_pci_addr2, cy_pci_addr0);
 #ifdef CY_PCI_DEBUG
-		printk("Cyclades-Z/PCI: relocate winaddr=0x%lx "
-			"ctladdr=0x%lx\n",
-			(ulong) cy_pci_addr2, (ulong) cy_pci_addr0);
 		if (mailbox == ZO_V1) {
 			cy_writel(&((struct RUNTIME_9060 *)
 				(cy_pci_addr0))->loc_addr_base,
 				WIN_CREG);
-			printk("Cyclades-8Zo/PCI: FPGA id %lx, ver "
-				"%lx\n", (ulong) (0xff &
-				readl(&((struct CUSTOM_REG *)
-					(cy_pci_addr2))->fpga_id)),
-				(ulong)(0xff &
+			dev_info(&pdev->dev, "Cyclades-8Zo/PCI: FPGA id %lx, "
+				"ver %lx\n", (ulong)(0xff &
 				readl(&((struct CUSTOM_REG *)
-					(cy_pci_addr2))->
-						fpga_version)));
+					cy_pci_addr2)->fpga_id)),
+				(ulong)(0xff & readl(&((struct CUSTOM_REG *)
+					cy_pci_addr2)->fpga_version)));
 			cy_writel(&((struct RUNTIME_9060 *)
-				(cy_pci_addr0))->loc_addr_base,
-				WIN_RAM);
+				cy_pci_addr0)->loc_addr_base, WIN_RAM);
 		} else {
-			printk("Cyclades-Z/PCI: New Cyclades-Z board.  "
-					"FPGA not loaded\n");
+			dev_info(&pdev->dev, "Cyclades-Z/PCI: New Cyclades-Z "
+				"board.  FPGA not loaded\n");
 		}
 #endif
 		/* The following clears the firmware id word.  This
@@ -5205,10 +5140,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		cy_pci_nchan = 8;
 
 		if ((cy_next_channel + cy_pci_nchan) > NR_PORTS) {
-			printk("Cyclades-8Zo/PCI found at 0x%lx but"
-				"no channels are available.\nChange "
-				"NR_PORTS in cyclades.c and recompile "
-				"kernel.\n", (ulong)cy_pci_phys2);
+			dev_err(&pdev->dev, "Cyclades-8Zo/PCI found, but no "
+				"channels are available. Change NR_PORTS in "
+				"cyclades.c and recompile kernel.\n");
 			return -EIO;
 		}
 
@@ -5218,10 +5152,9 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 				break;
 		}
 		if (j == NR_CARDS) {	/* no more cy_cards available */
-			printk("Cyclades-8Zo/PCI found at 0x%lx but"
-				"no more cards can be used.\nChange "
-				"NR_CARDS in cyclades.c and recompile "
-				"kernel.\n", (ulong)cy_pci_phys2);
+			dev_err(&pdev->dev, "Cyclades-8Zo/PCI found, but no "
+				"more cards can be used. Change NR_CARDS in "
+				"cyclades.c and recompile kernel.\n");
 			return -EIO;
 		}
 #ifdef CONFIG_CYZ_INTR
@@ -5231,10 +5164,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 					IRQF_SHARED, "Cyclades-Z",
 					&cy_card[j]);
 			if (retval) {
-				printk("Cyclom-8Zo/PCI found at 0x%lx "
-					"but could not allocate "
-					"IRQ%d.\n", (ulong)cy_pci_phys2,
-					cy_pci_irq);
+				dev_err(&pdev->dev, "could not allocate IRQ\n");
 				return retval;
 			}
 		}
@@ -5250,22 +5180,10 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		cy_init_card(&cy_card[j], j);
 		pci_set_drvdata(pdev, &cy_card[j]);
 
-		/* print message */
-#ifdef CONFIG_CYZ_INTR
-		/* don't report IRQ if board is no IRQ */
-		if ((cy_pci_irq != 0) && (cy_pci_irq != 255))
-			printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, "
-				"IRQ%d, ", j + 1, (ulong)cy_pci_phys2,
-				(ulong) (cy_pci_phys2 + CyPCI_Zwin - 1),
-				cy_pci_irq);
-		else
-#endif				/* CONFIG_CYZ_INTR */
-			printk("Cyclades-8Zo/PCI #%d: 0x%lx-0x%lx, ",
-				j + 1, (ulong)cy_pci_phys2,
-				(ulong)(cy_pci_phys2 + CyPCI_Zwin - 1));
+		dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels "
+			"starting from port %d.\n", j + 1, cy_pci_nchan,
+			cy_next_channel);
 
-		printk("%d channels starting from port %d.\n",
-				cy_pci_nchan, cy_next_channel);
 		for (j = cy_next_channel;
 				j < cy_next_channel + cy_pci_nchan; j++)
 			tty_register_device(cy_serial_driver, j, &pdev->dev);
@@ -5320,16 +5238,6 @@ static struct pci_driver cy_pci_driver = {
 };
 #endif
 
-/*
- * This routine prints out the appropriate serial driver version number
- * and identifies which options were configured into this driver.
- */
-static inline void show_version(void)
-{
-	printk("Cyclades driver " CY_VERSION "\n");
-	printk("        built %s %s\n", __DATE__, __TIME__);
-}				/* show_version */
-
 static int
 cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
 		int *eof, void *data)
@@ -5436,7 +5344,9 @@ static int __init cy_init(void)
 	cy_serial_driver = alloc_tty_driver(NR_PORTS);
 	if (!cy_serial_driver)
 		goto err;
-	show_version();
+
+	printk(KERN_INFO "Cyclades driver " CY_VERSION " (built %s %s)\n",
+			__DATE__, __TIME__);
 
 	/* Initialize the tty_driver structure */
 
@@ -5505,8 +5415,8 @@ static void __exit cy_cleanup_module(void)
 #endif /* CONFIG_CYZ_INTR */
 
 	if ((e1 = tty_unregister_driver(cy_serial_driver)))
-		printk("cyc: failed to unregister Cyclades serial driver(%d)\n",
-			e1);
+		printk(KERN_ERR "failed to unregister Cyclades serial "
+				"driver(%d)\n", e1);
 
 	put_tty_driver(cy_serial_driver);
 

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 8/21] Char: cyclades, mark cyy_init_card as __devinit, not __init
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (5 preceding siblings ...)
  2007-04-29 20:57 ` [PATCH 7/21] Char: cyclades, printk cleanups Jiri Slaby
@ 2007-04-29 20:58 ` Jiri Slaby
  2007-04-29 20:59 ` [PATCH 9/21] Char: cyclades, simplify variables initialization Jiri Slaby
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:58 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, mark cyy_init_card as __devinit, not __init

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 289b6204e150db7f487f53c227318b950b29d863
tree 5772496b7ff3f5c7daa36f507d3f8012d5fa4023
parent af4b7e8923a0ea9ca7427667977500484a3ca661
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 20:46:40 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:47:04 +0200

 drivers/char/cyclades.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 7a15300..738903d 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4651,8 +4651,8 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 
 /* initialize chips on Cyclom-Y card -- return number of valid
    chips (which is number of ports/4) */
-static unsigned short __init
-cyy_init_card(void __iomem * true_base_addr, int index)
+static unsigned short __devinit cyy_init_card(void __iomem *true_base_addr,
+		int index)
 {
 	unsigned int chip_number;
 	void __iomem *base_addr;

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 9/21] Char: cyclades, simplify variables initialization
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (6 preceding siblings ...)
  2007-04-29 20:58 ` [PATCH 8/21] Char: cyclades, mark cyy_init_card as __devinit, not __init Jiri Slaby
@ 2007-04-29 20:59 ` Jiri Slaby
  2007-04-29 20:59 ` [PATCH 10/21] Char: cyclades, get rid of phys addresses Jiri Slaby
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, simplify variables initialization

- do not init static variables to 0
- simplify cy_init_card -- use memset(0) and do not zero each element
  separately, also reorder init, so that same entries are inited at one
  place

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 5bd7a7ad3eaafc9d8d03bd1488650b210c03f613
tree 46cb0c86eba349d6079d294359f8e36ff8526c71
parent 289b6204e150db7f487f53c227318b950b29d863
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 22:02:36 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:47:12 +0200

 drivers/char/cyclades.c |  156 +++++++++++++----------------------------------
 1 files changed, 44 insertions(+), 112 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 738903d..9088c93 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -718,8 +718,8 @@ static unsigned int cy_isa_addresses[] = {
 #define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses)
 
 #ifdef MODULE
-static long maddr[NR_CARDS] = { 0, };
-static int irq[NR_CARDS] = { 0, };
+static long maddr[NR_CARDS];
+static int irq[NR_CARDS];
 
 module_param_array(maddr, long, NULL, 0);
 module_param_array(irq, int, NULL, 0);
@@ -4505,6 +4505,8 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 	unsigned short chip_number;
 	int index, port;
 
+	spin_lock_init(&cinfo->card_lock);
+
 	if (IS_CYC_Z(*cinfo)) {	/* Cyclades-Z */
 		mailbox = readl(&((struct RUNTIME_9060 __iomem *)
 				     cinfo->ctl_addr)->mail_box_0);
@@ -4512,104 +4514,47 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 		cinfo->intr_enabled = 0;
 		cinfo->nports = 0;	/* Will be correctly set later, after
 					   Z FW is loaded */
-		spin_lock_init(&cinfo->card_lock);
-		for (port = cinfo->first_line;
-		     port < cinfo->first_line + nports; port++) {
-			info = &cy_port[port];
-			info->magic = CYCLADES_MAGIC;
+	} else {
+		index = cinfo->bus_index;
+		nports = cinfo->nports = CyPORTS_PER_CHIP * cinfo->num_chips;
+	}
+
+	for (port = cinfo->first_line; port < cinfo->first_line + nports;
+			port++) {
+		info = &cy_port[port];
+		memset(info, 0, sizeof(*info));
+		info->magic = CYCLADES_MAGIC;
+		info->card = board;
+		info->line = port;
+		info->flags = STD_COM_FLAGS;
+		info->closing_wait = CLOSING_WAIT_DELAY;
+		info->close_delay = 5 * HZ / 10;
+
+		INIT_WORK(&info->tqueue, do_softint);
+		init_waitqueue_head(&info->open_wait);
+		init_waitqueue_head(&info->close_wait);
+		init_waitqueue_head(&info->shutdown_wait);
+		init_waitqueue_head(&info->delta_msr_wait);
+
+		if (IS_CYC_Z(*cinfo)) {
 			info->type = PORT_STARTECH;
-			info->card = board;
-			info->line = port;
-			info->chip_rev = 0;
-			info->flags = STD_COM_FLAGS;
-			info->tty = NULL;
 			if (mailbox == ZO_V1)
 				info->xmit_fifo_size = CYZ_FIFO_SIZE;
 			else
-				info->xmit_fifo_size =
-				    4 * CYZ_FIFO_SIZE;
-			info->cor1 = 0;
-			info->cor2 = 0;
-			info->cor3 = 0;
-			info->cor4 = 0;
-			info->cor5 = 0;
-			info->tbpr = 0;
-			info->tco = 0;
-			info->rbpr = 0;
-			info->rco = 0;
-			info->custom_divisor = 0;
-			info->close_delay = 5 * HZ / 10;
-			info->closing_wait = CLOSING_WAIT_DELAY;
-			info->icount.cts = info->icount.dsr =
-			    info->icount.rng = info->icount.dcd = 0;
-			info->icount.rx = info->icount.tx = 0;
-			info->icount.frame = info->icount.parity = 0;
-			info->icount.overrun = info->icount.brk = 0;
-			info->x_char = 0;
-			info->event = 0;
-			info->count = 0;
-			info->blocked_open = 0;
-			info->default_threshold = 0;
-			info->default_timeout = 0;
-			INIT_WORK(&info->tqueue, do_softint);
-			init_waitqueue_head(&info->open_wait);
-			init_waitqueue_head(&info->close_wait);
-			init_waitqueue_head(&info->shutdown_wait);
-			init_waitqueue_head(&info->delta_msr_wait);
-			/* info->session */
-			/* info->pgrp */
-			info->read_status_mask = 0;
-			/* info->timeout */
-			/* Bentson's vars */
-			info->jiffies[0] = 0;
-			info->jiffies[1] = 0;
-			info->jiffies[2] = 0;
-			info->rflush_count = 0;
+				info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE;
 #ifdef CONFIG_CYZ_INTR
 			init_timer(&cyz_rx_full_timer[port]);
 			cyz_rx_full_timer[port].function = NULL;
 #endif
-		}
-#ifndef CONFIG_CYZ_INTR
-		if (!timer_pending(&cyz_timerlist)) {
-			mod_timer(&cyz_timerlist, jiffies + 1);
-#ifdef CY_PCI_DEBUG
-			printk(KERN_DEBUG "Cyclades-Z polling initialized\n");
-#endif
-		}
-#endif				/* CONFIG_CYZ_INTR */
-
-	} else {	/* Cyclom-Y of some kind */
-		index = cinfo->bus_index;
-		spin_lock_init(&cinfo->card_lock);
-		cinfo->nports = CyPORTS_PER_CHIP * cinfo->num_chips;
-		for (port = cinfo->first_line;
-		     port < cinfo->first_line + cinfo->nports; port++) {
-			info = &cy_port[port];
-			info->magic = CYCLADES_MAGIC;
+		} else {
 			info->type = PORT_CIRRUS;
-			info->card = board;
-			info->line = port;
-			info->flags = STD_COM_FLAGS;
-			info->tty = NULL;
 			info->xmit_fifo_size = CyMAX_CHAR_FIFO;
-			info->cor1 =
-			    CyPARITY_NONE | Cy_1_STOP | Cy_8_BITS;
+			info->cor1 = CyPARITY_NONE | Cy_1_STOP | Cy_8_BITS;
 			info->cor2 = CyETC;
 			info->cor3 = 0x08;	/* _very_ small rcv threshold */
-			info->cor4 = 0;
-			info->cor5 = 0;
-			info->custom_divisor = 0;
-			info->close_delay = 5 * HZ / 10;
-			info->closing_wait = CLOSING_WAIT_DELAY;
-			info->icount.cts = info->icount.dsr =
-			    info->icount.rng = info->icount.dcd = 0;
-			info->icount.rx = info->icount.tx = 0;
-			info->icount.frame = info->icount.parity = 0;
-			info->icount.overrun = info->icount.brk = 0;
+
 			chip_number = (port - cinfo->first_line) / 4;
-			if ((info->chip_rev =
-			     readb(cinfo->base_addr +
+			if ((info->chip_rev = readb(cinfo->base_addr +
 				      (cy_chip_offset[chip_number] <<
 				       index) + (CyGFRCR << index))) >=
 			    CD1400_REV_J) {
@@ -4618,35 +4563,28 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 				info->tco = baud_co_60[13];	/* Tx CO */
 				info->rbpr = baud_bpr_60[13];	/* Rx BPR */
 				info->rco = baud_co_60[13];	/* Rx CO */
-				info->rflow = 0;
 				info->rtsdtr_inv = 1;
 			} else {
 				info->tbpr = baud_bpr_25[13];	/* Tx BPR */
 				info->tco = baud_co_25[13];	/* Tx CO */
 				info->rbpr = baud_bpr_25[13];	/* Rx BPR */
 				info->rco = baud_co_25[13];	/* Rx CO */
-				info->rflow = 0;
 				info->rtsdtr_inv = 0;
 			}
-			info->x_char = 0;
-			info->event = 0;
-			info->count = 0;
-			info->blocked_open = 0;
-			info->default_threshold = 0;
-			info->default_timeout = 0;
-			INIT_WORK(&info->tqueue, do_softint);
-			init_waitqueue_head(&info->open_wait);
-			init_waitqueue_head(&info->close_wait);
-			init_waitqueue_head(&info->shutdown_wait);
-			init_waitqueue_head(&info->delta_msr_wait);
-			/* info->session */
-			/* info->pgrp */
-			info->read_status_mask =
-			    CyTIMEOUT | CySPECHAR | CyBREAK
-			    | CyPARITY | CyFRAME | CyOVERRUN;
-			/* info->timeout */
+			info->read_status_mask = CyTIMEOUT | CySPECHAR |
+				CyBREAK | CyPARITY | CyFRAME | CyOVERRUN;
 		}
+
 	}
+
+#ifndef CONFIG_CYZ_INTR
+	if (IS_CYC_Z(*cinfo) && !timer_pending(&cyz_timerlist)) {
+		mod_timer(&cyz_timerlist, jiffies + 1);
+#ifdef CY_PCI_DEBUG
+		printk(KERN_DEBUG "Cyclades-Z polling initialized\n");
+#endif
+	}
+#endif
 }
 
 /* initialize chips on Cyclom-Y card -- return number of valid
@@ -5369,12 +5307,6 @@ static int __init cy_init(void)
 		goto err_frtty;
 	}
 
-	for (i = 0; i < NR_CARDS; i++) {
-		/* base_addr=0 indicates board not found */
-		cy_card[i].base_addr = NULL;
-	}
-
-	/* invalidate remaining cy_port structures */
 	for (i = 0; i < NR_PORTS; i++) {
 		cy_port[i].line = -1;
 		cy_port[i].magic = -1;

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 10/21] Char: cyclades, get rid of phys addresses
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (7 preceding siblings ...)
  2007-04-29 20:59 ` [PATCH 9/21] Char: cyclades, simplify variables initialization Jiri Slaby
@ 2007-04-29 20:59 ` Jiri Slaby
  2007-04-29 21:00 ` [PATCH 11/21] Char: cyclades, make info->card a pointer Jiri Slaby
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 20:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, get rid of phys addresses

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 17c85217155fbe44ff70ddf1912af5bc87fbb559
tree 3d7dc0a43bc4a1e9f2e93016724df71ec836b30a
parent 5bd7a7ad3eaafc9d8d03bd1488650b210c03f613
author Jiri Slaby <jirislaby@gmail.com> Wed, 25 Apr 2007 22:17:24 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:12 +0200

 drivers/char/cyclades.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 9088c93..01c835a 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4797,9 +4797,7 @@ static void __devinit plx_init(void __iomem * addr, __u32 initctl)
 	cy_writel(addr + initctl, readl(addr + initctl) & ~0x20000000);
 }
 
-static int __devinit cy_init_Ze(unsigned long cy_pci_phys0,
-		unsigned long cy_pci_phys2,
-		struct RUNTIME_9060 __iomem *cy_pci_addr0,
+static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0,
 		int cy_pci_irq, struct pci_dev *pdev)
 {
 	void __iomem *cy_pci_addr2;
@@ -4869,7 +4867,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 {
 	unsigned char cyy_rev_id;
 	int cy_pci_irq;
-	__u32 cy_pci_phys0, cy_pci_phys2, mailbox;
+	__u32 mailbox;
 	void __iomem *cy_pci_addr0, *cy_pci_addr2;
 	unsigned int device_id;
 	unsigned short j, cy_pci_nchan, plx_ver;
@@ -4883,8 +4881,6 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 
 	/* read PCI configuration area */
 	cy_pci_irq = pdev->irq;
-	cy_pci_phys0 = pci_resource_start(pdev, 0);
-	cy_pci_phys2 = pci_resource_start(pdev, 2);
 	pci_read_config_byte(pdev, PCI_REVISION_ID, &cyy_rev_id);
 
 	device_id = pdev->device & ~PCI_DEVICE_ID_MASK;
@@ -5038,8 +5034,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		}
 
 		if (mailbox == ZE_V1) {
-			retval = cy_init_Ze(cy_pci_phys0, cy_pci_phys2,
-					cy_pci_addr0, cy_pci_irq, pdev);
+			retval = cy_init_Ze(cy_pci_addr0, cy_pci_irq, pdev);
 			return retval;
 		} else {
 			cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Zwin);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 11/21] Char: cyclades, make info->card a pointer
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (8 preceding siblings ...)
  2007-04-29 20:59 ` [PATCH 10/21] Char: cyclades, get rid of phys addresses Jiri Slaby
@ 2007-04-29 21:00 ` Jiri Slaby
  2007-04-29 21:01 ` [PATCH 12/21] Char: cyclades, remove sleep_on Jiri Slaby
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:00 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, make info->card a pointer

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit fcc653d03162d0c14053a2fca345ae8aa1eff924
tree f1b9d6dec6104c1c53e9f533a8a378f22f86e63b
parent 17c85217155fbe44ff70ddf1912af5bc87fbb559
author Jiri Slaby <jirislaby@gmail.com> Thu, 26 Apr 2007 00:03:55 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:14 +0200

 drivers/char/cyclades.c  |  323 +++++++++++++++++++++++-----------------------
 include/linux/cyclades.h |    2 
 2 files changed, 163 insertions(+), 162 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 01c835a..9bec4ef 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -655,12 +655,12 @@
 
 #define	CY_LOCK(info,flags)					\
 		do {						\
-		spin_lock_irqsave(&cy_card[info->card].card_lock, flags); \
+		spin_lock_irqsave(&info->card->card_lock, flags); \
 		} while (0)
 
 #define	CY_UNLOCK(info,flags)					\
 		do {						\
-		spin_unlock_irqrestore(&cy_card[info->card].card_lock, flags); \
+		spin_unlock_irqrestore(&info->card->card_lock, flags); \
 		} while (0)
 
 #include <linux/kernel.h>
@@ -1555,7 +1555,7 @@ static void
 cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 		struct BUF_CTRL __iomem *buf_ctrl)
 {
-	struct cyclades_card *cinfo = &cy_card[info->card];
+	struct cyclades_card *cinfo = info->card;
 	struct tty_struct *tty = info->tty;
 	int char_count;
 	int len;
@@ -1651,7 +1651,7 @@ static void
 cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 		struct BUF_CTRL __iomem *buf_ctrl)
 {
-	struct cyclades_card *cinfo = &cy_card[info->card];
+	struct cyclades_card *cinfo = info->card;
 	struct tty_struct *tty = info->tty;
 	char data;
 	int char_count;
@@ -1878,13 +1878,13 @@ static irqreturn_t cyz_interrupt(int irq, void *dev_id)
 static void cyz_rx_restart(unsigned long arg)
 {
 	struct cyclades_port *info = (struct cyclades_port *)arg;
+	struct cyclades_card *card = info->card;
 	int retval;
-	int card = info->card;
-	__u32 channel = (info->line) - (cy_card[card].first_line);
+	__u32 channel = info->line - card->first_line;
 	unsigned long flags;
 
 	CY_LOCK(info, flags);
-	retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK2, 0L);
+	retval = cyz_issue_cmd(card, channel, C_CM_INTBACK2, 0L);
 	if (retval != 0) {
 		printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n",
 			info->line, retval);
@@ -1956,14 +1956,15 @@ static void cyz_poll(unsigned long arg)
  */
 static int startup(struct cyclades_port *info)
 {
+	struct cyclades_card *card;
 	unsigned long flags;
 	int retval = 0;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 	unsigned long page;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
+	channel = info->line - card->first_line;
 
 	page = get_zeroed_page(GFP_KERNEL);
 	if (!page)
@@ -1993,12 +1994,11 @@ static int startup(struct cyclades_port *info)
 
 	set_line_char(info);
 
-	if (!IS_CYC_Z(cy_card[card])) {
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr = cy_card[card].base_addr +
-				(cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 #ifdef CY_DEBUG_OPEN
 		printk(KERN_DEBUG "cyc startup card %d, chip %d, channel %d, "
@@ -2050,14 +2050,14 @@ static int startup(struct cyclades_port *info)
 		struct CH_CTRL __iomem *ch_ctrl;
 		int retval;
 
-		base_addr = cy_card[card].base_addr;
+		base_addr = card->base_addr;
 
 		firm_id = base_addr + ID_ADDRESS;
-		if (!ISZLOADED(cy_card[card])) {
+		if (!ISZLOADED(*card)) {
 			return -ENODEV;
 		}
 
-		zfw_ctrl = cy_card[card].base_addr +
+		zfw_ctrl = card->base_addr +
 				(readl(&firm_id->zfwctrl_addr) & 0xfffff);
 		board_ctrl = &zfw_ctrl->board_ctrl;
 		ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -2088,15 +2088,14 @@ static int startup(struct cyclades_port *info)
 #endif				/* CONFIG_CYZ_INTR */
 #endif				/* Z_WAKE */
 
-		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_IOCTL, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:startup(1) retval on ttyC%d was "
 				"%x\n", info->line, retval);
 		}
 
 		/* Flush RX buffers before raising DTR and RTS */
-		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_RX,
-				0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_RX, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:startup(2) retval on ttyC%d was "
 				"%x\n", info->line, retval);
@@ -2107,7 +2106,7 @@ static int startup(struct cyclades_port *info)
 		cy_writel(&ch_ctrl[channel].rs_control,
 			readl(&ch_ctrl[channel].rs_control) | C_RS_RTS |
 			C_RS_DTR);
-		retval = cyz_issue_cmd(&cy_card[info->card], channel,
+		retval = cyz_issue_cmd(info->card, channel,
 				C_CM_IOCTLM, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was "
@@ -2145,18 +2144,18 @@ errout:
 
 static void start_xmit(struct cyclades_port *info)
 {
+	struct cyclades_card *card;
 	unsigned long flags;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr = cy_card[card].base_addr +
-				(cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
 		cy_writeb(base_addr + (CyCAR << index), channel);
@@ -2168,8 +2167,7 @@ static void start_xmit(struct cyclades_port *info)
 		int retval;
 
 		CY_LOCK(info, flags);
-		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_INTBACK,
-				0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_INTBACK, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was "
 				"%x\n", info->line, retval);
@@ -2187,22 +2185,22 @@ static void start_xmit(struct cyclades_port *info)
  */
 static void shutdown(struct cyclades_port *info)
 {
+	struct cyclades_card *card;
 	unsigned long flags;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 
 	if (!(info->flags & ASYNC_INITIALIZED)) {
 		return;
 	}
 
 	card = info->card;
-	channel = info->line - cy_card[card].first_line;
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr = cy_card[card].base_addr +
-				(cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 #ifdef CY_DEBUG_OPEN
 		printk(KERN_DEBUG "cyc shutdown Y card %d, chip %d, "
@@ -2248,18 +2246,18 @@ static void shutdown(struct cyclades_port *info)
 		struct CH_CTRL __iomem *ch_ctrl;
 		int retval;
 
-		base_addr = cy_card[card].base_addr;
+		base_addr = card->base_addr;
 #ifdef CY_DEBUG_OPEN
 		printk(KERN_DEBUG "cyc shutdown Z card %d, channel %d, "
 			"base_addr %p\n", card, channel, base_addr);
 #endif
 
 		firm_id = base_addr + ID_ADDRESS;
-		if (!ISZLOADED(cy_card[card])) {
+		if (!ISZLOADED(*card)) {
 			return;
 		}
 
-		zfw_ctrl = cy_card[card].base_addr +
+		zfw_ctrl = card->base_addr +
 				(readl(&firm_id->zfwctrl_addr) & 0xfffff);
 		board_ctrl = &zfw_ctrl->board_ctrl;
 		ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -2277,7 +2275,7 @@ static void shutdown(struct cyclades_port *info)
 			cy_writel(&ch_ctrl[channel].rs_control,
 				(__u32)(readl(&ch_ctrl[channel].rs_control) &
 					~(C_RS_RTS | C_RS_DTR)));
-			retval = cyz_issue_cmd(&cy_card[info->card], channel,
+			retval = cyz_issue_cmd(info->card, channel,
 					C_CM_IOCTLM, 0L);
 			if (retval != 0) {
 				printk(KERN_ERR"cyc:shutdown retval on ttyC%d "
@@ -2318,7 +2316,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 	int retval;
 	void __iomem *base_addr;
 
-	cinfo = &cy_card[info->card];
+	cinfo = info->card;
 	channel = info->line - cinfo->first_line;
 
 	/*
@@ -2443,7 +2441,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				cy_writel(&ch_ctrl[channel].rs_control,
 					readl(&ch_ctrl[channel].rs_control) |
 					C_RS_RTS | C_RS_DTR);
-				retval = cyz_issue_cmd(&cy_card[info->card],
+				retval = cyz_issue_cmd(info->card,
 					channel, C_CM_IOCTLM, 0L);
 				if (retval != 0) {
 					printk(KERN_ERR "cyc:block_til_ready "
@@ -2522,8 +2520,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 	   treat it as absent from the system.  This
 	   will make the user pay attention.
 	 */
-	if (IS_CYC_Z(cy_card[info->card])) {
-		struct cyclades_card *cinfo = &cy_card[info->card];
+	if (IS_CYC_Z(*info->card)) {
+		struct cyclades_card *cinfo = info->card;
 		struct FIRM_ID __iomem *firm_id = cinfo->base_addr + ID_ADDRESS;
 
 		if (!ISZLOADED(*cinfo)) {
@@ -2634,9 +2632,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
  */
 static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 {
+	struct cyclades_card *card;
 	struct cyclades_port *info = tty->driver_data;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 	unsigned long orig_jiffies;
 	int char_time;
 
@@ -2679,13 +2678,12 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 		timeout, char_time, jiffies);
 #endif
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = (info->line) - (card->first_line);
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 		while (readb(base_addr + (CySRER << index)) & CyTxRdy) {
 #ifdef CY_DEBUG_WAIT_UNTIL_SENT
 			printk(KERN_DEBUG "Not clean (jiff=%lu)...", jiffies);
@@ -2771,10 +2769,10 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 	}
 	CY_LOCK(info, flags);
 
-	if (!IS_CYC_Z(cy_card[info->card])) {
-		int channel = info->line - cy_card[info->card].first_line;
-		int index = cy_card[info->card].bus_index;
-		void __iomem *base_addr = cy_card[info->card].base_addr +
+	if (!IS_CYC_Z(*info->card)) {
+		int channel = info->line - info->card->first_line;
+		int index = info->card->bus_index;
+		void __iomem *base_addr = info->card->base_addr +
 			(cy_chip_offset[channel >> 2] << index);
 		/* Stop accepting input */
 		channel &= 0x03;
@@ -2791,16 +2789,16 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 	} else {
 #ifdef Z_WAKE
 		/* Waiting for on-board buffers to be empty before closing the port */
-		void __iomem *base_addr = cy_card[info->card].base_addr;
+		void __iomem *base_addr = info->card->base_addr;
 		struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
 		struct ZFW_CTRL __iomem *zfw_ctrl =
 		    base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
 		struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl;
-		int channel = info->line - cy_card[info->card].first_line;
+		int channel = info->line - info->card->first_line;
 		int retval;
 
 		if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) {
-			retval = cyz_issue_cmd(&cy_card[info->card], channel,
+			retval = cyz_issue_cmd(info->card, channel,
 						C_CM_IOCTLW, 0L);
 			if (retval != 0) {
 				printk(KERN_DEBUG "cyc:cy_close retval on "
@@ -2982,14 +2980,15 @@ static int cy_write_room(struct tty_struct *tty)
 
 static int cy_chars_in_buffer(struct tty_struct *tty)
 {
+	struct cyclades_card *card;
 	struct cyclades_port *info = tty->driver_data;
-	int card, channel;
+	int channel;
 
 	if (serial_paranoia_check(info, tty->name, "cy_chars_in_buffer"))
 		return 0;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
+	channel = (info->line) - (card->first_line);
 
 #ifdef Z_EXT_CHARS_IN_BUFFER
 	if (!IS_CYC_Z(cy_card[card])) {
@@ -3008,8 +3007,8 @@ static int cy_chars_in_buffer(struct tty_struct *tty)
 		int char_count;
 		__u32 tx_put, tx_get, tx_bufsize;
 
-		firm_id = cy_card[card].base_addr + ID_ADDRESS;
-		zfw_ctrl = cy_card[card].base_addr +
+		firm_id = card->base_addr + ID_ADDRESS;
+		zfw_ctrl = card->base_addr +
 			(readl(&firm_id->zfwctrl_addr) & 0xfffff);
 		ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
 		buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
@@ -3067,9 +3066,10 @@ static void cyy_baud_calc(struct cyclades_port *info, __u32 baud)
  */
 static void set_line_char(struct cyclades_port *info)
 {
+	struct cyclades_card *card;
 	unsigned long flags;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 	unsigned cflag, iflag;
 	unsigned short chip_number;
 	int baud, baud_rate = 0;
@@ -3099,12 +3099,12 @@ static void set_line_char(struct cyclades_port *info)
 	}
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
+	channel = info->line - card->first_line;
 	chip_number = channel / 4;
 
-	if (!IS_CYC_Z(cy_card[card])) {
+	if (!IS_CYC_Z(*card)) {
 
-		index = cy_card[card].bus_index;
+		index = card->bus_index;
 
 		/* baud rate */
 		baud = tty_get_baud_rate(info->tty);
@@ -3222,8 +3222,7 @@ static void set_line_char(struct cyclades_port *info)
 
 		chip = channel >> 2;
 		channel &= 0x03;
-		base_addr = cy_card[card].base_addr +
-			(cy_chip_offset[chip] << index);
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
 		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
@@ -3331,12 +3330,12 @@ static void set_line_char(struct cyclades_port *info)
 		__u32 sw_flow;
 		int retval;
 
-		firm_id = cy_card[card].base_addr + ID_ADDRESS;
-		if (!ISZLOADED(cy_card[card])) {
+		firm_id = card->base_addr + ID_ADDRESS;
+		if (!ISZLOADED(*card)) {
 			return;
 		}
 
-		zfw_ctrl = cy_card[card].base_addr +
+		zfw_ctrl = card->base_addr +
 			(readl(&firm_id->zfwctrl_addr) & 0xfffff);
 		board_ctrl = &zfw_ctrl->board_ctrl;
 		ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
@@ -3424,7 +3423,7 @@ static void set_line_char(struct cyclades_port *info)
 		}
 		cy_writel(&ch_ctrl->sw_flow, sw_flow);
 
-		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTL, 0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_IOCTL, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:set_line_char retval on ttyC%d "
 				"was %x\n", info->line, retval);
@@ -3451,7 +3450,7 @@ static void set_line_char(struct cyclades_port *info)
 #endif
 		}
 
-		retval = cyz_issue_cmd(&cy_card[card], channel, C_CM_IOCTLM,0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_IOCTLM,0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:set_line_char(2) retval on ttyC%d "
 				"was %x\n", info->line, retval);
@@ -3468,14 +3467,15 @@ get_serial_info(struct cyclades_port *info,
 		struct serial_struct __user * retinfo)
 {
 	struct serial_struct tmp;
-	struct cyclades_card *cinfo = &cy_card[info->card];
+	struct cyclades_card *cinfo = info->card;
 
 	if (!retinfo)
 		return -EFAULT;
 	memset(&tmp, 0, sizeof(tmp));
 	tmp.type = info->type;
 	tmp.line = info->line;
-	tmp.port = info->card * 0x100 + info->line - cinfo->first_line;
+	tmp.port = (info->card - cy_card) * 0x100 + info->line -
+		cinfo->first_line;
 	tmp.irq = cinfo->irq;
 	tmp.flags = info->flags;
 	tmp.close_delay = info->close_delay;
@@ -3544,20 +3544,20 @@ check_and_exit:
  */
 static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value)
 {
-	int card, chip, channel, index;
+	struct cyclades_card *card;
+	int chip, channel, index;
 	unsigned char status;
 	unsigned int result;
 	unsigned long flags;
 	void __iomem *base_addr;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = (info->line) - (card->first_line);
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
 		status = readb(base_addr + (CySRER << index)) &
@@ -3574,7 +3574,8 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value)
 static int cy_tiocmget(struct tty_struct *tty, struct file *file)
 {
 	struct cyclades_port *info = tty->driver_data;
-	int card, chip, channel, index;
+	struct cyclades_card *card;
+	int chip, channel, index;
 	void __iomem *base_addr;
 	unsigned long flags;
 	unsigned char status;
@@ -3589,13 +3590,12 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
 		return -ENODEV;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
 		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
@@ -3615,10 +3615,10 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
 			((status & CyDSR) ? TIOCM_DSR : 0) |
 			((status & CyCTS) ? TIOCM_CTS : 0);
 	} else {
-		base_addr = cy_card[card].base_addr;
-		firm_id = cy_card[card].base_addr + ID_ADDRESS;
-		if (ISZLOADED(cy_card[card])) {
-			zfw_ctrl = cy_card[card].base_addr +
+		base_addr = card->base_addr;
+		firm_id = card->base_addr + ID_ADDRESS;
+		if (ISZLOADED(*card)) {
+			zfw_ctrl = card->base_addr +
 				(readl(&firm_id->zfwctrl_addr) & 0xfffff);
 			board_ctrl = &zfw_ctrl->board_ctrl;
 			ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -3643,7 +3643,8 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 		unsigned int set, unsigned int clear)
 {
 	struct cyclades_port *info = tty->driver_data;
-	int card, chip, channel, index;
+	struct cyclades_card *card;
+	int chip, channel, index;
 	void __iomem *base_addr;
 	unsigned long flags;
 	struct FIRM_ID __iomem *firm_id;
@@ -3656,13 +3657,12 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 		return -ENODEV;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = (info->line) - (card->first_line);
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		if (set & TIOCM_RTS) {
 			CY_LOCK(info, flags);
@@ -3730,11 +3730,11 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 			CY_UNLOCK(info, flags);
 		}
 	} else {
-		base_addr = cy_card[card].base_addr;
+		base_addr = card->base_addr;
 
-		firm_id = cy_card[card].base_addr + ID_ADDRESS;
-		if (ISZLOADED(cy_card[card])) {
-			zfw_ctrl = cy_card[card].base_addr +
+		firm_id = card->base_addr + ID_ADDRESS;
+		if (ISZLOADED(*card)) {
+			zfw_ctrl = card->base_addr +
 				(readl(&firm_id->zfwctrl_addr) & 0xfffff);
 			board_ctrl = &zfw_ctrl->board_ctrl;
 			ch_ctrl = zfw_ctrl->ch_ctrl;
@@ -3779,7 +3779,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 			return -ENODEV;
 		}
 		CY_LOCK(info, flags);
-		retval = cyz_issue_cmd(&cy_card[info->card],
+		retval = cyz_issue_cmd(info->card,
 					channel, C_CM_IOCTLM, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d "
@@ -3802,7 +3802,7 @@ static void cy_break(struct tty_struct *tty, int break_state)
 		return;
 
 	CY_LOCK(info, flags);
-	if (!IS_CYC_Z(cy_card[info->card])) {
+	if (!IS_CYC_Z(*info->card)) {
 		/* Let the transmit ISR take care of this (since it
 		   requires stuffing characters into the output stream).
 		 */
@@ -3829,16 +3829,16 @@ static void cy_break(struct tty_struct *tty, int break_state)
 		int retval;
 
 		if (break_state == -1) {
-			retval = cyz_issue_cmd(&cy_card[info->card],
-				info->line - cy_card[info->card].first_line,
+			retval = cyz_issue_cmd(info->card,
+				info->line - info->card->first_line,
 				C_CM_SET_BREAK, 0L);
 			if (retval != 0) {
 				printk(KERN_ERR "cyc:cy_break (set) retval on "
 					"ttyC%d was %x\n", info->line, retval);
 			}
 		} else {
-			retval = cyz_issue_cmd(&cy_card[info->card],
-				info->line - cy_card[info->card].first_line,
+			retval = cyz_issue_cmd(info->card,
+				info->line - info->card->first_line,
 				C_CM_CLR_BREAK, 0L);
 			if (retval != 0) {
 				printk(KERN_DEBUG "cyc:cy_break (clr) retval "
@@ -3865,18 +3865,19 @@ get_mon_info(struct cyclades_port *info, struct cyclades_monitor __user * mon)
 
 static int set_threshold(struct cyclades_port *info, unsigned long value)
 {
+	struct cyclades_card *card;
 	void __iomem *base_addr;
-	int card, channel, chip, index;
+	int channel, chip, index;
 	unsigned long flags;
 
 	card = info->card;
-	channel = info->line - cy_card[card].first_line;
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
+		index = card->bus_index;
 		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		    card->base_addr + (cy_chip_offset[chip] << index);
 
 		info->cor3 &= ~CyREC_FIFO;
 		info->cor3 |= value & CyREC_FIFO;
@@ -3894,18 +3895,18 @@ static int set_threshold(struct cyclades_port *info, unsigned long value)
 static int
 get_threshold(struct cyclades_port *info, unsigned long __user * value)
 {
+	struct cyclades_card *card;
 	void __iomem *base_addr;
-	int card, channel, chip, index;
+	int channel, chip, index;
 	unsigned long tmp;
 
 	card = info->card;
-	channel = info->line - cy_card[card].first_line;
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		tmp = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO;
 		return put_user(tmp, value);
@@ -3930,18 +3931,18 @@ get_default_threshold(struct cyclades_port *info, unsigned long __user * value)
 
 static int set_timeout(struct cyclades_port *info, unsigned long value)
 {
+	struct cyclades_card *card;
 	void __iomem *base_addr;
-	int card, channel, chip, index;
+	int channel, chip, index;
 	unsigned long flags;
 
 	card = info->card;
-	channel = info->line - cy_card[card].first_line;
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
 		cy_writeb(base_addr + (CyRTPR << index), value & 0xff);
@@ -3954,18 +3955,18 @@ static int set_timeout(struct cyclades_port *info, unsigned long value)
 
 static int get_timeout(struct cyclades_port *info, unsigned long __user * value)
 {
+	struct cyclades_card *card;
 	void __iomem *base_addr;
-	int card, channel, chip, index;
+	int channel, chip, index;
 	unsigned long tmp;
 
 	card = info->card;
-	channel = info->line - cy_card[card].first_line;
-	if (!IS_CYC_Z(cy_card[card])) {
+	channel = info->line - card->first_line;
+	if (!IS_CYC_Z(*card)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		index = cy_card[card].bus_index;
-		base_addr =
-		    cy_card[card].base_addr + (cy_chip_offset[chip] << index);
+		index = card->bus_index;
+		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		tmp = readb(base_addr + (CyRTPR << index));
 		return put_user(tmp, value);
@@ -4218,7 +4219,8 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
 static void cy_send_xchar(struct tty_struct *tty, char ch)
 {
 	struct cyclades_port *info = tty->driver_data;
-	int card, channel;
+	struct cyclades_card *card;
+	int channel;
 
 	if (serial_paranoia_check(info, tty->name, "cy_send_xchar"))
 		return;
@@ -4229,15 +4231,13 @@ static void cy_send_xchar(struct tty_struct *tty, char ch)
 		cy_start(tty);
 
 	card = info->card;
-	channel = info->line - cy_card[card].first_line;
+	channel = info->line - card->first_line;
 
-	if (IS_CYC_Z(cy_card[card])) {
+	if (IS_CYC_Z(*card)) {
 		if (ch == STOP_CHAR(tty))
-			cyz_issue_cmd(&cy_card[card], channel, C_CM_SENDXOFF,
-					0L);
+			cyz_issue_cmd(card, channel, C_CM_SENDXOFF, 0L);
 		else if (ch == START_CHAR(tty))
-			cyz_issue_cmd(&cy_card[card], channel, C_CM_SENDXON,
-					0L);
+			cyz_issue_cmd(card, channel, C_CM_SENDXON, 0L);
 	}
 }
 
@@ -4248,9 +4248,10 @@ static void cy_send_xchar(struct tty_struct *tty, char ch)
 static void cy_throttle(struct tty_struct *tty)
 {
 	struct cyclades_port *info = tty->driver_data;
+	struct cyclades_card *card;
 	unsigned long flags;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 
 #ifdef CY_DEBUG_THROTTLE
 	char buf[64];
@@ -4266,19 +4267,19 @@ static void cy_throttle(struct tty_struct *tty)
 	card = info->card;
 
 	if (I_IXOFF(tty)) {
-		if (!IS_CYC_Z(cy_card[card]))
+		if (!IS_CYC_Z(*card))
 			cy_send_xchar(tty, STOP_CHAR(tty));
 		else
 			info->throttle = 1;
 	}
 
 	if (tty->termios->c_cflag & CRTSCTS) {
-		channel = info->line - cy_card[card].first_line;
-		if (!IS_CYC_Z(cy_card[card])) {
+		channel = info->line - card->first_line;
+		if (!IS_CYC_Z(*card)) {
 			chip = channel >> 2;
 			channel &= 0x03;
-			index = cy_card[card].bus_index;
-			base_addr = cy_card[card].base_addr +
+			index = card->bus_index;
+			base_addr = card->base_addr +
 				(cy_chip_offset[chip] << index);
 
 			CY_LOCK(info, flags);
@@ -4306,9 +4307,10 @@ static void cy_throttle(struct tty_struct *tty)
 static void cy_unthrottle(struct tty_struct *tty)
 {
 	struct cyclades_port *info = tty->driver_data;
+	struct cyclades_card *card;
 	unsigned long flags;
 	void __iomem *base_addr;
-	int card, chip, channel, index;
+	int chip, channel, index;
 
 #ifdef CY_DEBUG_THROTTLE
 	char buf[64];
@@ -4330,12 +4332,12 @@ static void cy_unthrottle(struct tty_struct *tty)
 
 	if (tty->termios->c_cflag & CRTSCTS) {
 		card = info->card;
-		channel = info->line - cy_card[card].first_line;
-		if (!IS_CYC_Z(cy_card[card])) {
+		channel = info->line - card->first_line;
+		if (!IS_CYC_Z(*card)) {
 			chip = channel >> 2;
 			channel &= 0x03;
-			index = cy_card[card].bus_index;
-			base_addr = cy_card[card].base_addr +
+			index = card->bus_index;
+			base_addr = card->base_addr +
 				(cy_chip_offset[chip] << index);
 
 			CY_LOCK(info, flags);
@@ -4373,13 +4375,13 @@ static void cy_stop(struct tty_struct *tty)
 	if (serial_paranoia_check(info, tty->name, "cy_stop"))
 		return;
 
-	cinfo = &cy_card[info->card];
+	cinfo = info->card;
 	channel = info->line - cinfo->first_line;
 	if (!IS_CYC_Z(*cinfo)) {
 		index = cinfo->bus_index;
 		chip = channel >> 2;
 		channel &= 0x03;
-		base_addr = cy_card[info->card].base_addr +
+		base_addr = info->card->base_addr +
 			(cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
@@ -4408,13 +4410,13 @@ static void cy_start(struct tty_struct *tty)
 	if (serial_paranoia_check(info, tty->name, "cy_start"))
 		return;
 
-	cinfo = &cy_card[info->card];
+	cinfo = info->card;
 	channel = info->line - cinfo->first_line;
 	index = cinfo->bus_index;
 	if (!IS_CYC_Z(*cinfo)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		base_addr = cy_card[info->card].base_addr +
+		base_addr = info->card->base_addr +
 			(cy_chip_offset[chip] << index);
 
 		CY_LOCK(info, flags);
@@ -4430,7 +4432,8 @@ static void cy_start(struct tty_struct *tty)
 static void cy_flush_buffer(struct tty_struct *tty)
 {
 	struct cyclades_port *info = tty->driver_data;
-	int card, channel, retval;
+	struct cyclades_card *card;
+	int channel, retval;
 	unsigned long flags;
 
 #ifdef CY_DEBUG_IO
@@ -4441,17 +4444,16 @@ static void cy_flush_buffer(struct tty_struct *tty)
 		return;
 
 	card = info->card;
-	channel = (info->line) - (cy_card[card].first_line);
+	channel = info->line - card->first_line;
 
 	CY_LOCK(info, flags);
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
 	CY_UNLOCK(info, flags);
 
-	if (IS_CYC_Z(cy_card[card])) {	/* If it is a Z card, flush the on-board
+	if (IS_CYC_Z(*card)) {	/* If it is a Z card, flush the on-board
 					   buffers as well */
 		CY_LOCK(info, flags);
-		retval =
-		    cyz_issue_cmd(&cy_card[card], channel, C_CM_FLUSH_TX, 0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_TX, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d "
 				"was %x\n", info->line, retval);
@@ -4496,8 +4498,7 @@ static void cy_hangup(struct tty_struct *tty)
  * ---------------------------------------------------------------------
  */
 
-static void __devinit cy_init_card(struct cyclades_card *cinfo,
-		const unsigned int board)
+static void __devinit cy_init_card(struct cyclades_card *cinfo)
 {
 	struct cyclades_port *info;
 	u32 mailbox;
@@ -4524,7 +4525,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo,
 		info = &cy_port[port];
 		memset(info, 0, sizeof(*info));
 		info->magic = CYCLADES_MAGIC;
-		info->card = board;
+		info->card = cinfo;
 		info->line = port;
 		info->flags = STD_COM_FLAGS;
 		info->closing_wait = CLOSING_WAIT_DELAY;
@@ -4763,7 +4764,7 @@ static int __init cy_detect_isa(void)
 		cy_card[j].bus_index = 0;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = cy_isa_nchan / 4;
-		cy_init_card(&cy_card[j], j);
+		cy_init_card(&cy_card[j]);
 		nboard++;
 
 		printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: "
@@ -4849,7 +4850,7 @@ static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0,
 	cy_card[j].bus_index = 1;
 	cy_card[j].first_line = cy_next_channel;
 	cy_card[j].num_chips = -1;
-	cy_init_card(&cy_card[j], j);
+	cy_init_card(&cy_card[j]);
 	pci_set_drvdata(pdev, &cy_card[j]);
 
 	dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting "
@@ -4956,7 +4957,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		cy_card[j].bus_index = 1;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = cy_pci_nchan / 4;
-		cy_init_card(&cy_card[j], j);
+		cy_init_card(&cy_card[j]);
 		pci_set_drvdata(pdev, &cy_card[j]);
 
 		/* enable interrupts in the PCI interface */
@@ -5110,7 +5111,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		cy_card[j].bus_index = 1;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = -1;
-		cy_init_card(&cy_card[j], j);
+		cy_init_card(&cy_card[j]);
 		pci_set_drvdata(pdev, &cy_card[j]);
 
 		dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels "
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index e06cd47..121d64c 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -549,7 +549,7 @@ struct cyclades_icount {
 
 struct cyclades_port {
 	int                     magic;
-	int			card;
+	struct cyclades_card	*card;
 	int			line;
 	int			flags; 		/* defined in tty.h */
 	int                     type;		/* UART type */

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 12/21] Char: cyclades, remove sleep_on
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (9 preceding siblings ...)
  2007-04-29 21:00 ` [PATCH 11/21] Char: cyclades, make info->card a pointer Jiri Slaby
@ 2007-04-29 21:01 ` Jiri Slaby
  2007-04-29 21:01 ` [PATCH 13/21] Char: cyclades, fix blockmove Jiri Slaby
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, remove sleep_on

convert to wait_* and completion

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 300e8efee2151f3bd26ed824f932fba53a7313f4
tree 02665558209c35460450f9ac28159d8aa5c8ea2e
parent fcc653d03162d0c14053a2fca345ae8aa1eff924
author Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 00:15:42 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:15 +0200

 drivers/char/cyclades.c  |   45 ++++++++++++++++-----------------------------
 include/linux/cyclades.h |    2 +-
 2 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 9bec4ef..c236e9f 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -947,7 +947,7 @@ do_softint(struct work_struct *work)
 	tty_wakeup(tty);
 #ifdef Z_WAKE
 	if (test_and_clear_bit(Cy_EVENT_SHUTDOWN_WAKEUP, &info->event))
-		wake_up_interruptible(&info->shutdown_wait);
+		complete(&info->shutdown_wait);
 #endif
 } /* do_softint */
 
@@ -2324,9 +2324,8 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 	 * until it's done, and then try again.
 	 */
 	if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) {
-		if (info->flags & ASYNC_CLOSING) {
-			interruptible_sleep_on(&info->close_wait);
-		}
+		wait_event_interruptible(info->close_wait,
+				!(info->flags & ASYNC_CLOSING));
 		return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS;
 	}
 
@@ -2597,8 +2596,8 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
 	 * If the port is the middle of closing, bail out now
 	 */
 	if (tty_hung_up_p(filp) || (info->flags & ASYNC_CLOSING)) {
-		if (info->flags & ASYNC_CLOSING)
-			interruptible_sleep_on(&info->close_wait);
+		wait_event_interruptible(info->close_wait,
+				!(info->flags & ASYNC_CLOSING));
 		return (info->flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS;
 	}
 
@@ -2805,7 +2804,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 					"ttyC%d was %x\n", info->line, retval);
 			}
 			CY_UNLOCK(info, flags);
-			interruptible_sleep_on(&info->shutdown_wait);
+			wait_for_completion_interruptible(&info->shutdown_wait);
 			CY_LOCK(info, flags);
 		}
 #endif
@@ -4091,32 +4090,20 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
 	case TIOCMIWAIT:
 		CY_LOCK(info, flags);
 		/* note the counters on entry */
-		cprev = info->icount;
+		cnow = info->icount;
 		CY_UNLOCK(info, flags);
-		while (1) {
-			interruptible_sleep_on(&info->delta_msr_wait);
-			/* see if a signal did it */
-			if (signal_pending(current)) {
-				return -ERESTARTSYS;
-			}
-
+		ret_val = wait_event_interruptible(info->delta_msr_wait, ({
+			cprev = cnow;
 			CY_LOCK(info, flags);
 			cnow = info->icount;	/* atomic copy */
 			CY_UNLOCK(info, flags);
 
-			if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
-			    cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
-				return -EIO;	/* no change => error */
-			}
-			if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
-			    ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
-			    ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) ||
-			    ((arg & TIOCM_CTS) && (cnow.cts != cprev.cts))) {
-				return 0;
-			}
-			cprev = cnow;
-		}
-		/* NOTREACHED */
+			((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
+			((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
+			((arg & TIOCM_CD)  && (cnow.dcd != cprev.dcd)) ||
+			((arg & TIOCM_CTS) && (cnow.cts != cprev.cts));
+		}));
+		break;
 
 		/*
 		 * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
@@ -4534,7 +4521,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo)
 		INIT_WORK(&info->tqueue, do_softint);
 		init_waitqueue_head(&info->open_wait);
 		init_waitqueue_head(&info->close_wait);
-		init_waitqueue_head(&info->shutdown_wait);
+		init_completion(&info->shutdown_wait);
 		init_waitqueue_head(&info->delta_msr_wait);
 
 		if (IS_CYC_Z(*cinfo)) {
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 121d64c..cdd7739 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -588,7 +588,7 @@ struct cyclades_port {
 	struct work_struct	tqueue;
 	wait_queue_head_t       open_wait;
 	wait_queue_head_t       close_wait;
-	wait_queue_head_t       shutdown_wait;
+	struct completion       shutdown_wait;
 	wait_queue_head_t       delta_msr_wait;
 	int throttle;
 };

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 13/21] Char: cyclades, fix blockmove
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (10 preceding siblings ...)
  2007-04-29 21:01 ` [PATCH 12/21] Char: cyclades, remove sleep_on Jiri Slaby
@ 2007-04-29 21:01 ` Jiri Slaby
  2007-04-29 21:02 ` [PATCH 14/21] Char: cyclades, timers cleanup Jiri Slaby
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, fix blockmove

tty has no longer flip buffers accessible externally. Fix it by moving the
code to the tty_*flip* helpers.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 147542c38691d4e5049b916b083dc93bc3bf8c3b
tree 8986e0764afc717d7d283326b87aa5e3dff8b052
parent 300e8efee2151f3bd26ed824f932fba53a7313f4
author Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 15:48:28 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:17 +0200

 drivers/char/cyclades.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index c236e9f..9160953 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1560,7 +1560,7 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 	int char_count;
 	int len;
 #ifdef BLOCKMOVE
-	int small_count;
+	unsigned char *buf;
 #else
 	char data;
 #endif
@@ -1596,25 +1596,23 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 		/* we'd like to use memcpy(t, f, n) and memset(s, c, count)
 		   for performance, but because of buffer boundaries, there
 		   may be several steps to the operation */
-			while (0 < (small_count = min_t(unsigned int,
-					rx_bufsize - new_rx_get,
-					min_t(unsigned int, TTY_FLIPBUF_SIZE -
-						tty->flip.count, char_count)))){
-				memcpy_fromio(tty->flip.char_buf_ptr,
-					(char *)(cinfo->base_addr + rx_bufaddr +
-						new_rx_get),
-					small_count);
+			while (1) {
+				len = tty_prepare_flip_string(tty, &buf,
+						char_count);
+				if (!len)
+					break;
 
-				tty->flip.char_buf_ptr += small_count;
-				memset(tty->flip.flag_buf_ptr, TTY_NORMAL,
-					small_count);
-				tty->flip.flag_buf_ptr += small_count;
-				new_rx_get = (new_rx_get + small_count) &
+				len = min_t(unsigned int, min(len, char_count),
+						rx_bufsize - new_rx_get);
+
+				memcpy_fromio(buf, cinfo->base_addr +
+						rx_bufaddr + new_rx_get, len);
+
+				new_rx_get = (new_rx_get + len) &
 						(rx_bufsize - 1);
-				char_count -= small_count;
-				info->icount.rx += small_count;
-				info->idle_stats.recv_bytes += small_count;
-				tty->flip.count += small_count;
+				char_count -= len;
+				info->icount.rx += len;
+				info->idle_stats.recv_bytes += len;
 			}
 #else
 			len = tty_buffer_request_room(tty, char_count);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 14/21] Char: cyclades, timers cleanup
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (11 preceding siblings ...)
  2007-04-29 21:01 ` [PATCH 13/21] Char: cyclades, fix blockmove Jiri Slaby
@ 2007-04-29 21:02 ` Jiri Slaby
  2007-04-29 21:03 ` [PATCH 15/21] Char: cyclades, remove unused timestamps Jiri Slaby
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:02 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, timers cleanup

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 86d2bb56b6a8f3c51b7bd537634645fa14862085
tree cfd901e1b728863f734124200ae9ce8220625a24
parent 147542c38691d4e5049b916b083dc93bc3bf8c3b
author Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 16:12:25 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:32 +0200

 drivers/char/cyclades.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 9160953..14652c1 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -932,15 +932,9 @@ do_softint(struct work_struct *work)
 	if (test_and_clear_bit(Cy_EVENT_OPEN_WAKEUP, &info->event))
 		wake_up_interruptible(&info->open_wait);
 #ifdef CONFIG_CYZ_INTR
-	if (test_and_clear_bit(Cy_EVENT_Z_RX_FULL, &info->event)) {
-		if (cyz_rx_full_timer[info->line].function == NULL) {
-			cyz_rx_full_timer[info->line].expires = jiffies + 1;
-			cyz_rx_full_timer[info->line].function = cyz_rx_restart;
-			cyz_rx_full_timer[info->line].data =
-						(unsigned long)info;
-			add_timer(&cyz_rx_full_timer[info->line]);
-		}
-	}
+	if (test_and_clear_bit(Cy_EVENT_Z_RX_FULL, &info->event) &&
+			!timer_pending(&cyz_rx_full_timer[info->line]))
+		mod_timer(&cyz_rx_full_timer[info->line], jiffies + 1);
 #endif
 	if (test_and_clear_bit(Cy_EVENT_DELTA_WAKEUP, &info->event))
 		wake_up_interruptible(&info->delta_msr_wait);
@@ -1887,7 +1881,6 @@ static void cyz_rx_restart(unsigned long arg)
 		printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n",
 			info->line, retval);
 	}
-	cyz_rx_full_timer[info->line].function = NULL;
 	CY_UNLOCK(info, flags);
 }
 
@@ -4529,8 +4522,8 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo)
 			else
 				info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE;
 #ifdef CONFIG_CYZ_INTR
-			init_timer(&cyz_rx_full_timer[port]);
-			cyz_rx_full_timer[port].function = NULL;
+			setup_timer(&cyz_rx_full_timer[port],
+				cyz_rx_restart, (unsigned long)info);
 #endif
 		} else {
 			info->type = PORT_CIRRUS;

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 15/21] Char: cyclades, remove unused timestamps
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (12 preceding siblings ...)
  2007-04-29 21:02 ` [PATCH 14/21] Char: cyclades, timers cleanup Jiri Slaby
@ 2007-04-29 21:03 ` Jiri Slaby
  2007-04-29 21:03 ` [PATCH 16/21] Char: cyclades, remove locking macros Jiri Slaby
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, remove unused timestamps

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 5a04eb52bbde6de3f92613f57f5d667a5cb3e8bd
tree 22665c0e01dfd91bc52252cd024a3aa1015be555
parent 86d2bb56b6a8f3c51b7bd537634645fa14862085
author Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 16:19:36 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:33 +0200

 drivers/char/cyclades.c  |   12 ------------
 include/linux/cyclades.h |    2 --
 2 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 14652c1..ab9ad66 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1049,7 +1049,6 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 		channel = (u_short) (save_xir & CyIRChannel);
 		i = channel + chip * 4 + cinfo->first_line;
 		info = &cy_port[i];
-		info->last_active = jiffies;
 		save_car = readb(base_addr + (CyCAR << index));
 		cy_writeb(base_addr + (CyCAR << index), save_xir);
 
@@ -1225,7 +1224,6 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 			goto txend;
 		}
 		info = &cy_port[i];
-		info->last_active = jiffies;
 		if (info->tty == 0) {
 			cy_writeb(base_addr + (CySRER << index),
 				  readb(base_addr + (CySRER << index)) &
@@ -1339,7 +1337,6 @@ txend:
 		save_xir = (u_char) readb(base_addr + (CyMIR << index));
 		channel = (u_short) (save_xir & CyIRChannel);
 		info = &cy_port[channel + chip * 4 + cinfo->first_line];
-		info->last_active = jiffies;
 		save_car = readb(base_addr + (CyCAR << index));
 		cy_writeb(base_addr + (CyCAR << index), save_xir);
 
@@ -1570,9 +1567,6 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 		char_count = rx_put - rx_get + rx_bufsize;
 
 	if (char_count) {
-		info->last_active = jiffies;
-		info->jiffies[1] = jiffies;
-
 #ifdef CY_ENABLE_MONITORING
 		info->mon.int_count++;
 		info->mon.char_count += char_count;
@@ -1678,8 +1672,6 @@ cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 			info->x_char = 0;
 			char_count--;
 			info->icount.tx++;
-			info->last_active = jiffies;
-			info->jiffies[2] = jiffies;
 		}
 #ifdef BLOCKMOVE
 		while (0 < (small_count = min_t(unsigned int,
@@ -1699,8 +1691,6 @@ cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 			info->xmit_cnt -= small_count;
 			info->xmit_tail = (info->xmit_tail + small_count) &
 					(SERIAL_XMIT_SIZE - 1);
-			info->last_active = jiffies;
-			info->jiffies[2] = jiffies;
 		}
 #else
 		while (info->xmit_cnt && char_count) {
@@ -1713,8 +1703,6 @@ cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 			tx_put = (tx_put + 1) & (tx_bufsize - 1);
 			char_count--;
 			info->icount.tx++;
-			info->last_active = jiffies;
-			info->jiffies[2] = jiffies;
 		}
 #endif
 ztxdone:
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index cdd7739..07791f0 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -569,7 +569,6 @@ struct cyclades_port {
 	int			close_delay;
 	unsigned short		closing_wait;
 	unsigned long		event;
-	unsigned long		last_active;
 	int			count;	/* # of fd on device */
 	int                     breakon;
 	int                     breakoff;
@@ -580,7 +579,6 @@ struct cyclades_port {
 	int			xmit_cnt;
         int                     default_threshold;
         int                     default_timeout;
-	unsigned long		jiffies[3];
 	unsigned long		rflush_count;
 	struct cyclades_monitor	mon;
 	struct cyclades_idle_stats	idle_stats;

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 16/21] Char: cyclades, remove locking macros
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (13 preceding siblings ...)
  2007-04-29 21:03 ` [PATCH 15/21] Char: cyclades, remove unused timestamps Jiri Slaby
@ 2007-04-29 21:03 ` Jiri Slaby
  2007-04-29 21:04 ` [PATCH 17/21] Char: cyclades, conditions cleanup Jiri Slaby
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, remove locking macros

and use locally stored card structure if possible

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit c2e132ebb19f9f8b3d4aee5cd4f755cd7588d49f
tree 348c7bc6a73a4859d4840779f5663b64c9f6c62a
parent 5a04eb52bbde6de3f92613f57f5d667a5cb3e8bd
author Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 17:47:21 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:34 +0200

 drivers/char/cyclades.c |  245 +++++++++++++++++++++++------------------------
 1 files changed, 118 insertions(+), 127 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index ab9ad66..6e5fca9 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -653,16 +653,6 @@
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 
-#define	CY_LOCK(info,flags)					\
-		do {						\
-		spin_lock_irqsave(&info->card->card_lock, flags); \
-		} while (0)
-
-#define	CY_UNLOCK(info,flags)					\
-		do {						\
-		spin_unlock_irqrestore(&info->card->card_lock, flags); \
-		} while (0)
-
 #include <linux/kernel.h>
 #include <linux/pci.h>
 
@@ -1863,13 +1853,13 @@ static void cyz_rx_restart(unsigned long arg)
 	__u32 channel = info->line - card->first_line;
 	unsigned long flags;
 
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&card->card_lock, flags);
 	retval = cyz_issue_cmd(card, channel, C_CM_INTBACK2, 0L);
 	if (retval != 0) {
 		printk(KERN_ERR "cyc:cyz_rx_restart retval on ttyC%d was %x\n",
 			info->line, retval);
 	}
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 }
 
 #else				/* CONFIG_CYZ_INTR */
@@ -1949,7 +1939,7 @@ static int startup(struct cyclades_port *info)
 	if (!page)
 		return -ENOMEM;
 
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&card->card_lock, flags);
 
 	if (info->flags & ASYNC_INITIALIZED) {
 		free_page(page);
@@ -1969,7 +1959,7 @@ static int startup(struct cyclades_port *info)
 	else
 		info->xmit_buf = (unsigned char *)page;
 
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 
 	set_line_char(info);
 
@@ -1984,7 +1974,7 @@ static int startup(struct cyclades_port *info)
 				"base_addr %p\n",
 				card, chip, channel, base_addr);
 #endif
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 
 		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
 
@@ -2020,7 +2010,7 @@ static int startup(struct cyclades_port *info)
 		info->idle_stats.recv_idle =
 		info->idle_stats.xmit_idle = jiffies;
 
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 
 	} else {
 		struct FIRM_ID __iomem *firm_id;
@@ -2045,7 +2035,7 @@ static int startup(struct cyclades_port *info)
 		printk(KERN_DEBUG "cyc startup Z card %d, channel %d, "
 			"base_addr %p\n", card, channel, base_addr);
 #endif
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 
 		cy_writel(&ch_ctrl[channel].op_mode, C_CH_ENABLE);
 #ifdef Z_WAKE
@@ -2085,8 +2075,7 @@ static int startup(struct cyclades_port *info)
 		cy_writel(&ch_ctrl[channel].rs_control,
 			readl(&ch_ctrl[channel].rs_control) | C_RS_RTS |
 			C_RS_DTR);
-		retval = cyz_issue_cmd(info->card, channel,
-				C_CM_IOCTLM, 0L);
+		retval = cyz_issue_cmd(card, channel, C_CM_IOCTLM, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:startup(3) retval on ttyC%d was "
 				"%x\n", info->line, retval);
@@ -2108,7 +2097,7 @@ static int startup(struct cyclades_port *info)
 		info->idle_stats.recv_idle =
 		info->idle_stats.xmit_idle = jiffies;
 
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	}
 
 #ifdef CY_DEBUG_OPEN
@@ -2117,7 +2106,7 @@ static int startup(struct cyclades_port *info)
 	return 0;
 
 errout:
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 	return retval;
 }				/* startup */
 
@@ -2136,22 +2125,22 @@ static void start_xmit(struct cyclades_port *info)
 		index = card->bus_index;
 		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		cy_writeb(base_addr + (CyCAR << index), channel);
 		cy_writeb(base_addr + (CySRER << index),
 			readb(base_addr + (CySRER << index)) | CyTxRdy);
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	} else {
 #ifdef CONFIG_CYZ_INTR
 		int retval;
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		retval = cyz_issue_cmd(card, channel, C_CM_INTBACK, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:start_xmit retval on ttyC%d was "
 				"%x\n", info->line, retval);
 		}
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 #else				/* CONFIG_CYZ_INTR */
 		/* Don't have to do anything at this time */
 #endif				/* CONFIG_CYZ_INTR */
@@ -2187,7 +2176,7 @@ static void shutdown(struct cyclades_port *info)
 				card, chip, channel, base_addr);
 #endif
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 
 		/* Clear delta_msr_wait queue to avoid mem leaks. */
 		wake_up_interruptible(&info->delta_msr_wait);
@@ -2217,7 +2206,7 @@ static void shutdown(struct cyclades_port *info)
 			set_bit(TTY_IO_ERROR, &info->tty->flags);
 		}
 		info->flags &= ~ASYNC_INITIALIZED;
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	} else {
 		struct FIRM_ID __iomem *firm_id;
 		struct ZFW_CTRL __iomem *zfw_ctrl;
@@ -2241,7 +2230,7 @@ static void shutdown(struct cyclades_port *info)
 		board_ctrl = &zfw_ctrl->board_ctrl;
 		ch_ctrl = zfw_ctrl->ch_ctrl;
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 
 		if (info->xmit_buf) {
 			unsigned char *temp;
@@ -2270,7 +2259,7 @@ static void shutdown(struct cyclades_port *info)
 		}
 		info->flags &= ~ASYNC_INITIALIZED;
 
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	}
 
 #ifdef CY_DEBUG_OPEN
@@ -2330,10 +2319,10 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 	printk(KERN_DEBUG "cyc block_til_ready before block: ttyC%d, "
 		"count = %d\n", info->line, info->count);
 #endif
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&cinfo->card_lock, flags);
 	if (!tty_hung_up_p(filp))
 		info->count--;
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&cinfo->card_lock, flags);
 #ifdef CY_DEBUG_COUNT
 	printk(KERN_DEBUG "cyc block_til_ready: (%d): decrementing count to "
 		"%d\n", current->pid, info->count);
@@ -2347,7 +2336,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 		base_addr = cinfo->base_addr + (cy_chip_offset[chip] << index);
 
 		while (1) {
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&cinfo->card_lock, flags);
 			if ((tty->termios->c_cflag & CBAUD)) {
 				cy_writeb(base_addr + (CyCAR << index),
 					  (u_char) channel);
@@ -2363,7 +2352,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 					readb(base_addr + (CyMSVR2 << index)));
 #endif
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&cinfo->card_lock, flags);
 
 			set_current_state(TASK_INTERRUPTIBLE);
 			if (tty_hung_up_p(filp) ||
@@ -2373,16 +2362,16 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				break;
 			}
 
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&cinfo->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (!(info->flags & ASYNC_CLOSING) && (C_CLOCAL(tty) ||
 					(readb(base_addr +
 						(CyMSVR1 << index)) & CyDCD))) {
-				CY_UNLOCK(info, flags);
+				spin_unlock_irqrestore(&cinfo->card_lock, flags);
 				break;
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&cinfo->card_lock, flags);
 
 			if (signal_pending(current)) {
 				retval = -ERESTARTSYS;
@@ -2419,7 +2408,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 				cy_writel(&ch_ctrl[channel].rs_control,
 					readl(&ch_ctrl[channel].rs_control) |
 					C_RS_RTS | C_RS_DTR);
-				retval = cyz_issue_cmd(info->card,
+				retval = cyz_issue_cmd(cinfo,
 					channel, C_CM_IOCTLM, 0L);
 				if (retval != 0) {
 					printk(KERN_ERR "cyc:block_til_ready "
@@ -2688,6 +2677,7 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 static void cy_close(struct tty_struct *tty, struct file *filp)
 {
 	struct cyclades_port *info = tty->driver_data;
+	struct cyclades_card *card;
 	unsigned long flags;
 
 #ifdef CY_DEBUG_OTHER
@@ -2698,10 +2688,12 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 		return;
 	}
 
-	CY_LOCK(info, flags);
+	card = info->card;
+
+	spin_lock_irqsave(&card->card_lock, flags);
 	/* If the TTY is being hung up, nothing to do */
 	if (tty_hung_up_p(filp)) {
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 		return;
 	}
 #ifdef CY_DEBUG_OPEN
@@ -2731,7 +2723,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 		info->count = 0;
 	}
 	if (info->count) {
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 		return;
 	}
 	info->flags |= ASYNC_CLOSING;
@@ -2741,16 +2733,16 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 	 * the line discipline to only process XON/XOFF characters.
 	 */
 	tty->closing = 1;
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 	if (info->closing_wait != CY_CLOSING_WAIT_NONE) {
 		tty_wait_until_sent(tty, info->closing_wait);
 	}
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&card->card_lock, flags);
 
-	if (!IS_CYC_Z(*info->card)) {
-		int channel = info->line - info->card->first_line;
-		int index = info->card->bus_index;
-		void __iomem *base_addr = info->card->base_addr +
+	if (!IS_CYC_Z(*card)) {
+		int channel = info->line - card->first_line;
+		int index = card->bus_index;
+		void __iomem *base_addr = card->base_addr +
 			(cy_chip_offset[channel >> 2] << index);
 		/* Stop accepting input */
 		channel &= 0x03;
@@ -2760,53 +2752,52 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 		if (info->flags & ASYNC_INITIALIZED) {
 			/* Waiting for on-board buffers to be empty before closing
 			   the port */
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 			cy_wait_until_sent(tty, info->timeout);
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 		}
 	} else {
 #ifdef Z_WAKE
 		/* Waiting for on-board buffers to be empty before closing the port */
-		void __iomem *base_addr = info->card->base_addr;
+		void __iomem *base_addr = card->base_addr;
 		struct FIRM_ID __iomem *firm_id = base_addr + ID_ADDRESS;
 		struct ZFW_CTRL __iomem *zfw_ctrl =
 		    base_addr + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
 		struct CH_CTRL __iomem *ch_ctrl = zfw_ctrl->ch_ctrl;
-		int channel = info->line - info->card->first_line;
+		int channel = info->line - card->first_line;
 		int retval;
 
 		if (readl(&ch_ctrl[channel].flow_status) != C_FS_TXIDLE) {
-			retval = cyz_issue_cmd(info->card, channel,
-						C_CM_IOCTLW, 0L);
+			retval = cyz_issue_cmd(card, channel, C_CM_IOCTLW, 0L);
 			if (retval != 0) {
 				printk(KERN_DEBUG "cyc:cy_close retval on "
 					"ttyC%d was %x\n", info->line, retval);
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 			wait_for_completion_interruptible(&info->shutdown_wait);
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 		}
 #endif
 	}
 
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 	shutdown(info);
 	if (tty->driver->flush_buffer)
 		tty->driver->flush_buffer(tty);
 	tty_ldisc_flush(tty);
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&card->card_lock, flags);
 
 	tty->closing = 0;
 	info->event = 0;
 	info->tty = NULL;
 	if (info->blocked_open) {
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 		if (info->close_delay) {
 			msleep_interruptible(jiffies_to_msecs
 						(info->close_delay));
 		}
 		wake_up_interruptible(&info->open_wait);
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 	}
 	info->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CLOSING);
 	wake_up_interruptible(&info->close_wait);
@@ -2815,7 +2806,7 @@ static void cy_close(struct tty_struct *tty, struct file *filp)
 	printk(KERN_DEBUG "cyc:cy_close done\n");
 #endif
 
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 }				/* cy_close */
 
 /* This routine gets called when tty_write has put something into
@@ -2848,7 +2839,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
 	if (!info->xmit_buf)
 		return 0;
 
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&info->card->card_lock, flags);
 	while (1) {
 		c = min(count, min((int)(SERIAL_XMIT_SIZE - info->xmit_cnt - 1),
 				   (int)(SERIAL_XMIT_SIZE - info->xmit_head)));
@@ -2864,7 +2855,7 @@ static int cy_write(struct tty_struct *tty, const unsigned char *buf, int count)
 		count -= c;
 		ret += c;
 	}
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&info->card->card_lock, flags);
 
 	info->idle_stats.xmit_bytes += ret;
 	info->idle_stats.xmit_idle = jiffies;
@@ -2897,9 +2888,9 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch)
 	if (!info->xmit_buf)
 		return;
 
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&info->card->card_lock, flags);
 	if (info->xmit_cnt >= (int)(SERIAL_XMIT_SIZE - 1)) {
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&info->card->card_lock, flags);
 		return;
 	}
 
@@ -2908,7 +2899,7 @@ static void cy_put_char(struct tty_struct *tty, unsigned char ch)
 	info->xmit_cnt++;
 	info->idle_stats.xmit_bytes++;
 	info->idle_stats.xmit_idle = jiffies;
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&info->card->card_lock, flags);
 }				/* cy_put_char */
 
 /*
@@ -3202,7 +3193,7 @@ static void set_line_char(struct cyclades_port *info)
 		channel &= 0x03;
 		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
 
 		/* tx and rx baud rate */
@@ -3297,7 +3288,7 @@ static void set_line_char(struct cyclades_port *info)
 		if (info->tty) {
 			clear_bit(TTY_IO_ERROR, &info->tty->flags);
 		}
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 
 	} else {
 		struct FIRM_ID __iomem *firm_id;
@@ -3537,10 +3528,10 @@ static int get_lsr_info(struct cyclades_port *info, unsigned int __user * value)
 		index = card->bus_index;
 		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		status = readb(base_addr + (CySRER << index)) &
 				(CyTxRdy | CyTxMpty);
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 		result = (status ? 0 : TIOCSER_TEMT);
 	} else {
 		/* Not supported yet */
@@ -3575,11 +3566,11 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file)
 		index = card->bus_index;
 		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		cy_writeb(base_addr + (CyCAR << index), (u_char) channel);
 		status = readb(base_addr + (CyMSVR1 << index));
 		status |= readb(base_addr + (CyMSVR2 << index));
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 
 		if (info->rtsdtr_inv) {
 			result = ((status & CyRTS) ? TIOCM_DTR : 0) |
@@ -3643,7 +3634,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
 		if (set & TIOCM_RTS) {
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (info->rtsdtr_inv) {
@@ -3653,10 +3644,10 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 				cy_writeb(base_addr + (CyMSVR1 << index),
 					  CyRTS);
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 		}
 		if (clear & TIOCM_RTS) {
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (info->rtsdtr_inv) {
@@ -3666,10 +3657,10 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 				cy_writeb(base_addr + (CyMSVR1 << index),
 					  ~CyRTS);
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 		}
 		if (set & TIOCM_DTR) {
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (info->rtsdtr_inv) {
@@ -3685,10 +3676,10 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 		}
 		if (clear & TIOCM_DTR) {
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (info->rtsdtr_inv) {
@@ -3705,7 +3696,7 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 				readb(base_addr + (CyMSVR1 << index)),
 				readb(base_addr + (CyMSVR2 << index)));
 #endif
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 		}
 	} else {
 		base_addr = card->base_addr;
@@ -3718,21 +3709,21 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 			ch_ctrl = zfw_ctrl->ch_ctrl;
 
 			if (set & TIOCM_RTS) {
-				CY_LOCK(info, flags);
+				spin_lock_irqsave(&card->card_lock, flags);
 				cy_writel(&ch_ctrl[channel].rs_control,
 					readl(&ch_ctrl[channel].rs_control) |
 					C_RS_RTS);
-				CY_UNLOCK(info, flags);
+				spin_unlock_irqrestore(&card->card_lock, flags);
 			}
 			if (clear & TIOCM_RTS) {
-				CY_LOCK(info, flags);
+				spin_lock_irqsave(&card->card_lock, flags);
 				cy_writel(&ch_ctrl[channel].rs_control,
 					readl(&ch_ctrl[channel].rs_control) &
 					~C_RS_RTS);
-				CY_UNLOCK(info, flags);
+				spin_unlock_irqrestore(&card->card_lock, flags);
 			}
 			if (set & TIOCM_DTR) {
-				CY_LOCK(info, flags);
+				spin_lock_irqsave(&card->card_lock, flags);
 				cy_writel(&ch_ctrl[channel].rs_control,
 					readl(&ch_ctrl[channel].rs_control) |
 					C_RS_DTR);
@@ -3740,10 +3731,10 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 				printk(KERN_DEBUG "cyc:set_modem_info raising "
 					"Z DTR\n");
 #endif
-				CY_UNLOCK(info, flags);
+				spin_unlock_irqrestore(&card->card_lock, flags);
 			}
 			if (clear & TIOCM_DTR) {
-				CY_LOCK(info, flags);
+				spin_lock_irqsave(&card->card_lock, flags);
 				cy_writel(&ch_ctrl[channel].rs_control,
 					readl(&ch_ctrl[channel].rs_control) &
 					~C_RS_DTR);
@@ -3751,19 +3742,18 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 				printk(KERN_DEBUG "cyc:set_modem_info clearing "
 					"Z DTR\n");
 #endif
-				CY_UNLOCK(info, flags);
+				spin_unlock_irqrestore(&card->card_lock, flags);
 			}
 		} else {
 			return -ENODEV;
 		}
-		CY_LOCK(info, flags);
-		retval = cyz_issue_cmd(info->card,
-					channel, C_CM_IOCTLM, 0L);
+		spin_lock_irqsave(&card->card_lock, flags);
+		retval = cyz_issue_cmd(card, channel, C_CM_IOCTLM, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc:set_modem_info retval on ttyC%d "
 				"was %x\n", info->line, retval);
 		}
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	}
 	return 0;
 }				/* cy_tiocmset */
@@ -3774,13 +3764,16 @@ cy_tiocmset(struct tty_struct *tty, struct file *file,
 static void cy_break(struct tty_struct *tty, int break_state)
 {
 	struct cyclades_port *info = tty->driver_data;
+	struct cyclades_card *card;
 	unsigned long flags;
 
 	if (serial_paranoia_check(info, tty->name, "cy_break"))
 		return;
 
-	CY_LOCK(info, flags);
-	if (!IS_CYC_Z(*info->card)) {
+	card = info->card;
+
+	spin_lock_irqsave(&card->card_lock, flags);
+	if (!IS_CYC_Z(*card)) {
 		/* Let the transmit ISR take care of this (since it
 		   requires stuffing characters into the output stream).
 		 */
@@ -3788,18 +3781,18 @@ static void cy_break(struct tty_struct *tty, int break_state)
 			if (!info->breakon) {
 				info->breakon = 1;
 				if (!info->xmit_cnt) {
-					CY_UNLOCK(info, flags);
+					spin_unlock_irqrestore(&card->card_lock, flags);
 					start_xmit(info);
-					CY_LOCK(info, flags);
+					spin_lock_irqsave(&card->card_lock, flags);
 				}
 			}
 		} else {
 			if (!info->breakoff) {
 				info->breakoff = 1;
 				if (!info->xmit_cnt) {
-					CY_UNLOCK(info, flags);
+					spin_unlock_irqrestore(&card->card_lock, flags);
 					start_xmit(info);
-					CY_LOCK(info, flags);
+					spin_lock_irqsave(&card->card_lock, flags);
 				}
 			}
 		}
@@ -3807,16 +3800,16 @@ static void cy_break(struct tty_struct *tty, int break_state)
 		int retval;
 
 		if (break_state == -1) {
-			retval = cyz_issue_cmd(info->card,
-				info->line - info->card->first_line,
+			retval = cyz_issue_cmd(card,
+				info->line - card->first_line,
 				C_CM_SET_BREAK, 0L);
 			if (retval != 0) {
 				printk(KERN_ERR "cyc:cy_break (set) retval on "
 					"ttyC%d was %x\n", info->line, retval);
 			}
 		} else {
-			retval = cyz_issue_cmd(info->card,
-				info->line - info->card->first_line,
+			retval = cyz_issue_cmd(card,
+				info->line - card->first_line,
 				C_CM_CLR_BREAK, 0L);
 			if (retval != 0) {
 				printk(KERN_DEBUG "cyc:cy_break (clr) retval "
@@ -3825,7 +3818,7 @@ static void cy_break(struct tty_struct *tty, int break_state)
 			}
 		}
 	}
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 }				/* cy_break */
 
 static int
@@ -3860,10 +3853,10 @@ static int set_threshold(struct cyclades_port *info, unsigned long value)
 		info->cor3 &= ~CyREC_FIFO;
 		info->cor3 |= value & CyREC_FIFO;
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		cy_writeb(base_addr + (CyCOR3 << index), info->cor3);
 		cyy_issue_cmd(base_addr, CyCOR_CHANGE | CyCOR3ch, index);
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	} else {
 		/* Nothing to do! */
 	}
@@ -3922,9 +3915,9 @@ static int set_timeout(struct cyclades_port *info, unsigned long value)
 		index = card->bus_index;
 		base_addr = card->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		cy_writeb(base_addr + (CyRTPR << index), value & 0xff);
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	} else {
 		/* Nothing to do! */
 	}
@@ -4067,15 +4060,15 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
 		 * Caller should use TIOCGICOUNT to see which one it was
 		 */
 	case TIOCMIWAIT:
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&info->card->card_lock, flags);
 		/* note the counters on entry */
 		cnow = info->icount;
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&info->card->card_lock, flags);
 		ret_val = wait_event_interruptible(info->delta_msr_wait, ({
 			cprev = cnow;
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&info->card->card_lock, flags);
 			cnow = info->icount;	/* atomic copy */
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&info->card->card_lock, flags);
 
 			((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) ||
 			((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) ||
@@ -4091,9 +4084,9 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
 		 *     RI where only 0->1 is counted.
 		 */
 	case TIOCGICOUNT:
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&info->card->card_lock, flags);
 		cnow = info->icount;
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&info->card->card_lock, flags);
 		p_cuser = argp;
 		ret_val = put_user(cnow.cts, &p_cuser->cts);
 		if (ret_val)
@@ -4248,7 +4241,7 @@ static void cy_throttle(struct tty_struct *tty)
 			base_addr = card->base_addr +
 				(cy_chip_offset[chip] << index);
 
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (info->rtsdtr_inv) {
@@ -4258,7 +4251,7 @@ static void cy_throttle(struct tty_struct *tty)
 				cy_writeb(base_addr + (CyMSVR1 << index),
 					  ~CyRTS);
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 		} else {
 			info->throttle = 1;
 		}
@@ -4306,7 +4299,7 @@ static void cy_unthrottle(struct tty_struct *tty)
 			base_addr = card->base_addr +
 				(cy_chip_offset[chip] << index);
 
-			CY_LOCK(info, flags);
+			spin_lock_irqsave(&card->card_lock, flags);
 			cy_writeb(base_addr + (CyCAR << index),
 				  (u_char) channel);
 			if (info->rtsdtr_inv) {
@@ -4316,7 +4309,7 @@ static void cy_unthrottle(struct tty_struct *tty)
 				cy_writeb(base_addr + (CyMSVR1 << index),
 					  CyRTS);
 			}
-			CY_UNLOCK(info, flags);
+			spin_unlock_irqrestore(&card->card_lock, flags);
 		} else {
 			info->throttle = 0;
 		}
@@ -4347,15 +4340,14 @@ static void cy_stop(struct tty_struct *tty)
 		index = cinfo->bus_index;
 		chip = channel >> 2;
 		channel &= 0x03;
-		base_addr = info->card->base_addr +
-			(cy_chip_offset[chip] << index);
+		base_addr = cinfo->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&cinfo->card_lock, flags);
 		cy_writeb(base_addr + (CyCAR << index),
 			(u_char)(channel & 0x0003)); /* index channel */
 		cy_writeb(base_addr + (CySRER << index),
 			  readb(base_addr + (CySRER << index)) & ~CyTxRdy);
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&cinfo->card_lock, flags);
 	} else {
 		/* Nothing to do! */
 	}
@@ -4382,14 +4374,13 @@ static void cy_start(struct tty_struct *tty)
 	if (!IS_CYC_Z(*cinfo)) {
 		chip = channel >> 2;
 		channel &= 0x03;
-		base_addr = info->card->base_addr +
-			(cy_chip_offset[chip] << index);
+		base_addr = cinfo->base_addr + (cy_chip_offset[chip] << index);
 
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&cinfo->card_lock, flags);
 		cy_writeb(base_addr + (CyCAR << index), (u_char) (channel & 0x0003));	/* index channel */
 		cy_writeb(base_addr + (CySRER << index),
 			  readb(base_addr + (CySRER << index)) | CyTxRdy);
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&cinfo->card_lock, flags);
 	} else {
 		/* Nothing to do! */
 	}
@@ -4412,19 +4403,19 @@ static void cy_flush_buffer(struct tty_struct *tty)
 	card = info->card;
 	channel = info->line - card->first_line;
 
-	CY_LOCK(info, flags);
+	spin_lock_irqsave(&card->card_lock, flags);
 	info->xmit_cnt = info->xmit_head = info->xmit_tail = 0;
-	CY_UNLOCK(info, flags);
+	spin_unlock_irqrestore(&card->card_lock, flags);
 
 	if (IS_CYC_Z(*card)) {	/* If it is a Z card, flush the on-board
 					   buffers as well */
-		CY_LOCK(info, flags);
+		spin_lock_irqsave(&card->card_lock, flags);
 		retval = cyz_issue_cmd(card, channel, C_CM_FLUSH_TX, 0L);
 		if (retval != 0) {
 			printk(KERN_ERR "cyc: flush_buffer retval on ttyC%d "
 				"was %x\n", info->line, retval);
 		}
-		CY_UNLOCK(info, flags);
+		spin_unlock_irqrestore(&card->card_lock, flags);
 	}
 	tty_wakeup(tty);
 }				/* cy_flush_buffer */

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 17/21] Char: cyclades, conditions cleanup
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (14 preceding siblings ...)
  2007-04-29 21:03 ` [PATCH 16/21] Char: cyclades, remove locking macros Jiri Slaby
@ 2007-04-29 21:04 ` Jiri Slaby
  2007-04-29 21:05 ` [PATCH 18/21] Char: cyclades, fix tty device unregister Jiri Slaby
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, conditions cleanup

- 0 is not NULL
- use unlikely to hit the icache in isr more likely
- remove or comment empty if/else paths

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit fb2b658e64e69e56c52b1242b9957e9d96f28ade
tree b7f1629c12b53a56bd5b3149ceba3830dbfc028f
parent c2e132ebb19f9f8b3d4aee5cd4f755cd7588d49f
author Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 18:03:37 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sat, 28 Apr 2007 23:48:36 +0200

 drivers/char/cyclades.c |   60 ++++++++++++++++-------------------------------
 1 files changed, 21 insertions(+), 39 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 6e5fca9..620e17c 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -1043,7 +1043,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 		cy_writeb(base_addr + (CyCAR << index), save_xir);
 
 		/* if there is nowhere to put the data, discard it */
-		if (info->tty == 0) {
+		if (info->tty == NULL) {
 			j = (readb(base_addr + (CyRIVR << index)) &
 				CyIVRMask);
 			if (j == CyIVRRxEx) {	/* exception */
@@ -1214,7 +1214,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 			goto txend;
 		}
 		info = &cy_port[i];
-		if (info->tty == 0) {
+		if (info->tty == NULL) {
 			cy_writeb(base_addr + (CySRER << index),
 				  readb(base_addr + (CySRER << index)) &
 				  ~CyTxRdy);
@@ -1263,7 +1263,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 				}
 				goto txdone;
 			}
-			if (info->xmit_buf == 0) {
+			if (info->xmit_buf == NULL) {
 				cy_writeb(base_addr + (CySRER << index),
 					readb(base_addr + (CySRER << index)) &
 					~CyTxRdy);
@@ -1304,7 +1304,6 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 						0);
 					info->icount.tx++;
 					char_count--;
-				} else {
 				}
 			}
 		}
@@ -1333,9 +1332,7 @@ txend:
 		mdm_change = readb(base_addr + (CyMISR << index));
 		mdm_status = readb(base_addr + (CyMSVR1 << index));
 
-		if (info->tty == 0) {	/* no place for data, ignore it */
-			;
-		} else {
+		if (info->tty) {
 			if (mdm_change & CyANY_DELTA) {
 				/* For statistics only */
 				if (mdm_change & CyDCD)
@@ -1389,10 +1386,10 @@ txend:
 					}
 				}
 			}
-			if (mdm_change & CyDSR) {
+/*			if (mdm_change & CyDSR) {
 			}
 			if (mdm_change & CyRI) {
-			}
+			}*/
 		}
 		/* end of service */
 		cy_writeb(base_addr + (CyMIR << index), (save_xir & 0x3f));
@@ -1408,14 +1405,14 @@ txend:
 static irqreturn_t cyy_interrupt(int irq, void *dev_id)
 {
 	int status;
-	struct cyclades_card *cinfo;
+	struct cyclades_card *cinfo = dev_id;
 	void __iomem *base_addr, *card_base_addr;
 	int chip;
 	int index;
 	int too_many;
 	int had_work;
 
-	if ((cinfo = (struct cyclades_card *)dev_id) == 0) {
+	if (unlikely(cinfo == NULL)) {
 #ifdef CY_DEBUG_INTERRUPTS
 		printk(KERN_DEBUG "cyy_interrupt: spurious interrupt %d\n",irq);
 #endif
@@ -1564,7 +1561,7 @@ cyz_handle_rx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 			info->mon.char_max = char_count;
 		info->mon.char_last = char_count;
 #endif
-		if (tty == 0) {
+		if (tty == NULL) {
 			/* flush received characters */
 			new_rx_get = (new_rx_get + char_count) &
 					(rx_bufsize - 1);
@@ -1650,9 +1647,8 @@ cyz_handle_tx(struct cyclades_port *info, struct CH_CTRL __iomem *ch_ctrl,
 
 	if (char_count) {
 
-		if (tty == 0) {
+		if (tty == NULL)
 			goto ztxdone;
-		}
 
 		if (info->x_char) {	/* send special char */
 			data = info->x_char;
@@ -1731,9 +1727,9 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
 		special_count = 0;
 		delta_count = 0;
 		info = &cy_port[channel + cinfo->first_line];
-		if ((tty = info->tty) == 0) {
+		if ((tty = info->tty) == NULL)
 			continue;
-		}
+
 		ch_ctrl = &(zfw_ctrl->ch_ctrl[channel]);
 		buf_ctrl = &(zfw_ctrl->buf_ctrl[channel]);
 
@@ -1822,16 +1818,16 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
 #ifdef CONFIG_CYZ_INTR
 static irqreturn_t cyz_interrupt(int irq, void *dev_id)
 {
-	struct cyclades_card *cinfo;
+	struct cyclades_card *cinfo = dev_id;
 
-	if ((cinfo = (struct cyclades_card *)dev_id) == 0) {
+	if (unlikely(cinfo == NULL))
 #ifdef CY_DEBUG_INTERRUPTS
 		printk(KERN_DEBUG "cyz_interrupt: spurious interrupt %d\n",irq);
 #endif
 		return IRQ_NONE;	/* spurious interrupt */
 	}
 
-	if (!ISZLOADED(*cinfo)) {
+	if (unlikely(!ISZLOADED(*cinfo))) {
 #ifdef CY_DEBUG_INTERRUPTS
 		printk(KERN_DEBUG "cyz_interrupt: board not yet loaded "
 				"(IRQ%d).\n", irq);
@@ -2661,8 +2657,6 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout)
 					timeout))
 				break;
 		}
-	} else {
-		/* Nothing to do! */
 	}
 	/* Run one more char cycle */
 	msleep_interruptible(jiffies_to_msecs(char_time * 5));
@@ -3857,8 +3851,6 @@ static int set_threshold(struct cyclades_port *info, unsigned long value)
 		cy_writeb(base_addr + (CyCOR3 << index), info->cor3);
 		cyy_issue_cmd(base_addr, CyCOR_CHANGE | CyCOR3ch, index);
 		spin_unlock_irqrestore(&card->card_lock, flags);
-	} else {
-		/* Nothing to do! */
 	}
 	return 0;
 }				/* set_threshold */
@@ -3881,10 +3873,8 @@ get_threshold(struct cyclades_port *info, unsigned long __user * value)
 
 		tmp = readb(base_addr + (CyCOR3 << index)) & CyREC_FIFO;
 		return put_user(tmp, value);
-	} else {
-		/* Nothing to do! */
-		return 0;
 	}
+	return 0;
 }				/* get_threshold */
 
 static int
@@ -3918,8 +3908,6 @@ static int set_timeout(struct cyclades_port *info, unsigned long value)
 		spin_lock_irqsave(&card->card_lock, flags);
 		cy_writeb(base_addr + (CyRTPR << index), value & 0xff);
 		spin_unlock_irqrestore(&card->card_lock, flags);
-	} else {
-		/* Nothing to do! */
 	}
 	return 0;
 }				/* set_timeout */
@@ -3941,10 +3929,8 @@ static int get_timeout(struct cyclades_port *info, unsigned long __user * value)
 
 		tmp = readb(base_addr + (CyRTPR << index));
 		return put_user(tmp, value);
-	} else {
-		/* Nothing to do! */
-		return 0;
 	}
+	return 0;
 }				/* get_timeout */
 
 static int set_default_timeout(struct cyclades_port *info, unsigned long value)
@@ -4348,8 +4334,6 @@ static void cy_stop(struct tty_struct *tty)
 		cy_writeb(base_addr + (CySRER << index),
 			  readb(base_addr + (CySRER << index)) & ~CyTxRdy);
 		spin_unlock_irqrestore(&cinfo->card_lock, flags);
-	} else {
-		/* Nothing to do! */
 	}
 }				/* cy_stop */
 
@@ -4381,8 +4365,6 @@ static void cy_start(struct tty_struct *tty)
 		cy_writeb(base_addr + (CySRER << index),
 			  readb(base_addr + (CySRER << index)) | CyTxRdy);
 		spin_unlock_irqrestore(&cinfo->card_lock, flags);
-	} else {
-		/* Nothing to do! */
 	}
 }				/* cy_start */
 
@@ -4694,7 +4676,7 @@ static int __init cy_detect_isa(void)
 		}
 		/* fill the next cy_card structure available */
 		for (j = 0; j < NR_CARDS; j++) {
-			if (cy_card[j].base_addr == 0)
+			if (cy_card[j].base_addr == NULL)
 				break;
 		}
 		if (j == NR_CARDS) {	/* no more cy_cards available */
@@ -4779,7 +4761,7 @@ static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0,
 
 	/* fill the next cy_card structure available */
 	for (j = 0; j < NR_CARDS; j++) {
-		if (cy_card[j].base_addr == 0)
+		if (cy_card[j].base_addr == NULL)
 			break;
 	}
 	if (j == NR_CARDS) {	/* no more cy_cards available */
@@ -4889,7 +4871,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		}
 		/* fill the next cy_card structure available */
 		for (j = 0; j < NR_CARDS; j++) {
-			if (cy_card[j].base_addr == 0)
+			if (cy_card[j].base_addr == NULL)
 				break;
 		}
 		if (j == NR_CARDS) {	/* no more cy_cards available */
@@ -5039,7 +5021,7 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
 
 		/* fill the next cy_card structure available */
 		for (j = 0; j < NR_CARDS; j++) {
-			if (cy_card[j].base_addr == 0)
+			if (cy_card[j].base_addr == NULL)
 				break;
 		}
 		if (j == NR_CARDS) {	/* no more cy_cards available */

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 18/21] Char: cyclades, fix tty device unregister
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (15 preceding siblings ...)
  2007-04-29 21:04 ` [PATCH 17/21] Char: cyclades, conditions cleanup Jiri Slaby
@ 2007-04-29 21:05 ` Jiri Slaby
  2007-04-29 21:06 ` [PATCH 19/21] Char: cyclades, dynamic ports Jiri Slaby
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:05 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, fix tty device unregister

put_tty_driver after unregistering devices

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 0d1d9602e00c115e03e04ee01f3ecc92adbbf504
tree dbb15b2d6088652a00d30b717bd476ecc697da08
parent fb2b658e64e69e56c52b1242b9957e9d96f28ade
author Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 11:27:08 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 11:27:08 +0200

 drivers/char/cyclades.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 620e17c..f23d481 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -5285,8 +5285,6 @@ static void __exit cy_cleanup_module(void)
 		printk(KERN_ERR "failed to unregister Cyclades serial "
 				"driver(%d)\n", e1);
 
-	put_tty_driver(cy_serial_driver);
-
 #ifdef CONFIG_PCI
 	pci_unregister_driver(&cy_pci_driver);
 #endif
@@ -5310,6 +5308,8 @@ static void __exit cy_cleanup_module(void)
 				tty_unregister_device(cy_serial_driver, e1);
 		}
 	}
+
+	put_tty_driver(cy_serial_driver);
 } /* cy_cleanup_module */
 
 module_init(cy_init);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 19/21] Char: cyclades, dynamic ports
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (16 preceding siblings ...)
  2007-04-29 21:05 ` [PATCH 18/21] Char: cyclades, fix tty device unregister Jiri Slaby
@ 2007-04-29 21:06 ` Jiri Slaby
  2007-04-29 21:06 ` [PATCH 20/21] Char: cyclades, probe cleanup Jiri Slaby
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, dynamic ports

and save thus approx. 160k of .bss

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit c1eb9b97d07f0ac45e3c6173b4e5b822a2a5dca2
tree ca449397fca08a7bb4bb6a28f273f8c00eade922
parent 0d1d9602e00c115e03e04ee01f3ecc92adbbf504
author Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 14:51:11 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 14:51:11 +0200

 drivers/char/cyclades.c  |  142 ++++++++++++++++++++++------------------------
 include/linux/cyclades.h |    1 
 2 files changed, 70 insertions(+), 73 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index f23d481..3eabd26 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -722,11 +722,6 @@ module_param_array(irq, int, NULL, 0);
 */
 static struct cyclades_card cy_card[NR_CARDS];
 
-/* This is the per-channel data structure containing pointers, flags
- and variables for the port. This driver supports a maximum of NR_PORTS.
-*/
-static struct cyclades_port cy_port[NR_PORTS];
-
 static int cy_next_channel;	/* next minor available */
 
 /*
@@ -855,13 +850,6 @@ static inline int serial_paranoia_check(struct cyclades_port *info,
 		return 1;
 	}
 
-	if ((long)info < (long)(&cy_port[0]) ||
-			(long)(&cy_port[NR_PORTS]) < (long)info) {
-		printk(KERN_WARNING "cyc Warning: cyclades_port out of range "
-				"for (%s) in %s\n", name, routine);
-		return 1;
-	}
-
 	if (info->magic != CYCLADES_MAGIC) {
 		printk(KERN_WARNING "cyc Warning: bad magic number for serial "
 				"struct (%s) in %s\n", name, routine);
@@ -1025,7 +1013,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 	struct cyclades_port *info;
 	struct tty_struct *tty;
 	int char_count;
-	int i, j, len, mdm_change, mdm_status, outch;
+	int j, len, mdm_change, mdm_status, outch;
 	int save_xir, channel, save_car;
 	char data;
 
@@ -1037,8 +1025,7 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 		spin_lock(&cinfo->card_lock);
 		save_xir = (u_char) readb(base_addr + (CyRIR << index));
 		channel = (u_short) (save_xir & CyIRChannel);
-		i = channel + chip * 4 + cinfo->first_line;
-		info = &cy_port[i];
+		info = &cinfo->ports[channel + chip * 4];
 		save_car = readb(base_addr + (CyCAR << index));
 		cy_writeb(base_addr + (CyCAR << index), save_xir);
 
@@ -1202,18 +1189,17 @@ static void cyy_intr_chip(struct cyclades_card *cinfo, int chip,
 		spin_lock(&cinfo->card_lock);
 		save_xir = (u_char) readb(base_addr + (CyTIR << index));
 		channel = (u_short) (save_xir & CyIRChannel);
-		i = channel + chip * 4 + cinfo->first_line;
 		save_car = readb(base_addr + (CyCAR << index));
 		cy_writeb(base_addr + (CyCAR << index), save_xir);
 
 		/* validate the port# (as configured and open) */
-		if ((i < 0) || (NR_PORTS <= i)) {
+		if (channel + chip * 4 >= cinfo->nports) {
 			cy_writeb(base_addr + (CySRER << index),
 				  readb(base_addr + (CySRER << index)) &
 				  ~CyTxRdy);
 			goto txend;
 		}
-		info = &cy_port[i];
+		info = &cinfo->ports[channel + chip * 4];
 		if (info->tty == NULL) {
 			cy_writeb(base_addr + (CySRER << index),
 				  readb(base_addr + (CySRER << index)) &
@@ -1325,7 +1311,7 @@ txend:
 		spin_lock(&cinfo->card_lock);
 		save_xir = (u_char) readb(base_addr + (CyMIR << index));
 		channel = (u_short) (save_xir & CyIRChannel);
-		info = &cy_port[channel + chip * 4 + cinfo->first_line];
+		info = &cinfo->ports[channel + chip * 4];
 		save_car = readb(base_addr + (CyCAR << index));
 		cy_writeb(base_addr + (CyCAR << index), save_xir);
 
@@ -1726,7 +1712,7 @@ static void cyz_handle_cmd(struct cyclades_card *cinfo)
 	while (cyz_fetch_msg(cinfo, &channel, &cmd, &param) == 1) {
 		special_count = 0;
 		delta_count = 0;
-		info = &cy_port[channel + cinfo->first_line];
+		info = &cinfo->ports[channel];
 		if ((tty = info->tty) == NULL)
 			continue;
 
@@ -1896,7 +1882,7 @@ static void cyz_poll(unsigned long arg)
 		cyz_handle_cmd(cinfo);
 
 		for (port = 0; port < cinfo->nports; port++) {
-			info = &cy_port[port + cinfo->first_line];
+			info = &cinfo->ports[port];
 			tty = info->tty;
 			ch_ctrl = &(zfw_ctrl->ch_ctrl[port]);
 			buf_ctrl = &(zfw_ctrl->buf_ctrl[port]);
@@ -2468,13 +2454,20 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
 static int cy_open(struct tty_struct *tty, struct file *filp)
 {
 	struct cyclades_port *info;
+	unsigned int i;
 	int retval, line;
 
 	line = tty->index;
 	if ((line < 0) || (NR_PORTS <= line)) {
 		return -ENODEV;
 	}
-	info = &cy_port[line];
+	for (i = 0; i < NR_CARDS; i++)
+		if (line < cy_card[i].first_line + cy_card[i].nports &&
+				line >= cy_card[i].first_line)
+			break;
+	if (i >= NR_CARDS)
+		return -ENODEV;
+	info = &cy_card[i].ports[line - cy_card[i].first_line];
 	if (info->line < 0) {
 		return -ENODEV;
 	}
@@ -4437,7 +4430,7 @@ static void cy_hangup(struct tty_struct *tty)
  * ---------------------------------------------------------------------
  */
 
-static void __devinit cy_init_card(struct cyclades_card *cinfo)
+static int __devinit cy_init_card(struct cyclades_card *cinfo)
 {
 	struct cyclades_port *info;
 	u32 mailbox;
@@ -4459,10 +4452,15 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo)
 		nports = cinfo->nports = CyPORTS_PER_CHIP * cinfo->num_chips;
 	}
 
+	cinfo->ports = kzalloc(sizeof(*cinfo->ports) * nports, GFP_KERNEL);
+	if (cinfo->ports == NULL) {
+		printk(KERN_ERR "Cyclades: cannot allocate ports\n");
+		return -ENOMEM;
+	}
+
 	for (port = cinfo->first_line; port < cinfo->first_line + nports;
 			port++) {
-		info = &cy_port[port];
-		memset(info, 0, sizeof(*info));
+		info = &cinfo->ports[port - cinfo->first_line];
 		info->magic = CYCLADES_MAGIC;
 		info->card = cinfo;
 		info->line = port;
@@ -4525,6 +4523,7 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo)
 #endif
 	}
 #endif
+	return 0;
 }
 
 /* initialize chips on Cyclom-Y card -- return number of valid
@@ -5094,13 +5093,11 @@ static void __devexit cy_pci_remove(struct pci_dev *pdev)
 	pci_release_regions(pdev);
 
 	cinfo->base_addr = NULL;
-	for (i = cinfo->first_line; i < cinfo->first_line + cinfo->nports; i++){
-		cy_port[i].line = -1;
-		cy_port[i].magic = -1;
-	}
 	for (i = cinfo->first_line; i < cinfo->first_line +
 			cinfo->nports; i++)
 		tty_unregister_device(cy_serial_driver, i);
+	cinfo->nports = 0;
+	kfree(cinfo->ports);
 }
 
 static struct pci_driver cy_pci_driver = {
@@ -5116,7 +5113,7 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
 		int *eof, void *data)
 {
 	struct cyclades_port *info;
-	int i;
+	unsigned int i, j;
 	int len = 0;
 	off_t begin = 0;
 	off_t pos = 0;
@@ -5130,33 +5127,34 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
 	len += size;
 
 	/* Output one line for each known port */
-	for (i = 0; i < NR_PORTS && cy_port[i].line >= 0; i++) {
-		info = &cy_port[i];
-
-		if (info->count)
-			size = sprintf(buf + len, "%3d %8lu %10lu %8lu %10lu "
-				"%8lu %9lu %6ld\n", info->line,
-				(cur_jifs - info->idle_stats.in_use) / HZ,
-				info->idle_stats.xmit_bytes,
-				(cur_jifs - info->idle_stats.xmit_idle) / HZ,
-				info->idle_stats.recv_bytes,
-				(cur_jifs - info->idle_stats.recv_idle) / HZ,
-				info->idle_stats.overruns,
-				(long)info->tty->ldisc.num);
-		else
-			size = sprintf(buf + len, "%3d %8lu %10lu %8lu %10lu "
-				"%8lu %9lu %6ld\n",
-				info->line, 0L, 0L, 0L, 0L, 0L, 0L, 0L);
-		len += size;
-		pos = begin + len;
-
-		if (pos < offset) {
-			len = 0;
-			begin = pos;
+	for (i = 0; i < NR_CARDS; i++)
+		for (j = 0; j < cy_card[i].nports; j++) {
+			info = &cy_card[i].ports[j];
+
+			if (info->count)
+				size = sprintf(buf + len, "%3d %8lu %10lu %8lu "
+					"%10lu %8lu %9lu %6ld\n", info->line,
+					(cur_jifs - info->idle_stats.in_use) /
+					HZ, info->idle_stats.xmit_bytes,
+					(cur_jifs - info->idle_stats.xmit_idle)/
+					HZ, info->idle_stats.recv_bytes,
+					(cur_jifs - info->idle_stats.recv_idle)/
+					HZ, info->idle_stats.overruns,
+					(long)info->tty->ldisc.num);
+			else
+				size = sprintf(buf + len, "%3d %8lu %10lu %8lu "
+					"%10lu %8lu %9lu %6ld\n",
+					info->line, 0L, 0L, 0L, 0L, 0L, 0L, 0L);
+			len += size;
+			pos = begin + len;
+
+			if (pos < offset) {
+				len = 0;
+				begin = pos;
+			}
+			if (pos > offset + length)
+				goto done;
 		}
-		if (pos > offset + length)
-			goto done;
-	}
 	*eof = 1;
 done:
 	*start = buf + (offset - begin);	/* Start of wanted data */
@@ -5211,7 +5209,7 @@ static const struct tty_operations cy_ops = {
 
 static int __init cy_init(void)
 {
-	unsigned int i, nboards;
+	unsigned int nboards;
 	int retval = -ENOMEM;
 
 	cy_serial_driver = alloc_tty_driver(NR_PORTS);
@@ -5242,11 +5240,6 @@ static int __init cy_init(void)
 		goto err_frtty;
 	}
 
-	for (i = 0; i < NR_PORTS; i++) {
-		cy_port[i].line = -1;
-		cy_port[i].magic = -1;
-	}
-
 	/* the code below is responsible to find the boards. Each different
 	   type of board has its own detection routine. If a board is found,
 	   the next cy_card structure available is set by the detection
@@ -5275,6 +5268,7 @@ err:
 
 static void __exit cy_cleanup_module(void)
 {
+	struct cyclades_card *card;
 	int i, e1;
 
 #ifndef CONFIG_CYZ_INTR
@@ -5290,22 +5284,24 @@ static void __exit cy_cleanup_module(void)
 #endif
 
 	for (i = 0; i < NR_CARDS; i++) {
-		if (cy_card[i].base_addr) {
+		card = &cy_card[i];
+		if (card->base_addr) {
 			/* clear interrupt */
-			cy_writeb(cy_card[i].base_addr + Cy_ClrIntr, 0);
-			iounmap(cy_card[i].base_addr);
-			if (cy_card[i].ctl_addr)
-				iounmap(cy_card[i].ctl_addr);
-			if (cy_card[i].irq
+			cy_writeb(card->base_addr + Cy_ClrIntr, 0);
+			iounmap(card->base_addr);
+			if (card->ctl_addr)
+				iounmap(card->ctl_addr);
+			if (card->irq
 #ifndef CONFIG_CYZ_INTR
-				&& !IS_CYC_Z(cy_card[i])
+				&& !IS_CYC_Z(*card)
 #endif /* CONFIG_CYZ_INTR */
 				)
-				free_irq(cy_card[i].irq, &cy_card[i]);
-			for (e1 = cy_card[i].first_line;
-					e1 < cy_card[i].first_line +
-					cy_card[i].nports; e1++)
+				free_irq(card->irq, card);
+			for (e1 = card->first_line;
+					e1 < card->first_line +
+					card->nports; e1++)
 				tty_unregister_device(cy_serial_driver, e1);
+			kfree(card->ports);
 		}
 	}
 
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 07791f0..72aa00c 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -518,6 +518,7 @@ struct cyclades_card {
     int bus_index;	/* address shift - 0 for ISA, 1 for PCI */
     int	intr_enabled;	/* FW Interrupt flag - 0 disabled, 1 enabled */
     spinlock_t card_lock;
+    struct cyclades_port *ports;
 };
 
 /***************************************

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 20/21] Char: cyclades, probe cleanup
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (17 preceding siblings ...)
  2007-04-29 21:06 ` [PATCH 19/21] Char: cyclades, dynamic ports Jiri Slaby
@ 2007-04-29 21:06 ` Jiri Slaby
  2007-04-29 21:07 ` [PATCH 21/21] Char: cyclades, copyright and version changes Jiri Slaby
  2007-05-02 15:57 ` [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, probe cleanup

- add fail paths
- merge 3 similar initializations into one (Z, Ze, Y)

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit c3f3dcbfe41732ece2f09a7c6e31e7a2b378a0f7
tree 545a30891d1f0d2b2e60affb2ec0a29ec9eb0c1b
parent c1eb9b97d07f0ac45e3c6173b4e5b822a2a5dca2
author Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 21:55:20 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 21:55:20 +0200

 drivers/char/cyclades.c |  466 ++++++++++++++++++++---------------------------
 1 files changed, 197 insertions(+), 269 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 3eabd26..a17ff90 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -4455,6 +4455,7 @@ static int __devinit cy_init_card(struct cyclades_card *cinfo)
 	cinfo->ports = kzalloc(sizeof(*cinfo->ports) * nports, GFP_KERNEL);
 	if (cinfo->ports == NULL) {
 		printk(KERN_ERR "Cyclades: cannot allocate ports\n");
+		cinfo->nports = 0;
 		return -ENOMEM;
 	}
 
@@ -4647,9 +4648,15 @@ static int __init cy_detect_isa(void)
 
 		/* probe for CD1400... */
 		cy_isa_address = ioremap(isa_address, CyISA_Ywin);
+		if (cy_isa_address == NULL) {
+			printk(KERN_ERR "Cyclom-Y/ISA: can't remap base "
+					"address\n");
+			continue;
+		}
 		cy_isa_nchan = CyPORTS_PER_CHIP *
 			cyy_init_card(cy_isa_address, 0);
 		if (cy_isa_nchan == 0) {
+			iounmap(cy_isa_address);
 			continue;
 		}
 #ifdef MODULE
@@ -4663,6 +4670,7 @@ static int __init cy_detect_isa(void)
 			printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but the "
 				"IRQ could not be detected.\n",
 				(unsigned long)cy_isa_address);
+			iounmap(cy_isa_address);
 			continue;
 		}
 
@@ -4671,6 +4679,7 @@ static int __init cy_detect_isa(void)
 				"more channels are available. Change NR_PORTS "
 				"in cyclades.c and recompile kernel.\n",
 				(unsigned long)cy_isa_address);
+			iounmap(cy_isa_address);
 			return nboard;
 		}
 		/* fill the next cy_card structure available */
@@ -4683,6 +4692,7 @@ static int __init cy_detect_isa(void)
 				"more cards can be used. Change NR_CARDS in "
 				"cyclades.c and recompile kernel.\n",
 				(unsigned long)cy_isa_address);
+			iounmap(cy_isa_address);
 			return nboard;
 		}
 
@@ -4692,6 +4702,7 @@ static int __init cy_detect_isa(void)
 			printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but "
 				"could not allocate IRQ#%d.\n",
 				(unsigned long)cy_isa_address, cy_isa_irq);
+			iounmap(cy_isa_address);
 			return nboard;
 		}
 
@@ -4702,7 +4713,12 @@ static int __init cy_detect_isa(void)
 		cy_card[j].bus_index = 0;
 		cy_card[j].first_line = cy_next_channel;
 		cy_card[j].num_chips = cy_isa_nchan / 4;
-		cy_init_card(&cy_card[j]);
+		if (cy_init_card(&cy_card[j])) {
+			cy_card[j].base_addr = NULL;
+			free_irq(cy_isa_irq, &cy_card[j]);
+			iounmap(cy_isa_address);
+			continue;
+		}
 		nboard++;
 
 		printk(KERN_INFO "Cyclom-Y/ISA #%d: 0x%lx-0x%lx, IRQ%d found: "
@@ -4736,333 +4752,245 @@ static void __devinit plx_init(void __iomem * addr, __u32 initctl)
 	cy_writel(addr + initctl, readl(addr + initctl) & ~0x20000000);
 }
 
-static int __devinit cy_init_Ze(struct RUNTIME_9060 __iomem *cy_pci_addr0,
-		int cy_pci_irq, struct pci_dev *pdev)
-{
-	void __iomem *cy_pci_addr2;
-	unsigned int j;
-	unsigned short cy_pci_nchan;
-
-	cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Ze_win);
-
-	readl(&cy_pci_addr0->mail_box_0);
-	dev_dbg(&pdev->dev, "new Cyclades-Z board.  FPGA not loaded\n");
-
-	/* This must be the new Cyclades-Ze/PCI. */
-	cy_pci_nchan = ZE_V1_NPORTS;
-
-	if ((cy_next_channel + cy_pci_nchan) > NR_PORTS) {
-		dev_err(&pdev->dev, "Cyclades-Ze/PCI found, but no channels "
-			"are available.\nChange NR_PORTS in cyclades.c "
-			"and recompile kernel.\n");
-		return -EIO;
-	}
-
-	/* fill the next cy_card structure available */
-	for (j = 0; j < NR_CARDS; j++) {
-		if (cy_card[j].base_addr == NULL)
-			break;
-	}
-	if (j == NR_CARDS) {	/* no more cy_cards available */
-		dev_err(&pdev->dev, "Cyclades-Ze/PCI found, but no more "
-			"cards can be used.\nChange NR_CARDS in "
-			"cyclades.c and recompile kernel.\n");
-		return -EIO;
-	}
-#ifdef CONFIG_CYZ_INTR
-	/* allocate IRQ only if board has an IRQ */
-	if ((cy_pci_irq != 0) && (cy_pci_irq != 255)) {
-		if (request_irq(cy_pci_irq, cyz_interrupt,
-				IRQF_SHARED, "Cyclades-Z",
-				&cy_card[j])) {
-			dev_err(&pdev->dev, "could not allocate IRQ.\n");
-			return -EIO;
-		}
-	}
-#endif				/* CONFIG_CYZ_INTR */
-
-	/* set cy_card */
-	cy_card[j].base_addr = cy_pci_addr2;
-	cy_card[j].ctl_addr = cy_pci_addr0;
-	cy_card[j].irq = cy_pci_irq;
-	cy_card[j].bus_index = 1;
-	cy_card[j].first_line = cy_next_channel;
-	cy_card[j].num_chips = -1;
-	cy_init_card(&cy_card[j]);
-	pci_set_drvdata(pdev, &cy_card[j]);
-
-	dev_info(&pdev->dev, "Cyclades-Ze/PCI #%d found: %d channels starting "
-		"from port %d.\n", j + 1, cy_pci_nchan, cy_next_channel);
-
-	for (j = cy_next_channel; j < cy_next_channel + cy_pci_nchan; j++)
-		tty_register_device(cy_serial_driver, j, &pdev->dev);
-	cy_next_channel += cy_pci_nchan;
-
-	return 0;
-}
-
 static int __devinit cy_pci_probe(struct pci_dev *pdev,
 		const struct pci_device_id *ent)
 {
-	unsigned char cyy_rev_id;
-	int cy_pci_irq;
-	__u32 mailbox;
-	void __iomem *cy_pci_addr0, *cy_pci_addr2;
-	unsigned int device_id;
-	unsigned short j, cy_pci_nchan, plx_ver;
-	int retval;
+	void __iomem *addr0 = NULL, *addr2 = NULL;
+	char *card_name = NULL;
+	u32 mailbox;
+	unsigned int device_id, nchan = 0, card_no, i;
+	unsigned char plx_ver;
+	int retval, irq;
 
 	retval = pci_enable_device(pdev);
 	if (retval) {
 		dev_err(&pdev->dev, "cannot enable device\n");
-		return retval;
+		goto err;
 	}
 
 	/* read PCI configuration area */
-	cy_pci_irq = pdev->irq;
-	pci_read_config_byte(pdev, PCI_REVISION_ID, &cyy_rev_id);
-
+	irq = pdev->irq;
 	device_id = pdev->device & ~PCI_DEVICE_ID_MASK;
 
+#if defined(__alpha__)
+	if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) {	/* below 1M? */
+		dev_err(&pdev->dev, "Cyclom-Y/PCI not supported for low "
+			"addresses on Alpha systems.\n");
+		retval = -EIO;
+		goto err_dis;
+	}
+#endif
+	if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo) {
+		dev_err(&pdev->dev, "Cyclades-Z/PCI not supported for low "
+			"addresses\n");
+		retval = -EIO;
+		goto err_dis;
+	}
+
+	if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
+		dev_warn(&pdev->dev, "PCI I/O bit incorrectly set. Ignoring "
+				"it...\n");
+		pdev->resource[2].flags &= ~IORESOURCE_IO;
+	}
+
+	retval = pci_request_regions(pdev, "cyclades");
+	if (retval) {
+		dev_err(&pdev->dev, "failed to reserve resources\n");
+		goto err_dis;
+	}
+
+	retval = -EIO;
 	if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo ||
 			device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
-		dev_dbg(&pdev->dev, "Cyclom-Y/PCI found\n");
-
-		if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
-			dev_warn(&pdev->dev, "PCI I/O bit incorrectly "
-				"set. Ignoring it...\n");
-			pdev->resource[2].flags &= ~IORESOURCE_IO;
-		}
+		card_name = "Cyclom-Y";
 
-		/* Although we don't use this I/O region, we should
-		   request it from the kernel anyway, to avoid problems
-		   with other drivers accessing it. */
-		retval = pci_request_regions(pdev, "Cyclom-Y");
-		if (retval) {
-			dev_err(&pdev->dev, "failed to reserve resources\n");
-			return retval;
+		addr0 = pci_iomap(pdev, 0, CyPCI_Yctl);
+		if (addr0 == NULL) {
+			dev_err(&pdev->dev, "can't remap ctl region\n");
+			goto err_reg;
 		}
-#if defined(__alpha__)
-		if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) {	/* below 1M? */
-			dev_err(&pdev->dev, "Cyclom-Y/PCI not supported for "
-				"low addresses on Alpha systems.\n");
-			return -EIO;
+		addr2 = pci_iomap(pdev, 2, CyPCI_Ywin);
+		if (addr2 == NULL) {
+			dev_err(&pdev->dev, "can't remap base region\n");
+			goto err_unmap;
 		}
-#endif
-		cy_pci_addr0 = pci_iomap(pdev, 0, CyPCI_Yctl);
-		cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Ywin);
-
-		dev_dbg(&pdev->dev, "Cyclom-Y/PCI: relocate winaddr=0x%p "
-			"ctladdr=0x%p\n", cy_pci_addr2, cy_pci_addr0);
 
-		cy_pci_nchan = (unsigned short)(CyPORTS_PER_CHIP *
-				cyy_init_card(cy_pci_addr2, 1));
-		if (cy_pci_nchan == 0) {
+		nchan = CyPORTS_PER_CHIP * cyy_init_card(addr2, 1);
+		if (nchan == 0) {
 			dev_err(&pdev->dev, "Cyclom-Y PCI host card with no "
 					"Serial-Modules\n");
 			return -EIO;
 		}
-		if ((cy_next_channel + cy_pci_nchan) > NR_PORTS) {
-			dev_err(&pdev->dev, "Cyclom-Y/PCI found, but no "
-				"channels are available. Change NR_PORTS in "
-				"cyclades.c and recompile kernel.\n");
-			return -EIO;
-		}
-		/* fill the next cy_card structure available */
-		for (j = 0; j < NR_CARDS; j++) {
-			if (cy_card[j].base_addr == NULL)
-				break;
-		}
-		if (j == NR_CARDS) {	/* no more cy_cards available */
-			dev_err(&pdev->dev, "Cyclom-Y/PCI found, but no more "
-				"cards can be used. Change NR_CARDS in "
-				"cyclades.c and recompile kernel.\n");
-			return -EIO;
-		}
-
-		/* allocate IRQ */
-		retval = request_irq(cy_pci_irq, cyy_interrupt,
-				IRQF_SHARED, "Cyclom-Y", &cy_card[j]);
-		if (retval) {
-			dev_err(&pdev->dev, "could not allocate IRQ\n");
-			return retval;
-		}
-
-		/* set cy_card */
-		cy_card[j].base_addr = cy_pci_addr2;
-		cy_card[j].ctl_addr = cy_pci_addr0;
-		cy_card[j].irq = cy_pci_irq;
-		cy_card[j].bus_index = 1;
-		cy_card[j].first_line = cy_next_channel;
-		cy_card[j].num_chips = cy_pci_nchan / 4;
-		cy_init_card(&cy_card[j]);
-		pci_set_drvdata(pdev, &cy_card[j]);
-
-		/* enable interrupts in the PCI interface */
-		plx_ver = readb(cy_pci_addr2 + CyPLX_VER) & 0x0f;
-		switch (plx_ver) {
-		case PLX_9050:
-
-			cy_writeb(cy_pci_addr0 + 0x4c, 0x43);
-			break;
-
-		case PLX_9060:
-		case PLX_9080:
-		default:	/* Old boards, use PLX_9060 */
-
-			plx_init(cy_pci_addr0, 0x6c);
-		/* For some yet unknown reason, once the PLX9060 reloads
-		   the EEPROM, the IRQ is lost and, thus, we have to
-		   re-write it to the PCI config. registers.
-		   This will remain here until we find a permanent
-		   fix. */
-			pci_write_config_byte(pdev, PCI_INTERRUPT_LINE,
-					cy_pci_irq);
-
-			cy_writew(cy_pci_addr0 + 0x68,
-				readw(cy_pci_addr0 + 0x68) | 0x0900);
-			break;
-		}
-
-		dev_info(&pdev->dev, "Cyclom-Y/PCI #%d found: %d channels "
-			"starting from port %d.\n", j + 1, cy_pci_nchan,
-			cy_next_channel);
-
-		for (j = cy_next_channel;
-				j < cy_next_channel + cy_pci_nchan; j++)
-			tty_register_device(cy_serial_driver, j, &pdev->dev);
-
-		cy_next_channel += cy_pci_nchan;
-	} else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Lo) {
-		dev_err(&pdev->dev, "Cyclades-Z/PCI not supported for "
-			"low addresses\n");
-		return -EIO;
 	} else if (device_id == PCI_DEVICE_ID_CYCLOM_Z_Hi) {
-		dev_dbg(&pdev->dev, "Cyclades-Z/PCI found\n");
+		struct RUNTIME_9060 __iomem *ctl_addr;
 
-		cy_pci_addr0 = pci_iomap(pdev, 0, CyPCI_Zctl);
+		ctl_addr = addr0 = pci_iomap(pdev, 0, CyPCI_Zctl);
+		if (addr0 == NULL) {
+			dev_err(&pdev->dev, "can't remap ctl region\n");
+			goto err_reg;
+		}
 
 		/* Disable interrupts on the PLX before resetting it */
-		cy_writew(cy_pci_addr0 + 0x68,
-			readw(cy_pci_addr0 + 0x68) & ~0x0900);
+		cy_writew(addr0 + 0x68,
+			readw(addr0 + 0x68) & ~0x0900);
 
-		plx_init(cy_pci_addr0, 0x6c);
+		plx_init(addr0, 0x6c);
 		/* For some yet unknown reason, once the PLX9060 reloads
 		   the EEPROM, the IRQ is lost and, thus, we have to
 		   re-write it to the PCI config. registers.
 		   This will remain here until we find a permanent
 		   fix. */
-		pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, cy_pci_irq);
+		pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, irq);
 
-		mailbox = (__u32)readl(&((struct RUNTIME_9060 __iomem *)
-				cy_pci_addr0)->mail_box_0);
+		mailbox = (u32)readl(&ctl_addr->mail_box_0);
 
-		if (pci_resource_flags(pdev, 2) & IORESOURCE_IO) {
-			dev_warn(&pdev->dev, "PCI I/O bit incorrectly "
-				"set. Ignoring it...\n");
-			pdev->resource[2].flags &= ~IORESOURCE_IO;
-		}
-
-		/* Although we don't use this I/O region, we should
-		   request it from the kernel anyway, to avoid problems
-		   with other drivers accessing it. */
-		retval = pci_request_regions(pdev, "Cyclades-Z");
-		if (retval) {
-			dev_err(&pdev->dev, "failed to reserve resources\n");
-			return retval;
+		addr2 = pci_iomap(pdev, 2, mailbox == ZE_V1 ?
+				CyPCI_Ze_win : CyPCI_Zwin);
+		if (addr2 == NULL) {
+			dev_err(&pdev->dev, "can't remap base region\n");
+			goto err_unmap;
 		}
 
 		if (mailbox == ZE_V1) {
-			retval = cy_init_Ze(cy_pci_addr0, cy_pci_irq, pdev);
-			return retval;
+			card_name = "Cyclades-Ze";
+
+			readl(&ctl_addr->mail_box_0);
+			nchan = ZE_V1_NPORTS;
 		} else {
-			cy_pci_addr2 = pci_iomap(pdev, 2, CyPCI_Zwin);
-		}
+			card_name = "Cyclades-8Zo";
 
-		dev_dbg(&pdev->dev, "Cyclades-Z/PCI: relocate winaddr=0x%p "
-			"ctladdr=0x%p\n", cy_pci_addr2, cy_pci_addr0);
 #ifdef CY_PCI_DEBUG
-		if (mailbox == ZO_V1) {
-			cy_writel(&((struct RUNTIME_9060 *)
-				(cy_pci_addr0))->loc_addr_base,
-				WIN_CREG);
-			dev_info(&pdev->dev, "Cyclades-8Zo/PCI: FPGA id %lx, "
-				"ver %lx\n", (ulong)(0xff &
-				readl(&((struct CUSTOM_REG *)
-					cy_pci_addr2)->fpga_id)),
-				(ulong)(0xff & readl(&((struct CUSTOM_REG *)
-					cy_pci_addr2)->fpga_version)));
-			cy_writel(&((struct RUNTIME_9060 *)
-				cy_pci_addr0)->loc_addr_base, WIN_RAM);
-		} else {
-			dev_info(&pdev->dev, "Cyclades-Z/PCI: New Cyclades-Z "
-				"board.  FPGA not loaded\n");
-		}
+			if (mailbox == ZO_V1) {
+				cy_writel(&ctl_addr->loc_addr_base, WIN_CREG);
+				dev_info(&pdev->dev, "Cyclades-8Zo/PCI: FPGA "
+					"id %lx, ver %lx\n", (ulong)(0xff &
+					readl(&((struct CUSTOM_REG *)addr2)->
+						fpga_id)), (ulong)(0xff &
+					readl(&((struct CUSTOM_REG *)addr2)->
+						fpga_version)));
+				cy_writel(&ctl_addr->loc_addr_base, WIN_RAM);
+			} else {
+				dev_info(&pdev->dev, "Cyclades-Z/PCI: New "
+					"Cyclades-Z board.  FPGA not loaded\n");
+			}
 #endif
-		/* The following clears the firmware id word.  This
-		   ensures that the driver will not attempt to talk to
-		   the board until it has been properly initialized.
-		 */
-		if ((mailbox == ZO_V1) || (mailbox == ZO_V2))
-			cy_writel(cy_pci_addr2 + ID_ADDRESS, 0L);
-
-		/* This must be a Cyclades-8Zo/PCI.  The extendable
-		   version will have a different device_id and will
-		   be allocated its maximum number of ports. */
-		cy_pci_nchan = 8;
-
-		if ((cy_next_channel + cy_pci_nchan) > NR_PORTS) {
-			dev_err(&pdev->dev, "Cyclades-8Zo/PCI found, but no "
-				"channels are available. Change NR_PORTS in "
-				"cyclades.c and recompile kernel.\n");
-			return -EIO;
-		}
+			/* The following clears the firmware id word.  This
+			   ensures that the driver will not attempt to talk to
+			   the board until it has been properly initialized.
+			 */
+			if ((mailbox == ZO_V1) || (mailbox == ZO_V2))
+				cy_writel(addr2 + ID_ADDRESS, 0L);
 
-		/* fill the next cy_card structure available */
-		for (j = 0; j < NR_CARDS; j++) {
-			if (cy_card[j].base_addr == NULL)
-				break;
+			/* This must be a Cyclades-8Zo/PCI.  The extendable
+			   version will have a different device_id and will
+			   be allocated its maximum number of ports. */
+			nchan = 8;
 		}
-		if (j == NR_CARDS) {	/* no more cy_cards available */
-			dev_err(&pdev->dev, "Cyclades-8Zo/PCI found, but no "
-				"more cards can be used. Change NR_CARDS in "
-				"cyclades.c and recompile kernel.\n");
-			return -EIO;
+	}
+
+	if ((cy_next_channel + nchan) > NR_PORTS) {
+		dev_err(&pdev->dev, "Cyclades-8Zo/PCI found, but no "
+			"channels are available. Change NR_PORTS in "
+			"cyclades.c and recompile kernel.\n");
+		goto err_unmap;
+	}
+	/* fill the next cy_card structure available */
+	for (card_no = 0; card_no < NR_CARDS; card_no++) {
+		if (cy_card[card_no].base_addr == NULL)
+			break;
+	}
+	if (card_no == NR_CARDS) {	/* no more cy_cards available */
+		dev_err(&pdev->dev, "Cyclades-8Zo/PCI found, but no "
+			"more cards can be used. Change NR_CARDS in "
+			"cyclades.c and recompile kernel.\n");
+		goto err_unmap;
+	}
+
+	if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo ||
+			device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
+		/* allocate IRQ */
+		retval = request_irq(irq, cyy_interrupt,
+				IRQF_SHARED, "Cyclom-Y", &cy_card[card_no]);
+		if (retval) {
+			dev_err(&pdev->dev, "could not allocate IRQ\n");
+			goto err_unmap;
 		}
+		cy_card[card_no].num_chips = nchan / 4;
+	} else {
 #ifdef CONFIG_CYZ_INTR
 		/* allocate IRQ only if board has an IRQ */
-		if ((cy_pci_irq != 0) && (cy_pci_irq != 255)) {
-			retval = request_irq(cy_pci_irq, cyz_interrupt,
+		if (irq != 0 && irq != 255) {
+			retval = request_irq(irq, cyz_interrupt,
 					IRQF_SHARED, "Cyclades-Z",
 					&cy_card[j]);
 			if (retval) {
 				dev_err(&pdev->dev, "could not allocate IRQ\n");
-				return retval;
+				goto err_unmap;
 			}
 		}
 #endif				/* CONFIG_CYZ_INTR */
+		cy_card[card_no].num_chips = -1;
+	}
 
-		/* set cy_card */
-		cy_card[j].base_addr = cy_pci_addr2;
-		cy_card[j].ctl_addr = cy_pci_addr0;
-		cy_card[j].irq = cy_pci_irq;
-		cy_card[j].bus_index = 1;
-		cy_card[j].first_line = cy_next_channel;
-		cy_card[j].num_chips = -1;
-		cy_init_card(&cy_card[j]);
-		pci_set_drvdata(pdev, &cy_card[j]);
+	/* set cy_card */
+	cy_card[card_no].base_addr = addr2;
+	cy_card[card_no].ctl_addr = addr0;
+	cy_card[card_no].irq = irq;
+	cy_card[card_no].bus_index = 1;
+	cy_card[card_no].first_line = cy_next_channel;
+	retval = cy_init_card(&cy_card[card_no]);
+	if (retval)
+		goto err_null;
 
-		dev_info(&pdev->dev, "Cyclades-8Zo/PCI #%d found: %d channels "
-			"starting from port %d.\n", j + 1, cy_pci_nchan,
-			cy_next_channel);
+	pci_set_drvdata(pdev, &cy_card[card_no]);
 
-		for (j = cy_next_channel;
-				j < cy_next_channel + cy_pci_nchan; j++)
-			tty_register_device(cy_serial_driver, j, &pdev->dev);
-		cy_next_channel += cy_pci_nchan;
+	if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo ||
+			device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
+		/* enable interrupts in the PCI interface */
+		plx_ver = readb(addr2 + CyPLX_VER) & 0x0f;
+		switch (plx_ver) {
+		case PLX_9050:
+
+			cy_writeb(addr0 + 0x4c, 0x43);
+			break;
+
+		case PLX_9060:
+		case PLX_9080:
+		default:	/* Old boards, use PLX_9060 */
+
+			plx_init(addr0, 0x6c);
+		/* For some yet unknown reason, once the PLX9060 reloads
+		   the EEPROM, the IRQ is lost and, thus, we have to
+		   re-write it to the PCI config. registers.
+		   This will remain here until we find a permanent
+		   fix. */
+			pci_write_config_byte(pdev, PCI_INTERRUPT_LINE, irq);
+
+			cy_writew(addr0 + 0x68, readw(addr0 + 0x68) | 0x0900);
+			break;
+		}
 	}
 
+	dev_info(&pdev->dev, "%s/PCI #%d found: %d channels starting from "
+		"port %d.\n", card_name, card_no + 1, nchan, cy_next_channel);
+	for (i = cy_next_channel; i < cy_next_channel + nchan; i++)
+		tty_register_device(cy_serial_driver, i, &pdev->dev);
+	cy_next_channel += nchan;
+
 	return 0;
+err_null:
+	cy_card[card_no].base_addr = NULL;
+	free_irq(irq, &cy_card[card_no]);
+err_unmap:
+	pci_iounmap(pdev, addr0);
+	if (addr2)
+		pci_iounmap(pdev, addr2);
+err_reg:
+	pci_release_regions(pdev);
+err_dis:
+	pci_disable_device(pdev);
+err:
+	return retval;
 }
 
 static void __devexit cy_pci_remove(struct pci_dev *pdev)

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 21/21] Char: cyclades, copyright and version changes
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (18 preceding siblings ...)
  2007-04-29 21:06 ` [PATCH 20/21] Char: cyclades, probe cleanup Jiri Slaby
@ 2007-04-29 21:07 ` Jiri Slaby
  2007-05-02 15:57 ` [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
  20 siblings, 0 replies; 23+ messages in thread
From: Jiri Slaby @ 2007-04-29 21:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

cyclades, copyright and version changes

- add copyright
- move version one number upper and use MODULE_VERSION

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

---
commit 8f3cdfa90cfef76f4249331f4f6d7e06654f777d
tree d573fe3d21dde85e3aeb50233efa766b7d9f5bb1
parent c3f3dcbfe41732ece2f09a7c6e31e7a2b378a0f7
author Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 22:21:46 +0200
committer Jiri Slaby <jirislaby@gmail.com> Sun, 29 Apr 2007 22:21:46 +0200

 drivers/char/cyclades.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index a17ff90..ff961a3 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -10,15 +10,14 @@
  *
  * Initially written by Randolph Bentson <bentson@grieg.seaslug.org>.
  * Modified and maintained by Marcio Saito <marcio@cyclades.com>.
- * Currently maintained by Cyclades team <async@cyclades.com>.
  *
- * For Technical support and installation problems, please send e-mail
- * to support@cyclades.com.
+ * Copyright (C) 2007 Jiri Slaby <jirislaby@gmail.com>
  *
  * Much of the design and some of the code came from serial.c
  * which was copyright (C) 1991, 1992  Linus Torvalds.  It was
  * extensively rewritten by Theodore Ts'o, 8/16/92 -- 9/14/92,
  * and then fixed as suggested by Michael K. Johnson 12/12/92.
+ * Converted to pci probing and cleaned up by Jiri Slaby.
  *
  * This version supports shared IRQ's (only for PCI boards).
  *
@@ -591,7 +590,7 @@
  *
  */
 
-#define CY_VERSION	"2.4"
+#define CY_VERSION	"2.5"
 
 /* If you need to install more boards than NR_CARDS, change the constant
    in the definition below. No other change is necessary to support up to
@@ -5240,3 +5239,4 @@ module_init(cy_init);
 module_exit(cy_cleanup_module);
 
 MODULE_LICENSE("GPL");
+MODULE_VERSION(CY_VERSION);

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro
  2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
                   ` (19 preceding siblings ...)
  2007-04-29 21:07 ` [PATCH 21/21] Char: cyclades, copyright and version changes Jiri Slaby
@ 2007-05-02 15:57 ` Jiri Slaby
  2007-05-02 19:47   ` Andrew Morton
  20 siblings, 1 reply; 23+ messages in thread
From: Jiri Slaby @ 2007-05-02 15:57 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On 4/29/07, Jiri Slaby <jirislaby@gmail.com> wrote:
> cyclades, use IS_CYC_Z macro
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
>
> ---
> commit 167ae9073fef562913c9d68d32da883da5444fbc
> tree 5d5795a789e6ce98a5a1226cf88e2b98b1d9a12a
> parent b462f2fd89bff92e55be6a5317a3be0ad6a93ad8
> author Jiri Slaby <jirislaby@gmail.com> Tue, 24 Apr 2007 21:40:00 +0200
> committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:14:54 +0200
>
>  drivers/char/cyclades.c |   17 ++++++-----------
>  1 files changed, 6 insertions(+), 11 deletions(-)

Andrew, did this patchset reach you, please?
01-cyclades-use-is-cyc-z-macro.patch
02-cyclades-switch-to-pci-probing.patch
03-cyclades-depends-on-pci-or-isa.patch
04-cyclades-unexport-struct-cyclades-card.patch
05-cyclades-remove-useless-fileds-from-cyclades-card.patch
06-cyclades-irq-is-int.patch
07-cyclades-printk-cleanups.patch
08-cyclades-mark-cyy-init-card-as---devinit-not---init.patch
09-cyclades-simplify-variables-initialization.patch
10-cyclades-get-rid-of-phys-addresses.patch
11-cyclades-make-info-card-a-pointer.patch
12-cyclades-remove-sleep-on.patch
13-cyclades-fix-blockmove.patch
14-cyclades-timers-cleanup.patch
15-cyclades-remove-unused-timestamps.patch
16-cyclades-remove-locking-macros.patch
17-cyclades-conditions-cleanup.patch
18-cyclades-fix-tty-device-unregister.patch
19-cyclades-dynamic-ports.patch
20-cyclades-probe-cleanup.patch
21-cyclades-copyright-and-version-changes.patch

thanks,
-- 
http://www.fi.muni.cz/~xslaby/            Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8  22A0 32CC 55C3 39D4 7A7E

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro
  2007-05-02 15:57 ` [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
@ 2007-05-02 19:47   ` Andrew Morton
  0 siblings, 0 replies; 23+ messages in thread
From: Andrew Morton @ 2007-05-02 19:47 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: linux-kernel

On Wed, 2 May 2007 17:57:56 +0200
"Jiri Slaby" <jirislaby@gmail.com> wrote:

> On 4/29/07, Jiri Slaby <jirislaby@gmail.com> wrote:
> > cyclades, use IS_CYC_Z macro
> >
> > Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> >
> > ---
> > commit 167ae9073fef562913c9d68d32da883da5444fbc
> > tree 5d5795a789e6ce98a5a1226cf88e2b98b1d9a12a
> > parent b462f2fd89bff92e55be6a5317a3be0ad6a93ad8
> > author Jiri Slaby <jirislaby@gmail.com> Tue, 24 Apr 2007 21:40:00 +0200
> > committer Jiri Slaby <jirislaby@gmail.com> Fri, 27 Apr 2007 13:14:54 +0200
> >
> >  drivers/char/cyclades.c |   17 ++++++-----------
> >  1 files changed, 6 insertions(+), 11 deletions(-)
> 
> Andrew, did this patchset reach you, please?

yep.

> 01-cyclades-use-is-cyc-z-macro.patch
> 02-cyclades-switch-to-pci-probing.patch
> 03-cyclades-depends-on-pci-or-isa.patch
> 04-cyclades-unexport-struct-cyclades-card.patch
> 05-cyclades-remove-useless-fileds-from-cyclades-card.patch
> 06-cyclades-irq-is-int.patch
> 07-cyclades-printk-cleanups.patch
> 08-cyclades-mark-cyy-init-card-as---devinit-not---init.patch
> 09-cyclades-simplify-variables-initialization.patch
> 10-cyclades-get-rid-of-phys-addresses.patch
> 11-cyclades-make-info-card-a-pointer.patch
> 12-cyclades-remove-sleep-on.patch
> 13-cyclades-fix-blockmove.patch
> 14-cyclades-timers-cleanup.patch
> 15-cyclades-remove-unused-timestamps.patch
> 16-cyclades-remove-locking-macros.patch
> 17-cyclades-conditions-cleanup.patch
> 18-cyclades-fix-tty-device-unregister.patch
> 19-cyclades-dynamic-ports.patch
> 20-cyclades-probe-cleanup.patch
> 21-cyclades-copyright-and-version-changes.patch
> 

I'm not merging new work like this at present: once we get 2.6.22-rc1
merged up I can start looking at new material.


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2007-05-02 19:48 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-29 20:53 [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
2007-04-29 20:54 ` [PATCH 2/21] Char: cyclades, switch to pci probing Jiri Slaby
2007-04-29 20:54 ` [PATCH 3/21] Char: cyclades, depends on PCI or ISA Jiri Slaby
2007-04-29 20:55 ` [PATCH 4/21] Char: cyclades, unexport struct cyclades_card Jiri Slaby
2007-04-29 20:56 ` [PATCH 5/21] Char: cyclades, remove useless fileds from cyclades_card Jiri Slaby
2007-04-29 20:57 ` [PATCH 6/21] Char: cyclades, irq is int Jiri Slaby
2007-04-29 20:57 ` [PATCH 7/21] Char: cyclades, printk cleanups Jiri Slaby
2007-04-29 20:58 ` [PATCH 8/21] Char: cyclades, mark cyy_init_card as __devinit, not __init Jiri Slaby
2007-04-29 20:59 ` [PATCH 9/21] Char: cyclades, simplify variables initialization Jiri Slaby
2007-04-29 20:59 ` [PATCH 10/21] Char: cyclades, get rid of phys addresses Jiri Slaby
2007-04-29 21:00 ` [PATCH 11/21] Char: cyclades, make info->card a pointer Jiri Slaby
2007-04-29 21:01 ` [PATCH 12/21] Char: cyclades, remove sleep_on Jiri Slaby
2007-04-29 21:01 ` [PATCH 13/21] Char: cyclades, fix blockmove Jiri Slaby
2007-04-29 21:02 ` [PATCH 14/21] Char: cyclades, timers cleanup Jiri Slaby
2007-04-29 21:03 ` [PATCH 15/21] Char: cyclades, remove unused timestamps Jiri Slaby
2007-04-29 21:03 ` [PATCH 16/21] Char: cyclades, remove locking macros Jiri Slaby
2007-04-29 21:04 ` [PATCH 17/21] Char: cyclades, conditions cleanup Jiri Slaby
2007-04-29 21:05 ` [PATCH 18/21] Char: cyclades, fix tty device unregister Jiri Slaby
2007-04-29 21:06 ` [PATCH 19/21] Char: cyclades, dynamic ports Jiri Slaby
2007-04-29 21:06 ` [PATCH 20/21] Char: cyclades, probe cleanup Jiri Slaby
2007-04-29 21:07 ` [PATCH 21/21] Char: cyclades, copyright and version changes Jiri Slaby
2007-05-02 15:57 ` [PATCH 1/21] Char: cyclades, use IS_CYC_Z macro Jiri Slaby
2007-05-02 19:47   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox