2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 14:25:39 +00:00

Reindent sysfs helpers.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5444 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2008-11-27 18:10:24 +00:00
parent 3ee60a6fac
commit 88cab8add5

View File

@@ -2360,28 +2360,29 @@ sub unload_modules
#################
# From a sysfs device path, return the driver (module) name, or undef
sub sysfs_device_driver($)
sub sysfs_device_driver
{
my $device = shift;
my $device = shift;
my $link = readlink("$device/driver/module");
return unless defined $link;
return basename($link);
my $link = readlink("$device/driver/module");
return unless defined $link;
return basename($link);
}
# From a sysfs device path and an attribute name, return the attribute
# value, or undef
sub sysfs_device_attribute($$)
sub sysfs_device_attribute
{
my ($device, $attr) = @_;
my $value;
my ($device, $attr) = @_;
my $value;
open(local *FILE, "$device/$attr") or return;
return unless defined($value = <FILE>);
close(FILE);
open(local *FILE, "$device/$attr") or return;
$value = <FILE>;
close(FILE);
return unless defined $value;
chomp($value);
return $value;
chomp($value);
return $value;
}
##############