Re: [PATCH v2] xen/pcifront: move xenstore config scanning into sub-function

From: Jason Andryuk
Date: Thu Oct 06 2022 - 12:27:28 EST


On Thu, Oct 6, 2022 at 11:35 AM Juergen Gross <jgross@xxxxxxxx> wrote:
>
> 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
> kneon domain/bus combination anyway). In order to avoid duplicate

known

> messages for the fallback case move the check for domain/bus not knwon

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@xxxxxxxx>

Reviewed-by: Jason Andryuk <jandryuk@xxxxxxxxx>