lkml.org 
[lkml]   [2018]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] PM / wakeup: use seq_open() to show wakeup stats
On Mon, Mar 5, 2018 at 10:47 AM, Ganesh Mahendran
<opensource.ganesh@gmail.com> wrote:
> single_open() interface requires that the whole output must
> fit into a single buffer. This will lead to timeout when
> system memory is not in a good situation.
>
> This patch use seq_open() to show wakeup stats. This method
> need only one page, so timeout will not be observed.

> + if (n == 0) {
> + seq_puts(m, "name\t\tactive_count\tevent_count\twakeup_count\t"
> + "expire_count\tactive_since\ttotal_time\tmax_time\t"
> + "last_change\tprevent_suspend_time\n");
> + }

Can't you do this once at ->open() stage, for example?

> static int wakeup_sources_stats_open(struct inode *inode, struct file *file)
> {
> - return single_open(file, wakeup_sources_stats_show, NULL);
> + return seq_open_private(file, &wakeup_sources_stats_seq_ops, sizeof(int));
> }

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2018-03-13 17:40    [W:2.035 / U:3.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site