Commit Graph

10 Commits

Author SHA1 Message Date
Kyle McMartin 7bb5ee0169 acpi_power_meter: clean up code around setup_attrs
We don't need to duplicate if (res) checks if we're always running
one or the other.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-05-20 19:41:49 -07:00
Kyle McMartin 9fe789f88a acpi_power_meter: drop meter_rw_attrs, use common meter_attrs
We always register these two together, so move meter_rw_attrs into
meter_ro_attrs and use the same for both since we no longer have two
register_attr paths.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-05-20 19:41:49 -07:00
Kyle McMartin f49d6a7ed2 acpi_power_meter: remove duplicate code between register_{ro,rw}_attrs
Key off the attr->set method being present to set the sysfs attribute
as writable.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-05-20 19:41:48 -07:00
Kyle McMartin 3c45f2c78d acpi_power_meter: use a {RW,RO}_SENSOR_TEMPLATE macro to clean things up
Similar to how we do PCI/USB device id structs.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-05-20 19:41:48 -07:00
Kyle McMartin 81194cd240 acpi_power_meter: use the same struct {rw,ro}_sensor_template for both
We don't need both, when we can just key the read/write off of the
presence of the .set member.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-05-20 19:41:48 -07:00
Guenter Roeck 776cdc11b3 hwmon: (acpi_power_meter) Fix compiler warning seen in some configurations
In some configurations, BUG() does not result in an endless loop but returns
to the caller. This results in the following compiler warning:

drivers/hwmon/acpi_power_meter.c: In function 'show_str':
drivers/hwmon/acpi_power_meter.c:380: warning: 'val' may be used uninitialized in this function

Fix the warning by setting val to an empty string after BUG().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-04-09 12:17:37 -07:00
Kyle McMartin 31e354ee65 hwmon: (acpi_power_meter) fix lockdep spew due to non-static lock class
Similar to a30dcb4f which fixed asus_atk0110.ko, I recently received a
bug report from someone hitting the same issue in acpi_power_meter.

[   13.963168] power_meter ACPI000D:00: Found ACPI power meter.
[   13.963900] BUG: key ffff8802161f3920 not in .data!
[   13.963904] ------------[ cut here ]------------
[   13.963915] WARNING: at kernel/lockdep.c:2986
	lockdep_init_map+0x52f/0x560()

So let's fix that up for them by statically declaring the
lockdep_class_key.

Signed-off-by: Kyle McMartin <kyle@redhat.com>
Cc: stable@vger.kernel.org # 3.0+
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-04-01 10:24:36 -07:00
Rusty Russell 90ab5ee941 module_param: make bool parameters really bool (drivers & misc)
module_param(bool) used to counter-intuitively take an int.  In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option.  For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-13 09:32:20 +10:30
Frans Meulenbroeks 179c4fdb56 hwmon: replaced strict_str* with kstr*
replaced strict_strtol with kstrtol and
replaced strict_strtuol with kstrtuol

This satisfies checkpatch -f
Compile tested only: no warnings or errors given

Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2012-01-05 08:19:34 -08:00
Jean Delvare 7d03336538 Move ACPI power meter driver to hwmon
As discussed earlier, the ACPI power meter driver would better live
in drivers/hwmon, as its only purpose is to create hwmon-style
interfaces for ACPI 4.0 power meter devices. Users are more likely to
look for it there, and less likely to accidentally hide it by
unselecting its dependencies.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: "Darrick J. Wong" <djwong@us.ibm.com>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Len Brown <lenb@kernel.org>
2011-05-25 20:43:32 +02:00