示例#1
0
static ssize_t state_onchg_show(struct kobject *kobj, struct kobj_attribute *attr,
			     char *buf)
{
	char *s = buf;
	if (get_onchg_state())
		s += sprintf(s, "chgoff ");
	else
		s += sprintf(s, "chgon ");

	if (s != buf)
		
		*(s-1) = '\n';

	return (s - buf);
}
示例#2
0
static ssize_t state_onchg_show(struct kobject *kobj, struct kobj_attribute *attr,
			     char *buf)
{
	char *s = buf;
	if (get_onchg_state())
		s += sprintf(s, "chgoff ");
	else
		s += sprintf(s, "chgon ");

	if (s != buf)
		/* convert the last space to a newline */
		*(s-1) = '\n';

	return (s - buf);
}