From: Josh Boyer <jwboyer@charter.net>
To: torvalds@transmeta.com
Cc: mhw@wittsend.com, linux-kernel@vger.kernel.org
Subject: [PATCH] 2.5.73: drivers/char/ip2main.c
Date: 23 Jun 2003 20:52:32 -0500 [thread overview]
Message-ID: <1056419552.3662.30.camel@localhost.localdomain> (raw)
Hello,
Here is a patch for the Computone Intelliport mulitiport driver against
2.5.73. Fixed the compile error. Also changed cli() calls to
spin_lock_irqsave/spin_unlock_irqrestore.
Thx,
josh
--- linux-2.5.73.orig/drivers/char/ip2main.c 2003-06-22
13:33:36.000000000 -0500
+++ linux-2.5.73/drivers/char/ip2main.c 2003-06-23 20:39:17.000000000
-0500
@@ -114,6 +114,7 @@
#include <linux/cdk.h>
#include <linux/comstats.h>
#include <linux/delay.h>
+#include <linux/spinlock.h>
#include <asm/system.h>
#include <asm/io.h>
@@ -707,40 +708,42 @@
}
}
#else /* LINUX_VERSION_CODE > 2.1.99 */
- struct pci_dev *pci_dev_i = NULL;
- pci_dev_i = pci_find_device(PCI_VENDOR_ID_COMPUTONE,
- PCI_DEVICE_ID_COMPUTONE_IP2EX, pci_dev_i);
- if (pci_dev_i != NULL) {
- unsigned int addr;
- unsigned char pci_irq;
-
- ip2config.type[i] = PCI;
- status =
- pci_read_config_dword(pci_dev_i, PCI_BASE_ADDRESS_1, &addr);
- if ( addr & 1 ) {
- ip2config.addr[i]=(USHORT)(addr&0xfffe);
- } else {
- printk( KERN_ERR "IP2: PCI I/O address error\n");
- }
- status =
- pci_read_config_byte(pci_dev_i, PCI_INTERRUPT_LINE, &pci_irq);
+ {
+ struct pci_dev *pci_dev_i = NULL;
+ pci_dev_i = pci_find_device(PCI_VENDOR_ID_COMPUTONE,
+ PCI_DEVICE_ID_COMPUTONE_IP2EX, pci_dev_i);
+ if (pci_dev_i != NULL) {
+ unsigned int addr;
+ unsigned char pci_irq;
-// If the PCI BIOS assigned it, lets try and use it. If we
-// can't acquire it or it screws up, deal with it then.
+ ip2config.type[i] = PCI;
+ status =
+ pci_read_config_dword(pci_dev_i, PCI_BASE_ADDRESS_1, &addr);
+ if ( addr & 1 ) {
+ ip2config.addr[i]=(USHORT)(addr&0xfffe);
+ } else {
+ printk( KERN_ERR "IP2: PCI I/O address error\n");
+ }
+ status =
+ pci_read_config_byte(pci_dev_i, PCI_INTERRUPT_LINE, &pci_irq);
-// if (!is_valid_irq(pci_irq)) {
-// printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
-// pci_irq = 0;
-// }
- ip2config.irq[i] = pci_irq;
- } else { // ann error
- ip2config.addr[i] = 0;
- if (status == PCIBIOS_DEVICE_NOT_FOUND) {
- printk( KERN_ERR "IP2: PCI board %d not found\n", i );
- } else {
- pcibios_strerror(status);
+ // If the PCI BIOS assigned it, lets try and use it. If we
+ // can't acquire it or it screws up, deal with it then.
+
+ // if (!is_valid_irq(pci_irq)) {
+ // printk( KERN_ERR "IP2: Bad PCI BIOS IRQ(%d)\n",pci_irq);
+ // pci_irq = 0;
+ // }
+ ip2config.irq[i] = pci_irq;
+ } else { // ann error
+ ip2config.addr[i] = 0;
+ if (status == PCIBIOS_DEVICE_NOT_FOUND) {
+ printk( KERN_ERR "IP2: PCI board %d not found\n", i );
+ } else {
+ pcibios_strerror(status);
+ }
}
- }
+ }
#endif /* ! 2_0_X */
#else
printk( KERN_ERR "IP2: PCI card specified but PCI support not\n");
@@ -2101,6 +2104,7 @@
struct async_icount cprev, cnow; /* kernel counter temps */
struct serial_icounter_struct *p_cuser; /* user space */
int rc = 0;
+ spinlock_t lock = SPIN_LOCK_UNLOCKED;
unsigned long flags;
if ( pCh == NULL ) {
@@ -2265,9 +2269,9 @@
* for masking). Caller should use TIOCGICOUNT to see which one it was
*/
case TIOCMIWAIT:
- save_flags(flags);cli();
+ spin_lock_irqsave(&lock, flags);
cprev = pCh->icount; /* note the counters on entry */
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
i2QueueCommands(PTYPE_BYPASS, pCh, 100, 4,
CMD_DCD_REP, CMD_CTS_REP, CMD_DSR_REP, CMD_RI_REP);
init_waitqueue_entry(&wait, current);
@@ -2287,9 +2291,9 @@
rc = -ERESTARTSYS;
break;
}
- save_flags(flags);cli();
+ spin_lock_irqsave(&lock, flags);
cnow = pCh->icount; /* atomic copy */
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) {
rc = -EIO; /* no change => rc */
@@ -2327,9 +2331,9 @@
case TIOCGICOUNT:
ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc );
- save_flags(flags);cli();
+ spin_lock_irqsave(&lock, flags);
cnow = pCh->icount;
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
p_cuser = (struct serial_icounter_struct *) arg;
PUT_USER(rc,cnow.cts, &p_cuser->cts);
PUT_USER(rc,cnow.dsr, &p_cuser->dsr);
reply other threads:[~2003-06-24 1:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1056419552.3662.30.camel@localhost.localdomain \
--to=jwboyer@charter.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mhw@wittsend.com \
--cc=torvalds@transmeta.com \
/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
all inboxes | Powered by JetHome®