[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1006708: hw-detect: Fails to reload iwlwifi module (modprobe: FATAL: Module iwlwifi is in use)



On 15/12/2023 at 20:27, Carsten Schoenert wrote:

https://salsa.debian.org/tijuca/hw-detect/-/commit/0e94654ca8ed0faa3790a52280342f388be3db9e

I think it would be better to add this stanza outside (before) the "for driver" loop. There are two cases, depending on the controller model:

1) iwlmvm is loaded

modprobe -r $module # fail because iwlwifi is used by iwlmvm
modprobe $module # no-op

for driver in $(find /sys/bus/*/drivers -name "$module"); do
	if [ "$module" == "iwlwifi" ]; then
		modprobe -r iwlmvm # ok, unloads iwlwifi too
		modprobe $module # reloads iwlwifi
	fi
	...

2) iwlmvm is not loaded

modprobe -r $module -> ok
modprobe $module -> ok

for driver in $(find /sys/bus/*/drivers -name "$module"); do
	if [ "$module" == "iwlwifi" ]; then
		modprobe -r iwlmvm # no-op
		modprobe $module # no-op
	fi
	...

It appears there are fail and/or no-op in both cases. This would be simpler:

if [ "$module" == "iwlwifi" ]; then
	modprobe -r iwlmvm # no-op if not loaded
fi
modprobe -r $module # no-op if unloaded with iwlmvm, but safe
modprobe $module

for driver in $(find /sys/bus/*/drivers -name "$module"); do
	...


Reply to: