setup.sh: try harder to find out if driver is loaded
Change-Id: I098285ff42271a7577a260cd864c015b235833b5 Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/443765 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447146 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
7eda85292a
commit
0168d9bc9d
@ -60,18 +60,19 @@ function usage()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# In monolithic kernels the lsmod won't work. So
|
# In monolithic kernels the lsmod won't work. So
|
||||||
# back that with a /sys/modules check. Return a different code for
|
# back that with a /sys/modules. We also check
|
||||||
# built-in vs module just in case we want that down the road.
|
# /sys/bus/pci/drivers/ as neither lsmod nor /sys/modules might
|
||||||
|
# contain needed info (like in Fedora-like OS).
|
||||||
function check_for_driver {
|
function check_for_driver {
|
||||||
$(lsmod | grep $1 > /dev/null)
|
if lsmod | grep -q ${1//-/_}; then
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
return 1
|
return 1
|
||||||
else
|
fi
|
||||||
if [[ -d /sys/module/$1 ]]; then
|
|
||||||
return 2
|
if [[ -d /sys/module/${1} || \
|
||||||
else
|
-d /sys/module/${1//-/_} || \
|
||||||
return 0
|
-d /sys/bus/pci/drivers/${1} || \
|
||||||
fi
|
-d /sys/bus/pci/drivers/${1//-/_} ]]; then
|
||||||
|
return 2
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user