Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235155
b: refs/heads/master
c: f9b9e80
h: refs/heads/master
i:
  235153: a67d84c
  235151: 3f01e20
v: v3
  • Loading branch information
Thomas Renninger authored and Rafael J. Wysocki committed Mar 14, 2011
1 parent 49cdfd6 commit 6f4b320
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7ae496187876d264c712d7c102c45edb8eb41363
refs/heads/master: f9b9e806ae0ede772cbb9916d9ac7354a123d044
24 changes: 24 additions & 0 deletions trunk/kernel/pm_qos_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ static struct pm_qos_object *pm_qos_array[] = {

static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
size_t count, loff_t *f_pos);
static ssize_t pm_qos_power_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos);
static int pm_qos_power_open(struct inode *inode, struct file *filp);
static int pm_qos_power_release(struct inode *inode, struct file *filp);

static const struct file_operations pm_qos_power_fops = {
.write = pm_qos_power_write,
.read = pm_qos_power_read,
.open = pm_qos_power_open,
.release = pm_qos_power_release,
.llseek = noop_llseek,
Expand Down Expand Up @@ -376,6 +379,27 @@ static int pm_qos_power_release(struct inode *inode, struct file *filp)
}


static ssize_t pm_qos_power_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos)
{
s32 value;
unsigned long flags;
struct pm_qos_object *o;
struct pm_qos_request_list *pm_qos_req = filp->private_data;;

if (!pm_qos_req)
return -EINVAL;
if (!pm_qos_request_active(pm_qos_req))
return -EINVAL;

o = pm_qos_array[pm_qos_req->pm_qos_class];
spin_lock_irqsave(&pm_qos_lock, flags);
value = pm_qos_get_value(o);
spin_unlock_irqrestore(&pm_qos_lock, flags);

return simple_read_from_buffer(buf, count, f_pos, &value, sizeof(s32));
}

static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
size_t count, loff_t *f_pos)
{
Expand Down

0 comments on commit 6f4b320

Please sign in to comment.