* [PATCH] /drivers/char/cyclades.c: panic() call removal
@ 2001-03-11 13:47 Andrey Panin
2001-03-12 16:08 ` Ivan Passos
0 siblings, 1 reply; 2+ messages in thread
From: Andrey Panin @ 2001-03-11 13:47 UTC (permalink / raw)
To: linux-kernel
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] /drivers/char/cyclades.c: panic() call removal
2001-03-11 13:47 [PATCH] /drivers/char/cyclades.c: panic() call removal Andrey Panin
@ 2001-03-12 16:08 ` Ivan Passos
0 siblings, 0 replies; 2+ messages in thread
From: Ivan Passos @ 2001-03-12 16:08 UTC (permalink / raw)
To: Andrey Panin; +Cc: Linux Kernel List, torvalds
On Sun, 11 Mar 2001, Andrey Panin wrote:
>
> this patch removes panic() calls and adds MODULE_DEVICE_TABLE to
> cyclades driver.
Patch looks good. Thanks for the patch, Andrey!
However: Linus, please do not apply this yet. I'll do tests with a new
Cyclades driver version we're about to release, and then I'll submit
patches to the Cyclades driver once the tests are done (and they'll
include Andrey's patch).
Later,
Ivan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-03-12 16:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-11 13:47 [PATCH] /drivers/char/cyclades.c: panic() call removal Andrey Panin
2001-03-12 16:08 ` Ivan Passos
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).