int smartcan_irq=-1;
unsigned long smartcan_base=0x0;
+static can_spinlock_t smartcan_port_lock=SPIN_LOCK_UNLOCKED;
+
int smartcan_request_io(struct candevice_t *candev)
{
if (!can_request_io_region(candev->io_addr,0x04,DEVICE_NAME)) {
void smartcan_write_register(unsigned char data, unsigned long address)
{
- can_disable_irq(smartcan_irq);
+ can_spin_irqflags_t flags;
+ can_spin_lock_irqsave(&smartcan_port_lock,flags);
outb(address-smartcan_base,smartcan_base);
outb(data,smartcan_base+1);
- can_enable_irq(smartcan_irq);
+ can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
}
unsigned smartcan_read_register(unsigned long address)
{
unsigned ret;
- can_disable_irq(smartcan_irq);
+ can_spin_irqflags_t flags;
+ can_spin_lock_irqsave(&smartcan_port_lock,flags);
outb(address-smartcan_base,smartcan_base);
ret=inb(smartcan_base+1);
- can_enable_irq(smartcan_irq);
+ can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
return ret;
}