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 _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm