- u8 irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
- unsigned long flags;
-
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- save_flags(flags);
- cli();
- #else
- spin_lock_irqsave(&pcan_lock, flags);
- #endif
-
- outb((0x0B ^ 0x0D) | irqEnable, _PC_);
- outb((port & 0x1F) | 0x80, _PA_);
- outb((0x0B ^ 0x0C) | irqEnable, _PC_);
- b1=nibble_decode[inb(_PB_)>>3];
- outb(0x40, _PA_);
- b0=nibble_decode[inb(_PB_)>>3];
- outb((0x0B ^ 0x0D) | irqEnable, _PC_);
-
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- restore_flags(flags);
- #else
- spin_unlock_irqrestore(&pcan_lock, flags);
- #endif
+ u8 irqEnable = can_inb(_PC_) & 0x10; // don't influence irqEnable
+ can_spin_irqflags_t flags;
+
+ can_spin_lock_irqsave(&pcan_lock, flags);
+
+ can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+ can_outb((port & 0x1F) | 0x80, _PA_);
+ can_outb((0x0B ^ 0x0C) | irqEnable, _PC_);
+ b1=nibble_decode[can_inb(_PB_)>>3];
+ can_outb(0x40, _PA_);
+ b0=nibble_decode[can_inb(_PB_)>>3];
+ can_outb((0x0B ^ 0x0D) | irqEnable, _PC_);
+
+ can_spin_unlock_irqrestore(&pcan_lock, flags);