projects
/
linux-2.6-microblaze.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux
[linux-2.6-microblaze.git]
/
drivers
/
hwmon
/
acpi_power_meter.c
diff --git
a/drivers/hwmon/acpi_power_meter.c
b/drivers/hwmon/acpi_power_meter.c
index
34ad5a2
..
563c029
100644
(file)
--- a/
drivers/hwmon/acpi_power_meter.c
+++ b/
drivers/hwmon/acpi_power_meter.c
@@
-101,7
+101,7
@@
struct acpi_power_meter_resource {
unsigned long sensors_last_updated;
struct sensor_device_attribute sensors[NUM_SENSORS];
int num_sensors;
unsigned long sensors_last_updated;
struct sensor_device_attribute sensors[NUM_SENSORS];
int num_sensors;
-
int
trip[2];
+
s64
trip[2];
int num_domain_devices;
struct acpi_device **domain_devices;
struct kobject *holders_dir;
int num_domain_devices;
struct acpi_device **domain_devices;
struct kobject *holders_dir;
@@
-237,7
+237,7
@@
static ssize_t set_cap(struct device *dev, struct device_attribute *devattr,
if (res)
return res;
if (res)
return res;
- temp
/= 1000
;
+ temp
= DIV_ROUND_CLOSEST(temp, 1000)
;
if (temp > resource->caps.max_cap || temp < resource->caps.min_cap)
return -EINVAL;
arg0.integer.value = temp;
if (temp > resource->caps.max_cap || temp < resource->caps.min_cap)
return -EINVAL;
arg0.integer.value = temp;
@@
-307,9
+307,7
@@
static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
if (res)
return res;
if (res)
return res;
- temp /= 1000;
- if (temp < 0)
- return -EINVAL;
+ temp = DIV_ROUND_CLOSEST(temp, 1000);
mutex_lock(&resource->lock);
resource->trip[attr->index - 7] = temp;
mutex_lock(&resource->lock);
resource->trip[attr->index - 7] = temp;
@@
-929,20
+927,25
@@
static int acpi_power_meter_remove(struct acpi_device *device, int type)
return 0;
}
return 0;
}
-static int acpi_power_meter_resume(struct
acpi_device *device
)
+static int acpi_power_meter_resume(struct
device *dev
)
{
struct acpi_power_meter_resource *resource;
{
struct acpi_power_meter_resource *resource;
- if (!device || !acpi_driver_data(device))
+ if (!dev)
+ return -EINVAL;
+
+ resource = acpi_driver_data(to_acpi_device(dev));
+ if (!resource)
return -EINVAL;
return -EINVAL;
- resource = acpi_driver_data(device);
free_capabilities(resource);
read_capabilities(resource);
return 0;
}
free_capabilities(resource);
read_capabilities(resource);
return 0;
}
+static SIMPLE_DEV_PM_OPS(acpi_power_meter_pm, NULL, acpi_power_meter_resume);
+
static struct acpi_driver acpi_power_meter_driver = {
.name = "power_meter",
.class = ACPI_POWER_METER_CLASS,
static struct acpi_driver acpi_power_meter_driver = {
.name = "power_meter",
.class = ACPI_POWER_METER_CLASS,
@@
-950,9
+953,9
@@
static struct acpi_driver acpi_power_meter_driver = {
.ops = {
.add = acpi_power_meter_add,
.remove = acpi_power_meter_remove,
.ops = {
.add = acpi_power_meter_add,
.remove = acpi_power_meter_remove,
- .resume = acpi_power_meter_resume,
.notify = acpi_power_meter_notify,
},
.notify = acpi_power_meter_notify,
},
+ .drv.pm = &acpi_power_meter_pm,
};
/* Module init/exit routines */
};
/* Module init/exit routines */