From 68d10b01ba09dbdb23e27d5c015349340f1b0935 Mon Sep 17 00:00:00 2001 From: Pawel Wodkowski Date: Thu, 31 Jan 2019 15:11:36 +0100 Subject: [PATCH] setup.sh: remove usless '= "0"' part from if statements Bash interprets everything after command as additional function arguments. To not confuse user just remove this part and replace by '!'. Change-Id: I44228003a1f96324271e726df4f5033f3258523c Signed-off-by: Pawel Wodkowski Reviewed-on: https://review.gerrithub.io/c/442976 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448422 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Tested-by: Darek Stojaczyk --- scripts/setup.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index d70c9230b..7f4814e08 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -75,16 +75,15 @@ function check_for_driver { function pci_can_bind() { if [[ ${#PCI_WHITELIST[@]} == 0 ]]; then #no whitelist specified, bind all devices - return 1 + return 0 fi - for i in ${PCI_WHITELIST[@]} - do + for i in ${PCI_WHITELIST[@]}; do if [ "$i" == "$1" ] ; then - return 1 + return 0 fi done - return 0 + return 1 } function linux_bind_driver() { @@ -182,7 +181,7 @@ function configure_linux_pci { for bdf in $(iter_pci_class_code 01 08 02); do blkname='' get_nvme_name_from_bdf "$bdf" blkname - if pci_can_bind $bdf == "0" ; then + if ! pci_can_bind $bdf; then echo "Skipping un-whitelisted NVMe controller $blkname ($bdf)" continue fi @@ -206,7 +205,7 @@ function configure_linux_pci { for dev_id in `cat $TMP`; do for bdf in $(iter_pci_dev_id 8086 $dev_id); do - if pci_can_bind $bdf == "0" ; then + if ! pci_can_bind $bdf; then echo "Skipping un-whitelisted I/OAT device at $bdf" continue fi @@ -224,7 +223,7 @@ function configure_linux_pci { for dev_id in `cat $TMP`; do for bdf in $(iter_pci_dev_id 1af4 $dev_id); do - if pci_can_bind $bdf == "0" ; then + if ! pci_can_bind $bdf; then echo "Skipping un-whitelisted Virtio device at $bdf" continue fi @@ -362,7 +361,7 @@ function reset_linux_pci { driver_loaded=$? set -e for bdf in $(iter_pci_class_code 01 08 02); do - if pci_can_bind $bdf == "0" ; then + if ! pci_can_bind $bdf; then echo "Skipping un-whitelisted NVMe controller $blkname ($bdf)" continue fi @@ -385,7 +384,7 @@ function reset_linux_pci { set -e for dev_id in `cat $TMP`; do for bdf in $(iter_pci_dev_id 8086 $dev_id); do - if pci_can_bind $bdf == "0" ; then + if ! pci_can_bind $bdf; then echo "Skipping un-whitelisted I/OAT device at $bdf" continue fi @@ -411,7 +410,7 @@ function reset_linux_pci { modprobe virtio-pci || true for dev_id in `cat $TMP`; do for bdf in $(iter_pci_dev_id 1af4 $dev_id); do - if pci_can_bind $bdf == "0" ; then + if ! pci_can_bind $bdf; then echo "Skipping un-whitelisted Virtio device at $bdf" continue fi