summaryrefslogtreecommitdiff
path: root/lib/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/init.c')
-rw-r--r--lib/init.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/init.c b/lib/init.c
index 4d28a2e..ffb55e8 100644
--- a/lib/init.c
+++ b/lib/init.c
@@ -421,7 +421,7 @@ pci_alloc(void)
}
void
-pci_init_v35(struct pci_access *a)
+pci_init_internal(struct pci_access *a, int throw_errors, int skip_method)
{
if (!a->error)
a->error = pci_generic_error;
@@ -435,7 +435,11 @@ pci_init_v35(struct pci_access *a)
if (a->method)
{
if (a->method >= PCI_ACCESS_MAX || !pci_methods[a->method])
- a->error("This access method is not supported.");
+ {
+ if (throw_errors)
+ a->error("This access method is not supported.");
+ return;
+ }
a->methods = pci_methods[a->method];
}
else
@@ -446,6 +450,8 @@ pci_init_v35(struct pci_access *a)
struct pci_methods *m = pci_methods[probe_sequence[i]];
if (!m)
continue;
+ if (skip_method == probe_sequence[i])
+ continue;
a->debug("Trying method %s...", m->name);
if (m->detect(a))
{
@@ -457,12 +463,22 @@ pci_init_v35(struct pci_access *a)
a->debug("...No.\n");
}
if (!a->methods)
- a->error("Cannot find any working access method.");
+ {
+ if (throw_errors)
+ a->error("Cannot find any working access method.");
+ return;
+ }
}
a->debug("Decided to use %s\n", a->methods->name);
a->methods->init(a);
}
+void
+pci_init_v35(struct pci_access *a)
+{
+ pci_init_internal(a, 1, -1);
+}
+
STATIC_ALIAS(void pci_init(struct pci_access *a), pci_init_v35(a));
DEFINE_ALIAS(void pci_init_v30(struct pci_access *a), pci_init_v35);
SYMBOL_VERSION(pci_init_v30, pci_init@LIBPCI_3.0);