2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 22:35:23 +00:00

If a driver is built into the kernel, it doesn't show up in

/proc/modules so we will try to load it, even though it's already
available. It will succeed, however later attempts to remove the
driver will fail and such failures are reported at the end of the
script, which can be confusing.

So, use /sys/module instead of /proc/modules where available, as
built-in drivers are listed there too so we no longer attempt to load
already available drivers. As a consequence we also no longer attempt
to remove the drivers in question, thus clearing the error message.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6114 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2013-01-16 17:33:38 +00:00
parent 1971bc6ff1
commit 319f9b8f68
2 changed files with 12 additions and 1 deletions

View File

@@ -2773,9 +2773,19 @@ sub initialize_modules_list
{
local $_;
# /sys/module contains built-in drivers too, but doesn't exist on
# older kernels (added in kernel 2.6.7)
if (opendir(local *MODULES, "$sysfs_root/module")) {
while (defined($_ = readdir(MODULES))) {
next if m/^\./;
$modules_list{$1} = 1 if m/^(\S*)/;
}
return;
}
# Fall back to /proc/modules as it is always available
open(local *INPUTFILE, "/proc/modules") or return;
while (<INPUTFILE>) {
tr/-/_/; # Probably not needed
$modules_list{$1} = 1 if m/^(\S*)/;
}
}