From: Greg KH <gregkh@suse.de>
To: "Liu, ShuoX" <shuox.liu@intel.com>
Cc: "Brown, Len" <len.brown@intel.com>,
"linux-pm@lists.linux-foundation.org"
<linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] PM: add statistics sysfs file for suspend to ram
Date: Wed, 3 Aug 2011 22:17:45 -0700 [thread overview]
Message-ID: <20110804051745.GB12336@suse.de> (raw)
In-Reply-To: <6E3BC7F7C9A4BF4286DD4C043110F30B5B790E573B@shsmsx502.ccr.corp.intel.com>
On Thu, Aug 04, 2011 at 01:09:51PM +0800, Liu, ShuoX wrote:
> +static ssize_t suspend_stats_show(struct kobject *kobj,
> + struct kobj_attribute *attr, char *buf)
> +{
> + int i, index, last_index;
> + char *s = buf;
> +
> + last_index = suspend_stats.last_failed + REC_FAILED_DEV_NUM - 1;
> + last_index %= REC_FAILED_DEV_NUM;
> + s += sprintf(s, "%s: %d\n%s: %d\n%s: %d\n%s: %d\n"
> + "%s: %d\n%s: %d\n%s: %d\n%s: %d\n",
> + "success", suspend_stats.success,
> + "fail", suspend_stats.fail,
> + "failed_freeze", suspend_stats.failed_freeze,
> + "failed_prepare", suspend_stats.failed_prepare,
> + "failed_suspend", suspend_stats.failed_suspend,
> + "failed_suspend_noirq",
> + suspend_stats.failed_suspend_noirq,
> + "failed_resume", suspend_stats.failed_resume,
> + "failed_resume_noirq",
> + suspend_stats.failed_resume_noirq);
> + s += sprintf(s, "failed_devs:\n last_failed:\t%s\n",
> + suspend_stats.failed_devs[last_index]);
> + for (i = 1; i < REC_FAILED_DEV_NUM; i++) {
> + index = last_index + REC_FAILED_DEV_NUM - i;
> + index %= REC_FAILED_DEV_NUM;
> + s += sprintf(s, "\t\t%s\n",
> + suspend_stats.failed_devs[index]);
> + }
And, to top it all of, this is NOT allowed in sysfs at all.
Remember, sysfs is one text field per file. Not something huge like
this.
Perhaps you should use debugfs instead?
thanks,
greg k-h
next prev parent reply other threads:[~2011-08-04 5:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-04 5:09 [PATCH] PM: add statistics sysfs file for suspend to ram Liu, ShuoX
2011-08-04 5:16 ` Greg KH
2011-08-04 5:17 ` Greg KH [this message]
2011-08-03 17:37 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2011-08-04 5:13 Liu, ShuoX
2011-08-04 5:27 ` Greg KH
2011-08-04 9:32 ` Rafael J. Wysocki
2011-08-05 1:57 ` Liu, ShuoX
2011-08-05 3:19 ` Yanmin Zhang
2011-08-05 19:20 ` Rafael J. Wysocki
2011-08-08 3:48 ` Yanmin Zhang
2011-08-08 20:37 ` Rafael J. Wysocki
2011-08-08 21:01 ` Greg KH
2011-08-08 21:05 ` Pavel Machek
2011-08-08 21:14 ` Rafael J. Wysocki
2011-08-08 21:54 ` Pavel Machek
2011-08-08 22:09 ` Rafael J. Wysocki
2011-08-10 22:27 ` Pavel Machek
2011-08-11 19:48 ` Rafael J. Wysocki
2011-08-04 19:05 ` Len Brown
2011-08-04 19:17 ` Randy Dunlap
2011-08-04 19:50 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110804051745.GB12336@suse.de \
--to=gregkh@suse.de \
--cc=len.brown@intel.com \
--cc=linux-pm@lists.linux-foundation.org \
--cc=shuox.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.