Lines Matching refs:iter
74 struct pci_device_iterator * iter;
80 iter = malloc( sizeof( *iter ) );
81 if ( iter != NULL ) {
82 iter->next_index = 0;
85 iter->mode = match_slot;
87 (void) memcpy( & iter->match.slot, match, sizeof( *match ) );
90 iter->mode = match_any;
94 return iter;
110 struct pci_device_iterator * iter;
116 iter = malloc( sizeof( *iter ) );
117 if ( iter != NULL ) {
118 iter->next_index = 0;
121 iter->mode = match_id;
123 (void) memcpy( & iter->match.id, match, sizeof( *match ) );
126 iter->mode = match_any;
130 return iter;
137 * \param iter Iterator to be destroyed.
142 pci_iterator_destroy( struct pci_device_iterator * iter )
144 if ( iter != NULL ) {
145 free( iter );
153 * \param iter Device iterator returned by \c pci_device_iterate.
160 pci_device_next( struct pci_device_iterator * iter )
164 if (!iter)
167 switch( iter->mode ) {
169 if ( iter->next_index < pci_sys->num_devices ) {
170 d = & pci_sys->devices[ iter->next_index ];
171 iter->next_index++;
177 while ( iter->next_index < pci_sys->num_devices ) {
179 & pci_sys->devices[ iter->next_index ];
181 iter->next_index++;
182 if ( PCI_ID_COMPARE( iter->match.slot.domain, temp->base.domain )
183 && PCI_ID_COMPARE( iter->match.slot.bus, temp->base.bus )
184 && PCI_ID_COMPARE( iter->match.slot.dev, temp->base.dev )
185 && PCI_ID_COMPARE( iter->match.slot.func, temp->base.func ) ) {
195 while ( iter->next_index < pci_sys->num_devices ) {
197 & pci_sys->devices[ iter->next_index ];
199 iter->next_index++;
200 if ( PCI_ID_COMPARE( iter->match.id.vendor_id, temp->base.vendor_id )
201 && PCI_ID_COMPARE( iter->match.id.device_id, temp->base.device_id )
202 && PCI_ID_COMPARE( iter->match.id.subvendor_id, temp->base.subvendor_id )
203 && PCI_ID_COMPARE( iter->match.id.subdevice_id, temp->base.subdevice_id )
204 && ((temp->base.device_class & iter->match.id.device_class_mask)
205 == iter->match.id.device_class) ) {
223 struct pci_device_iterator iter;
226 iter.next_index = 0;
227 iter.mode = match_slot;
228 iter.match.slot.domain = domain;
229 iter.match.slot.bus = bus;
230 iter.match.slot.dev = dev;
231 iter.match.slot.func = func;
233 return pci_device_next( & iter );