нашел у себя в почте ревью драйвера, но не уделил особого внимания, так как все и так работает и времени заниматься им не было... сейчас решил сделать все по-честному
> +static int mkopci_wait_irq(struct mkopci_device *dev) > +{ > + volatile unsigned long *LPCI_4C = > + (unsigned long *)(dev->core.lin_base[0] + 0x4C); > + > + *LPCI_4C |= 0x49; > + > + if (wait_event_interruptible(dev->wq, *LPCI_4C & 0x24)) > + return -ERESTARTSYS; > + if (v > 1) > + pr_info("mkopci%d: irq received\n", dev->core.n_dev); > + *LPCI_4C &= ~0x40;
You can't directly access memory like this safely, please use the proper
io memory functions instead, otherwise bad things are guaranteed to
happen.
// от себя скажу, что такая фигня там с первой ревизи (еще для 2.4.x) и bad things замечены не были %)
ну ок, согласен, есть же функции io{read,write}32, в конце концов
сделал так:
static int mkopci_wait_irq(struct mkopci_device *dev)
{
unsigned long flags, LPCI_4C;
unsigned long *lpci_4c_addr = (unsigned long *) (dev->core.lin_base[0] + 0x4C);
LPCI_4C = ioread32(lpci_4c_addr);
iowrite32(LPCI_4C | 0x49, lpci_4c_addr); // 01001001
if (wait_event_interruptible(dev->wq, *lpci_4c_addr & 0x24)) {
return -ERESTARTSYS;
}
if (v > 1)
printk(KERN_INFO "mkopci%d: irq recieved\n", dev->core.n_dev);
LPCI_4C = ioread32(lpci_4c_addr);
iowrite32(LPCI_4C & ~0x40, lpci_4c_addr); // ~01000000
но что делать с wait_event_interruptible?? в смысле, все-равно в ней «неправильное» чтение остается...