usb: small style/code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-11-10 17:02:24 +01:00
parent e68881e4a3
commit 342f049352

View File

@ -107,10 +107,7 @@ sub get_usb_devices {
my $d = eval { PVE::JSONSchema::parse_property_string($format,$conf->{$devname}) }; my $d = eval { PVE::JSONSchema::parse_property_string($format,$conf->{$devname}) };
next if !$d; next if !$d;
my $port; my $port = $use_qemu_xhci ? $i + 1 : undef;
if ($use_qemu_xhci) {
$port = $i + 1;
}
if (defined($d->{host})) { if (defined($d->{host})) {
my $hostdevice = parse_usb_device($d->{host}); my $hostdevice = parse_usb_device($d->{host});
@ -154,7 +151,7 @@ sub print_usbdevice_full {
my $usbdevice = "usb-host"; my $usbdevice = "usb-host";
# if it is a usb3 device or with newer qemu, attach it to the xhci controller, else omit the bus option # if it is a usb3 device or with newer qemu, attach it to the xhci controller, else omit the bus option
if($device->{usb3} || defined($port)) { if ($device->{usb3} || defined($port)) {
$usbdevice .= ",bus=xhci.0"; $usbdevice .= ",bus=xhci.0";
$usbdevice .= ",port=$port" if defined($port); $usbdevice .= ",port=$port" if defined($port);
} }