aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/acpi_power_meter.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-12-07ACPI: Clean up inclusions of ACPI header filesLv Zheng1-2/+1
Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h> inclusions and remove some inclusions of those files that aren't necessary. First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h> should not be included directly from any files that are built for CONFIG_ACPI unset, because that generally leads to build warnings about undefined symbols in !CONFIG_ACPI builds. For CONFIG_ACPI set, <linux/acpi.h> includes those files and for CONFIG_ACPI unset it provides stub ACPI symbols to be used in that case. Second, there are ordering dependencies between those files that always have to be met. Namely, it is required that <acpi/acpi_bus.h> be included prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the latter depends on are always there. And <acpi/acpi.h> which provides basic ACPICA type declarations should always be included prior to any other ACPI headers in CONFIG_ACPI builds. That also is taken care of including <linux/acpi.h> as appropriate. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Matthew Garrett <mjg59@srcf.ucam.org> Cc: Tony Luck <tony.luck@intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff) Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff) Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-11-20hwmon: (acpi_power_meter) Fix acpi_bus_get_device() return value checkYijing Wang1-3/+2
Since acpi_bus_get_device() returns plain int and not acpi_status, ACPI_FAILURE() should not be used for checking its return value. Fix that. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13hwmon: (acpi_power_meter) Use return value from acpi_bus_register_driverGuenter Roeck1-1/+1
acpi_bus_register_driver() returns a valid error code. Use it. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-10-13hwmon: (acpi_power_meter) Don't crash the kernel unnecessarilyGuenter Roeck1-3/+8
acpi_power_meter crashes the kernel if it detects an unexpected event or an internal implementation error. While the detected conditions suggest that there is a bug in the code, the condition is not fatal. Replace BUG() with WARN(). Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-27hwmon: Change my email address.Darrick J. Wong1-2/+2
I've changed employers, so change the email addresses to match. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-01-26ACPI: Remove useless type argument of driver .remove() operationRafael J. Wysocki1-1/+1
The second argument of ACPI driver .remove() operation is only used by the ACPI processor driver and the value passed to that driver through it is always available from the given struct acpi_device object's removal_type field. For this reason, the second ACPI driver .remove() argument is in fact useless, so drop it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Jiang Liu <jiang.liu@huawei.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Acked-by: Yinghai Lu <yinghai@kernel.org>
2012-10-10hwmon: Add missing inclusions of <linux/err.h>Jean Delvare1-0/+1
These drivers use IS_ERR so they should include <linux/err.h>. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Luca Tettamanti <kronos.it@gmail.com> Cc: Henrik Rydberg <rydberg@euromail.se>
2012-07-27hwmon: (acpi_power_meter) Fix build warningGuenter Roeck1-0/+4
Commit c5dec0182256361a3f823316e8fb85263f76efe7 (acpi_power_meter: Use struct dev_pm_ops for power management) introduced the following build warning. It is seen if CONFIG_PM_SLEEP is not defined. acpi_power_meter.c:930:12: warning: acpi_power_meter_resume defined but not used Fix it. Cc: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-07-24Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-stagingLinus Torvalds1-5/+3
Pull hwmon updates from Guenter Roeck: "New drivers for DA9052/53 PMIC as well as HIH-6130/HIH-6131 humidity and temperature sensors. Convert drivers to use devm_ functions and to use dev_pm_ops. Address a couple of Coverity errors/warnings as well as compile warnings. Some functional improvements in applesmc driver." * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (72 commits) hwmon: (applesmc) Ignore some temperature registers hwmon: (applesmc) Allow negative temperature values hwmon: (s3c-hwmon) Use devm_kzalloc instead of kzalloc hwmon: (w83781d) Fix compile warning hwmon: (applesmc) Shorten minimum wait time hwmon: (exynos4_tmu) Use struct dev_pm_ops for power management hwmon: (gpio-fan) Use struct dev_pm_ops for power management hwmon: (abituguru3) Use struct dev_pm_ops for power management hwmon: (abituguru) Use struct dev_pm_ops for power management hwmon: (acpi_power_meter) Fix unintentional integer overflow hwmon: (acpi_power_meter) Cleanup and optimizations hwmon: Honeywell Humidicon HIH-6130/HIH-6131 humidity and temperature sensor driver hwmon: (applesmc) Skip sensor mapping hwmon: (ntc_thermistor) Ensure that data->name string is terminated hwmon: (w83l785ts) Convert to use devm_ functions hwmon: (w83l785ts) Simplify code and improve readability hwmon: (smsc47m192) Convert to use devm_ functions hwmon: (smsc47m1) Convert to use devm_ functions hwmon: (smsc47b397) Convert to use devm_ functions hwmon: (k8temp) Convert to use devm_ functions ...
2012-07-21hwmon: (acpi_power_meter) Fix unintentional integer overflowGuenter Roeck1-3/+1
Expression with two integer variables is calculated as integer before it is converted to u64. This may result in an integer overflow. Fix by declaring trip point variables as s64 instead of int. This patch addresses Coverity #200596: Unintentional integer overflow. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-07-21hwmon: (acpi_power_meter) Cleanup and optimizationsGuenter Roeck1-3/+3
An unsigned value can not be smaller than 0. Remove the check for it. Use DIV_ROUND_CLOSEST for divide operations converting milli-degrees C into degrees C. Limit maximum accepted trip point temperature to INT_MAX. This patch fixes Coverity #115214: Unsigned compared against 0 Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-07-01acpi_power_meter: Use struct dev_pm_ops for power managementRafael J. Wysocki1-4/+9
Make the ACPI power meter driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct acpi_device_ops. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2012-05-20acpi_power_meter: clean up code around setup_attrsKyle McMartin1-8/+7
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-20acpi_power_meter: drop meter_rw_attrs, use common meter_attrsKyle McMartin1-9/+2
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-20acpi_power_meter: remove duplicate code between register_{ro,rw}_attrsKyle McMartin1-42/+17
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-20acpi_power_meter: use a {RW,RO}_SENSOR_TEMPLATE macro to clean things upKyle McMartin1-93/+37
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-20acpi_power_meter: use the same struct {rw,ro}_sensor_template for bothKyle McMartin1-43/+110
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-04-09hwmon: (acpi_power_meter) Fix compiler warning seen in some configurationsGuenter Roeck1-0/+1
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-01hwmon: (acpi_power_meter) fix lockdep spew due to non-static lock classKyle McMartin1-0/+2
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-01-13module_param: make bool parameters really bool (drivers & misc)Rusty Russell1-1/+1
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-05hwmon: replaced strict_str* with kstr*Frans Meulenbroeks1-3/+3
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>
2011-05-25Move ACPI power meter driver to hwmonJean Delvare1-0/+1023
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>