From: David Schleef Date: Mon, 8 Jan 2001 22:00:45 +0000 (+0000) Subject: select device based on bus,slot X-Git-Tag: r0_7_54~11 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff70f1d4851221e7e06619aacbc50efe4938e078;p=comedi.git select device based on bus,slot --- diff --git a/comedi/drivers/ni_pcidio.c b/comedi/drivers/ni_pcidio.c index 961151e0..ba99d164 100644 --- a/comedi/drivers/ni_pcidio.c +++ b/comedi/drivers/ni_pcidio.c @@ -221,7 +221,7 @@ typedef struct{ }nidio96_private; #define devpriv ((nidio96_private *)dev->private) -static int nidio_find_device(comedi_device *dev,comedi_devconfig *it); +static int nidio_find_device(comedi_device *dev,int bus,int slot); #if 0 static int setup_mite(comedi_device *dev); #endif @@ -386,7 +386,7 @@ static int nidio_attach(comedi_device *dev,comedi_devconfig *it) if((ret=alloc_private(dev,sizeof(nidio96_private)))<0) return ret; - ret=nidio_find_device(dev,it); + ret=nidio_find_device(dev,it->options[0],it->options[1]); if(ret<0)return ret; dev->iobase=mite_setup(devpriv->mite); @@ -454,13 +454,24 @@ static int nidio_detach(comedi_device *dev) } -static int nidio_find_device(comedi_device *dev,comedi_devconfig *it) +static int nidio_find_device(comedi_device *dev,int bus,int slot) { struct mite_struct *mite; int i; for(mite=mite_devices;mite;mite=mite->next){ if(mite->used)continue; + if(bus || slot){ +#ifdef PCI_SUPPORT_VER1 + if(bus!=(mite->pci_bus<<8) || + slot!=PCI_SLOT(mite->pci_device_fn)) + continue; +#else + if(bus!=(mite->pcidev->bus->number<<8) || + slot!=PCI_SLOT(mite->pcidev->devfn)) + continue; +#endif + } for(i=0;iboard=i; diff --git a/comedi/drivers/ni_pcimio.c b/comedi/drivers/ni_pcimio.c index b36e8601..a4b5d0e0 100644 --- a/comedi/drivers/ni_pcimio.c +++ b/comedi/drivers/ni_pcimio.c @@ -310,7 +310,7 @@ static ni_board ni_boards[]={ ao_fifo_depth: 2048, caldac: type4, /* XXX */ }, - { device_id: 0x0000, /* unknown */ + { device_id: 0x14f0, /* unknown */ name: "pci-6111e", n_adchan: 2, adbits: 12, @@ -415,7 +415,7 @@ typedef struct{ #include "ni_mio_common.c" -static int pcimio_find_device(comedi_device *dev); +static int pcimio_find_device(comedi_device *dev,int bus,int slot); /* cleans up allocated resources */ @@ -452,7 +452,7 @@ static int pcimio_attach(comedi_device *dev,comedi_devconfig *it) ret=alloc_private(dev,sizeof(ni_private)); if(ret<0)return ret; - ret=pcimio_find_device(dev); + ret=pcimio_find_device(dev,it->options[0],it->options[1]); if(ret<0)return ret; printk(" %s",ni_boards[dev->board].name); @@ -475,13 +475,25 @@ static int pcimio_attach(comedi_device *dev,comedi_devconfig *it) } -static int pcimio_find_device(comedi_device *dev) +static int pcimio_find_device(comedi_device *dev,int bus,int slot) { struct mite_struct *mite; int i; for(mite=mite_devices;mite;mite=mite->next){ if(mite->used)continue; + if(bus || slot){ +#ifdef PCI_SUPPORT_VER1 + if(bus!=mite->pci_bus || + slot!=PCI_SLOT(mite->pci_device_fn)) + continue; +#else + if(bus!=mite->pcidev->bus->number<<8 || + slot!=PCI_SLOT(mite->pcidev->devfn)) + continue; +#endif + } + for(i=0;iboard=i;