函数源码 |
Source File:kernel\power\qos.c |
Create Date:2022-07-27 10:56:16 |
首页 | Copyright©Brick |
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | static int pm_qos_debug_show( struct seq_file *s, void *unused) { struct pm_qos_object *qos = ( struct pm_qos_object *)s-> private ; struct pm_qos_constraints *c; struct pm_qos_request *req; char *type; unsigned long flags; int tot_reqs = 0; int active_reqs = 0; if (IS_ERR_OR_NULL(qos)) { pr_err( "%s: bad qos param!\n" , __func__); return -EINVAL; } c = qos->constraints; if (IS_ERR_OR_NULL(c)) { pr_err( "%s: Bad constraints on qos?\n" , __func__); return -EINVAL; } /* Lock to ensure we have a snapshot */ spin_lock_irqsave(&pm_qos_lock, flags); if (plist_head_empty(&c->list)) { seq_puts(s, "Empty!\n" ); goto out; } switch (c->type) { case PM_QOS_MIN: type = "Minimum" ; break ; case PM_QOS_MAX: type = "Maximum" ; break ; case PM_QOS_SUM: type = "Sum" ; break ; default : type = "Unknown" ; } plist_for_each_entry(req, &c->list, node) { char *state = "Default" ; if ((req->node).prio != c->default_value) { active_reqs++; state = "Active" ; } tot_reqs++; seq_printf(s, "%d: %d: %s\n" , tot_reqs, (req->node).prio, state); } seq_printf(s, "Type=%s, Value=%d, Requests: active=%d / total=%d\n" , type, pm_qos_get_value(c), active_reqs, tot_reqs); out: spin_unlock_irqrestore(&pm_qos_lock, flags); return 0; } |