usertools: fix device binding module detection
authorPavan Nikhilesh <pbhagavatula@marvell.com>
Sat, 2 Nov 2019 14:23:15 +0000 (19:53 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 26 Nov 2019 23:00:24 +0000 (00:00 +0100)
commit4362312431b599bbfd8e384573fdb9d6099cd836
treeca4b1b192f7ed0bf8779e768317c85362901d8bc
parent1e3acc6f70991472d1daacfc80cb497c4ab121ca
usertools: fix device binding module detection

Some kernel modules use '-' in their name when registering through
`pci_register_driver` and the same name  is populated in
'/sys/bus/pci/drivers/'.
But the kernel always populates modules names replacing '-' with '_'
in '/sys/module/'.

Example:
# ./usertools/dpdk-devbind.py -b octeontx2-nicpf 0002:03:00.0
Error: Driver 'octeontx2-nicpf' is not loaded.

# ls /sys/bus/pci/drivers/octeontx2-nicpf
bind  module  new_id  remove_id  uevent  unbind
# ls /sys/module/octeontx2_nicpf/
drivers  uevent  version

The patch addresses it by always replacing '-' with '_' when looking in
'/sys/module/'

Signed-off-by: Phanendra Vukkisala <pvukkisala@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
usertools/dpdk-devbind.py