// SPDX-License-Identifier: GPL-2.0 /* sercos3: UIO driver for the Automata Sercos III PCI card
Copyright (C) 2008 Linutronix GmbH Author: John Ogness <john.ogness@linutronix.de>
This is a straight-forward UIO driver, where interrupts are disabled by the interrupt handler and re-enabled via a write to the UIO device by the userspace-part.
The only part that may seem odd is the use of a logical OR when storing and restoring enabled interrupts. This is done because the userspace-part could directly modify the Interrupt Enable Register at any time. To reduce possible conflicts, the kernel driver uses a logical OR to make more controlled changes (rather than blindly overwriting previous values).
Race conditions exist if the userspace-part directly modifies the Interrupt Enable Register while in operation. The consequences are that certain interrupts would fail to be enabled or disabled. For this reason, the userspace-part should only directly modify the Interrupt Enable Register at the beginning (to get things going). The userspace-part can safely disable interrupts at any time using a write to the UIO device.
*/
if (uio_register_device(&dev->dev, info)) goto out_unmap;
return 0;
out_unmap: for (i = 0; i < 5; i++) { if (info->mem[i].internal_addr)
iounmap(info->mem[i].internal_addr);
}
pci_release_regions(dev);
out_disable:
pci_disable_device(dev); return -ENODEV;
}
uio_unregister_device(info);
pci_release_regions(dev);
pci_disable_device(dev); for (i = 0; i < 5; i++) { if (info->mem[i].internal_addr)
iounmap(info->mem[i].internal_addr);
}
}
module_pci_driver(sercos3_pci_driver);
MODULE_DESCRIPTION("UIO driver for the Automata Sercos III PCI card");
MODULE_AUTHOR("John Ogness ");
MODULE_LICENSE("GPL v2");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.