Skip to contentSkip to conversation

PM / devfreq: Do not show statistics if it's not ready.

PATCH New MyungJoo Ham 1 participant 1 message Nov 23, 2015 Device frequency (devfreq)

lore
Share & tools
lore

MyungJoo Ham

author maintainer
#0 lore raw

PATCH 1/1 PM / devfreq: Do not show statistics if it's not ready.

Before this patch for a device without statistics support,

$ cat trans_stat
    From  :   To
          :   time(ms)
Total transitions : 0
$

After this patch applied for such a device,

$ cat trans_stat
Not Supported.
$
---
 drivers/devfreq/devfreq.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/devfreq/devfreq.c +2 -0
index fe3e3d1..1baa550 100644
@@ -1048,6 +1048,8 @@ static ssize_t trans_stat_show(struct device *dev,
 	if (!devfreq->stop_polling &&
 			devfreq_update_status(devfreq, devfreq->previous_freq))
 		return 0;
+	if (max_state == 0)
+		return sprintf(buf, "Not Supported.\n");
 
 	len = sprintf(buf, "     From  :   To\n");
 	len += sprintf(buf + len, "           :");
Signature · 1 line
1.9.1