xen/pcifront: move xenstore config scanning into sub-function
authorJuergen Gross <jgross@suse.com>
Thu, 6 Oct 2022 08:50:28 +0000 (10:50 +0200)
committerJuergen Gross <jgross@suse.com>
Fri, 7 Oct 2022 05:36:44 +0000 (07:36 +0200)
commit2849752f36848359034616eb70dfc7fb14eb3cd4
tree3cc37f6738390fb96bf5eee88db81cf01d6be99e
parent5c13a4a0291b30191eff9ead8d010e1ca43a4d0c
xen/pcifront: move xenstore config scanning into sub-function

pcifront_try_connect() and pcifront_attach_devices() share a large
chunk of duplicated code for reading the config information from
Xenstore, which only differs regarding calling pcifront_rescan_root()
or pcifront_scan_root().

Put that code into a new sub-function. It is fine to always call
pcifront_rescan_root() from that common function, as it will fallback
to pcifront_scan_root() if the domain/bus combination isn't known
yet (and pcifront_scan_root() should never be called for an already
known domain/bus combination anyway). In order to avoid duplicate
messages for the fallback case move the check for domain/bus not known
to the beginning of pcifront_rescan_root().

While at it fix the error reporting in case the root-xx node had the
wrong format.

As the return value of pcifront_try_connect() and
pcifront_attach_devices() are not used anywhere make those functions
return void. As an additional bonus this removes the dubious return
of -EFAULT in case of an unexpected driver state.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jandryuk@gmail.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
drivers/pci/xen-pcifront.c