struct pci_dev *pci_dev;
int i;
- pci_for_each_dev(pci_dev)
- {
+ for(pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_dev != NULL ;
+ pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
if (pci_dev->vendor == PCI_VENDOR_ID_ADLINK)
{
for (i= 0; i< pci6208_board_nbr; i++)
static int pci9111_attach(comedi_device *dev,comedi_devconfig *it)
{
-
- comedi_subdevice *subdevice;
- int io_base, io_range, lcr_io_base, lcr_io_range;
- struct pci_dev* pci_device;
- int error,i;
- pci9111_board_struct* board;
-
-//
-// Probe the device to determine what device in the series it is.
-//
-
- printk("comedi%d: " PCI9111_DRIVER_NAME " driver\n",dev->minor);
-
- pci_for_each_dev(pci_device)
- {
- if (pci_device->vendor == PCI_VENDOR_ID_ADLINK)
- {
- for (i= 0; i< pci9111_board_nbr; i++)
- {
- if(pci9111_boards[i].device_id == pci_device->device)
+ comedi_subdevice *subdevice;
+ int io_base, io_range, lcr_io_base, lcr_io_range;
+ struct pci_dev* pci_device;
+ int error,i;
+ pci9111_board_struct* board;
+
+ //
+ // Probe the device to determine what device in the series it is.
+ //
+
+ printk("comedi%d: " PCI9111_DRIVER_NAME " driver\n",dev->minor);
+
+ for(pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_device != NULL ;
+ pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_device))
{
- // was a particular bus/slot requested?
- if((it->options[0] != 0) || (it->options[1] != 0))
- {
- // are we on the wrong bus/slot?
- if(pci_device->bus->number != it->options[0] ||
- PCI_SLOT(pci_device->devfn) != it->options[1])
- {
- continue;
- }
- }
-
- dev->board_ptr = pci9111_boards + i;
- board = (pci9111_board_struct *) dev->board_ptr;
- goto found;
+ if (pci_device->vendor == PCI_VENDOR_ID_ADLINK)
+ {
+ for (i= 0; i< pci9111_board_nbr; i++)
+ {
+ if(pci9111_boards[i].device_id == pci_device->device)
+ {
+ // was a particular bus/slot requested?
+ if((it->options[0] != 0) || (it->options[1] != 0))
+ {
+ // are we on the wrong bus/slot?
+ if(pci_device->bus->number != it->options[0] ||
+ PCI_SLOT(pci_device->devfn) != it->options[1])
+ {
+ continue;
+ }
+ }
+
+ dev->board_ptr = pci9111_boards + i;
+ board = (pci9111_board_struct *) dev->board_ptr;
+ goto found;
+ }
+ }
+ }
}
- }
- }
- }
-
- printk ("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
- dev->minor,it->options[0], it->options[1]);
- return -EIO;
-
+
+ printk ("comedi%d: no supported board found! (req. bus/slot : %d/%d)\n",
+ dev->minor,it->options[0], it->options[1]);
+ return -EIO;
+
found:
-
- printk("comedi%d: found %s (b:s:f=%d:%d:%d) , irq=%d\n",
- dev->minor,
- pci9111_boards[i].name,
- pci_device->bus->number,
- PCI_SLOT(pci_device->devfn),
- PCI_FUNC(pci_device->devfn),
- pci_device->irq);
-
- // TODO: Warn about non-tested boards.
-
- switch(board->device_id)
- {
- };
-
- // Read local configuration register base address [PCI_BASE_ADDRESS #1].
-
- lcr_io_base = pci_resource_start (pci_device, 1);
- lcr_io_range = pci_resource_end (pci_device, 1) - lcr_io_base +1;
-
- printk ("comedi%d: local configuration registers at address 0x%4x [0x%4x]\n",
- dev->minor,
- lcr_io_base,
- lcr_io_range);
-
- // Read PCI6308 register base address [PCI_BASE_ADDRESS #2].
-
- io_base = pci_resource_start (pci_device, 2);
- io_range = pci_resource_end (pci_device, 2) - io_base +1;
-
- printk ("comedi%d: 6503 registers at address 0x%4x [0x%4x]\n",
- dev->minor,
- io_base,
- io_range);
-
- // Allocate IO ressources
+
+ printk("comedi%d: found %s (b:s:f=%d:%d:%d) , irq=%d\n",
+ dev->minor,
+ pci9111_boards[i].name,
+ pci_device->bus->number,
+ PCI_SLOT(pci_device->devfn),
+ PCI_FUNC(pci_device->devfn),
+ pci_device->irq);
+
+ // TODO: Warn about non-tested boards.
+
+ switch(board->device_id)
+ {
+ };
+
+ // Read local configuration register base address [PCI_BASE_ADDRESS #1].
+
+ lcr_io_base = pci_resource_start (pci_device, 1);
+ lcr_io_range = pci_resource_end (pci_device, 1) - lcr_io_base +1;
+
+ printk ("comedi%d: local configuration registers at address 0x%4x [0x%4x]\n",
+ dev->minor,
+ lcr_io_base,
+ lcr_io_range);
+
+ // Read PCI6308 register base address [PCI_BASE_ADDRESS #2].
+
+ io_base = pci_resource_start (pci_device, 2);
+ io_range = pci_resource_end (pci_device, 2) - io_base +1;
+
+ printk ("comedi%d: 6503 registers at address 0x%4x [0x%4x]\n",
+ dev->minor,
+ io_base,
+ io_range);
+
+ // Allocate IO ressources
if(pci_request_regions(pci_device, PCI9111_DRIVER_NAME))
{
printk("comedi%d: I/O port conflict\n",dev->minor);
return -EIO;
}
-
- dev->iobase=io_base;
- dev->board_name = board->name;
-
- if(alloc_private(dev,sizeof(pci9111_private_data_struct))<0)
- return -ENOMEM;
-
- dev_private->pci_device = pci_device;
- dev_private->io_range = io_range;
- dev_private->is_valid=0;
- dev_private->lcr_io_base=lcr_io_base;
- dev_private->lcr_io_range=lcr_io_range;
-
- pci9111_reset(dev);
-
- // Irq setup
-
- dev->irq=0;
- if (pci_device->irq>0)
- {
- if (comedi_request_irq (pci_device->irq,
- pci9111_interrupt,
- SA_SHIRQ,
- PCI9111_DRIVER_NAME,
- dev)!=0)
- {
- printk ("comedi%d: unable to allocate irq %d\n", dev->minor, pci_device->irq);
- return -EINVAL;
- }
- }
- dev->irq = pci_device->irq;
-
-//
-// TODO: Add external multiplexer setup (according to option[2]).
-//
-
- if((error=alloc_subdevices(dev, 4))<0)
- return error;
-
- subdevice = dev->subdevices + 0;
- dev->read_subdev = subdevice;
-
- subdevice->type = COMEDI_SUBD_AI;
- subdevice->subdev_flags = SDF_READABLE|SDF_COMMON;
-
-//
-// TODO: Add external multiplexer data
-//
-// if (devpriv->usemux) { subdevice->n_chan = devpriv->usemux; }
-// else { subdevice->n_chan = this_board->n_aichan; }
-//
+
+ dev->iobase=io_base;
+ dev->board_name = board->name;
+
+ if(alloc_private(dev,sizeof(pci9111_private_data_struct))<0)
+ return -ENOMEM;
+
+ dev_private->pci_device = pci_device;
+ dev_private->io_range = io_range;
+ dev_private->is_valid=0;
+ dev_private->lcr_io_base=lcr_io_base;
+ dev_private->lcr_io_range=lcr_io_range;
+
+ pci9111_reset(dev);
+
+ // Irq setup
+
+ dev->irq=0;
+ if (pci_device->irq>0)
+ {
+ if (comedi_request_irq (pci_device->irq,
+ pci9111_interrupt,
+ SA_SHIRQ,
+ PCI9111_DRIVER_NAME,
+ dev)!=0)
+ {
+ printk ("comedi%d: unable to allocate irq %d\n", dev->minor, pci_device->irq);
+ return -EINVAL;
+ }
+ }
+ dev->irq = pci_device->irq;
+
+ //
+ // TODO: Add external multiplexer setup (according to option[2]).
+ //
+
+ if((error=alloc_subdevices(dev, 4))<0)
+ return error;
+
+ subdevice = dev->subdevices + 0;
+ dev->read_subdev = subdevice;
+
+ subdevice->type = COMEDI_SUBD_AI;
+ subdevice->subdev_flags = SDF_READABLE|SDF_COMMON;
+
+ //
+ // TODO: Add external multiplexer data
+ //
+ // if (devpriv->usemux) { subdevice->n_chan = devpriv->usemux; }
+ // else { subdevice->n_chan = this_board->n_aichan; }
+ //
subdevice->n_chan = board->ai_channel_nbr;
subdevice->maxdata = board->ai_resolution_mask;
return -ENOMEM;
}
- pci_for_each_dev(pcidev) {
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if ((pcidev->vendor!=this_board->vendor_id)||
(pcidev->device!=this_board->device_id))
continue;
amcc_devices=NULL;
last=NULL;
- pci_for_each_dev(pcidev){
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if(pcidev->vendor==pci_vendor){
amcc=kmalloc(sizeof(*amcc),GFP_KERNEL);
memset(amcc,0,sizeof(*amcc));
}
/* Look for matching PCI device. */
- pci_for_each_dev(pci_dev) {
+ for(pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_dev != NULL ;
+ pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
/* If bus/slot specified, check them. */
if (bus || slot) {
if (bus != pci_dev->bus->number
}
/* Look for matching PCI device. */
- pci_for_each_dev(pci_dev) {
+ for(pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_dev != NULL ;
+ pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
/* If bus/slot specified, check them. */
if (bus || slot) {
if (bus != pci_dev->bus->number
printk("comedi%d: amplc_pci230\n",dev->minor);
/* Find card */
- pci_for_each_dev(pci_dev){
+ for(pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_dev != NULL ;
+ pci_dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) {
if(pci_dev->vendor != PCI_VENDOR_ID_AMPLICON)
continue;
for(i=0;i<n_pci230_boards;i++){
*/
printk("\n");
- pci_for_each_dev(pcidev)
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev))
{
// is it not a computer boards card?
if(pcidev->vendor != PCI_VENDOR_ID_CB)
* Probe the device to determine what device in the series it is.
*/
- pci_for_each_dev( pcidev )
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev))
{
// is it not a computer boards card?
if( pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS )
*/
printk("\n");
- pci_for_each_dev(pcidev){
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if(pcidev->vendor==PCI_VENDOR_ID_CB){
if(it->options[0] || it->options[1]){
if(pcidev->bus->number==it->options[0] &&
*/
printk("\n");
- pci_for_each_dev(pcidev)
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev))
{
// is it not a computer boards card?
if(pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS)
struct pci_dev *pcidev;
int index, registers;
- pci_for_each_dev(pcidev)
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev))
{
// is it not a computer boards card?
if(pcidev->vendor != PCI_VENDOR_ID_COMPUTERBOARDS)
if(alloc_subdevices(dev, 2)<0)
return -ENOMEM;
- pci_for_each_dev ( pcidev ) {
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if ( pcidev->vendor == PCI_VENDOR_ID_CONTEC &&
pcidev->device == PCI_DEVICE_ID_PIO1616L ) {
}
printk("\n");
// find card
- pci_for_each_dev(pdev){
+ for(pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pdev != NULL ;
+ pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) {
if(pdev->vendor == PCI_VENDOR_ID_COMPUTERBOARDS &&
pdev->device == PCI_DEVICE_ID_PCIDAS08){
if(it->options[0] || it->options[1]){
inova_devices=NULL;
last=NULL;
-#if LINUX_VERSION_CODE < 0x020300
- for(pcidev=pci_devices;pcidev;pcidev=pcidev->next){
-#else
- pci_for_each_dev(pcidev){
-#endif
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if(pcidev->vendor==pci_vendor){
inova=kmalloc(sizeof(*inova),GFP_KERNEL);
memset(inova,0,sizeof(*inova));
int error, i;
/* Probe the device to determine what device in the series it is. */
- pci_for_each_dev(pci_device)
+ for(pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_device != NULL ;
+ pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_device))
{
if(pci_device->vendor == PCI_VENDOR_ID_KOLTER)
{
/*
* Probe the device to determine what device in the series it is.
*/
- pci_for_each_dev(pci_device){
+ for(pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_device != NULL ;
+ pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_device)) {
if(pci_device->vendor == PCI_VENDOR_ID_MEILHAUS){
for(i = 0; i < ME4000_BOARD_VERSIONS; i++){
if(me4000_boards[i].device_id == pci_device->device){
//
// Probe the device to determine what device in the series it is.
//
- pci_for_each_dev(pci_device)
+ for(pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pci_device != NULL ;
+ pci_device = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_device))
{
if(pci_device->vendor == PCI_VENDOR_ID_MEILHAUS)
{
struct pci_dev *pcidev;
struct mite_struct *mite;
- pci_for_each_dev(pcidev){
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if(pcidev->vendor==PCI_VENDOR_ID_NATINST){
mite=kmalloc(sizeof(*mite),GFP_KERNEL);
if(!mite){
/*
* Probe the device to determine what device in the series it is.
*/
- pci_for_each_dev (pcidev) {
+ for(pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL); pcidev != NULL ;
+ pcidev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {
if (pcidev->vendor == PCI_VENDOR_ID_RTD) {
if (it->options[0] || it->options[1]) {
if (pcidev->bus->number == it->options[0]
struct comedi_irq_struct *it;
int ret;
- it=kmalloc(sizeof(*it),GFP_KERNEL);
+ it=kmalloc(sizeof(struct comedi_irq_struct),GFP_KERNEL);
if(!it)
return -ENOMEM;
- memset(it,0,sizeof(*it));
+ memset(it,0,sizeof(struct comedi_irq_struct));
it->handler=handler;
it->irq=irq;
#include_next <linux/pci.h>
#define PCI_SUPPORT_VER2
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-/* we should get rid of this, as it has been dropped from 2.6 */
-#define pci_for_each_dev(x) \
- for((x) = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,NULL); \
- (x); \
- (x) = pci_find_device(PCI_ANY_ID,PCI_ANY_ID,(x)))
-#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) /* XXX */
struct pci_driver {
static inline int pci_module_init(struct pci_driver *drv) { return 0; }
static inline void pci_unregister_driver(struct pci_driver *) { return; }
-#define pci_for_each_dev(x) \
- for((x)=pci_devices;(x);(x)=(x)->next)
-
static inline int pci_enable_device(struct pci_dev *dev){return 0;}
#define pci_disable_device(x)