File tree Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Expand file tree Collapse file tree 1 file changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,22 @@ static int p2sb_cache_resources(void)
172
172
return ret ;
173
173
}
174
174
175
+ static int p2sb_read_from_cache (struct pci_bus * bus , unsigned int devfn ,
176
+ struct resource * mem )
177
+ {
178
+ struct p2sb_res_cache * cache = & p2sb_resources [PCI_FUNC (devfn )];
179
+
180
+ if (cache -> bus_dev_id != bus -> dev .id )
181
+ return - ENODEV ;
182
+
183
+ if (!p2sb_valid_resource (& cache -> res ))
184
+ return - ENOENT ;
185
+
186
+ memcpy (mem , & cache -> res , sizeof (* mem ));
187
+
188
+ return 0 ;
189
+ }
190
+
175
191
/**
176
192
* p2sb_bar - Get Primary to Sideband (P2SB) bridge device BAR
177
193
* @bus: PCI bus to communicate with
@@ -188,24 +204,14 @@ static int p2sb_cache_resources(void)
188
204
*/
189
205
int p2sb_bar (struct pci_bus * bus , unsigned int devfn , struct resource * mem )
190
206
{
191
- struct p2sb_res_cache * cache ;
192
-
193
207
bus = p2sb_get_bus (bus );
194
208
if (!bus )
195
209
return - ENODEV ;
196
210
197
211
if (!devfn )
198
212
p2sb_get_devfn (& devfn );
199
213
200
- cache = & p2sb_resources [PCI_FUNC (devfn )];
201
- if (cache -> bus_dev_id != bus -> dev .id )
202
- return - ENODEV ;
203
-
204
- if (!p2sb_valid_resource (& cache -> res ))
205
- return - ENOENT ;
206
-
207
- memcpy (mem , & cache -> res , sizeof (* mem ));
208
- return 0 ;
214
+ return p2sb_read_from_cache (bus , devfn , mem );
209
215
}
210
216
EXPORT_SYMBOL_GPL (p2sb_bar );
211
217
You can’t perform that action at this time.
0 commit comments