From: Andrey Panin <pazke@orbita.don.sitek.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] /drivers/char/cyclades.c: panic() call removal
Date: Sun, 11 Mar 2001 16:47:47 +0300 [thread overview]
Message-ID: <20010311164747.A332@debian> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 259 bytes --]
Hi all,
this patch removes panic() calls and adds MODULE_DEVICE_TABLE to cyclades driver.
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc
[-- Attachment #1.2: patch-cyclades --]
[-- Type: text/plain, Size: 3090 bytes --]
--- /linux/drivers/char/cyclades.c.orig Sun Mar 11 19:50:00 2001
+++ /linux/drivers/char/cyclades.c Sun Mar 11 20:09:08 2001
@@ -866,17 +866,21 @@
static unsigned short cy_isa_nboard;
static unsigned short cy_nboard;
#ifdef CONFIG_PCI
-static unsigned short cy_pci_dev_id[] = {
- PCI_DEVICE_ID_CYCLOM_Y_Lo, /* PCI < 1Mb */
- PCI_DEVICE_ID_CYCLOM_Y_Hi, /* PCI > 1Mb */
- PCI_DEVICE_ID_CYCLOM_4Y_Lo, /* 4Y PCI < 1Mb */
- PCI_DEVICE_ID_CYCLOM_4Y_Hi, /* 4Y PCI > 1Mb */
- PCI_DEVICE_ID_CYCLOM_8Y_Lo, /* 8Y PCI < 1Mb */
- PCI_DEVICE_ID_CYCLOM_8Y_Hi, /* 8Y PCI > 1Mb */
- PCI_DEVICE_ID_CYCLOM_Z_Lo, /* Z PCI < 1Mb */
- PCI_DEVICE_ID_CYCLOM_Z_Hi, /* Z PCI > 1Mb */
- 0 /* end of table */
- };
+#define CYCLADES_DEVICE(x) { PCI_VENDOR_ID_CYCLADES, PCI_DEVICE_ID_CYCLOM_##x##, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }
+
+static struct pci_device_id cy_pci_dev_id[] = {
+ CYCLADES_DEVICE(Y_Lo), /* PCI < 1Mb */
+ CYCLADES_DEVICE(Y_Hi), /* PCI > 1Mb */
+ CYCLADES_DEVICE(4Y_Lo), /* 4Y PCI < 1Mb */
+ CYCLADES_DEVICE(4Y_Hi), /* 4Y PCI > 1Mb */
+ CYCLADES_DEVICE(8Y_Lo), /* 8Y PCI < 1Mb */
+ CYCLADES_DEVICE(8Y_Hi), /* 8Y PCI > 1Mb */
+ CYCLADES_DEVICE(Z_Lo), /* Z PCI < 1Mb */
+ CYCLADES_DEVICE(Z_Hi), /* Z PCI > 1Mb */
+ { 0, } /* end of table */
+};
+
+MODULE_DEVICE_TABLE(pci, cy_pci_dev_id);
#endif
static void cy_start(struct tty_struct *);
@@ -4970,7 +4974,7 @@
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]) != 0) {
+ while((device_id = cy_pci_dev_id[dev_index].device) != 0) {
if((pdev = pci_find_device(PCI_VENDOR_ID_CYCLADES,
device_id, pdev)) == NULL) {
dev_index++; /* try next device id */
@@ -5478,6 +5482,15 @@
extra ports are ignored.
*/
+static void __init cy_cleanup_after_failure(struct tty_driver *tty)
+{
+ unsigned long flags;
+ save_flags(flags); cli();
+ remove_bh(CYCLADES_BH);
+ if (tty) tty_unregister_driver(tty);
+ restore_flags(flags);
+}
+
int __init
cy_init(void)
{
@@ -5544,10 +5557,16 @@
cy_callout_driver.proc_entry = 0;
- if (tty_register_driver(&cy_serial_driver))
- panic("Couldn't register Cyclades serial driver\n");
- if (tty_register_driver(&cy_callout_driver))
- panic("Couldn't register Cyclades callout driver\n");
+ if ((i = tty_register_driver(&cy_serial_driver))) {
+ printk(KERN_ERR "cyclades: Couldn't register Cyclades serial driver\n");
+ cy_cleanup_after_failure(NULL);
+ return i;
+ }
+ if ((i = tty_register_driver(&cy_callout_driver))) {
+ printk(KERN_ERR "cyclades: Couldn't register Cyclades callout driver\n");
+ cy_cleanup_after_failure(&cy_serial_driver);
+ return i;
+ }
for (i = 0; i < NR_CARDS; i++) {
/* base_addr=0 indicates board not found */
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
next reply other threads:[~2001-03-11 13:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-11 13:47 Andrey Panin [this message]
2001-03-12 16:08 ` [PATCH] /drivers/char/cyclades.c: panic() call removal Ivan Passos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010311164747.A332@debian \
--to=pazke@orbita.don.sitek.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).