Lines Matching +full:group +full:- +full:index +full:- +full:shift

1 // SPDX-License-Identifier: GPL-2.0
7 * This code is based on kobject-example.c, which came with linux 2.6.x.
9 * Copyright (C) 2004-2007 Greg Kroah-Hartman <greg@kroah.com>
44 if (strcmp("characters", attr->attr.name) == 0) { in chars_chartab_show()
71 bufsize -= len; in chars_chartab_show()
75 return buf_pointer - buf; in chars_chartab_show()
99 snprintf(buf + (len - 1), sizeof(buf) - (len - 1), in report_char_chartab_status()
122 unsigned long index = 0; in chars_chartab_store() local
128 int do_characters = !strcmp(attr->attr.name, "characters"); in chars_chartab_store()
161 index = simple_strtoul(cp, &temp, 10); in chars_chartab_store()
162 if (index > 255) { in chars_chartab_store()
171 desc_length = linefeed - temp; in chars_chartab_store()
180 retval = -ENOMEM; in chars_chartab_store()
194 if (spk_characters[index] != spk_default_chars[index]) in chars_chartab_store()
195 kfree(spk_characters[index]); in chars_chartab_store()
196 spk_characters[index] = desc; in chars_chartab_store()
205 if (charclass != spk_chartab[index]) { in chars_chartab_store()
206 spk_chartab[index] = charclass; in chars_chartab_store()
246 cp1 += 2; /* now pointing at shift states */ in keymap_show()
247 /* dump num_keys+1 as first row is shift states + flags, in keymap_show()
259 return (int)(cp - buf); in keymap_show()
279 return -ENOMEM; in keymap_store()
288 if (in_buff[count - 1] == '\n') in keymap_store()
289 in_buff[count - 1] = '\0'; in keymap_store()
296 i = (int)cp1[-2] + 1; in keymap_store()
297 i *= (int)cp1[-1] + 1; in keymap_store()
299 if (cp1[-3] != KEY_MAP_VER || cp1[-1] > 10 || in keymap_store()
302 (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]); in keymap_store()
305 return -EINVAL; in keymap_store()
307 while (--i >= 0) { in keymap_store()
313 if (i != 0 || cp1[-1] != KEY_MAP_VER || cp1[-2] != 0) { in keymap_store()
314 ret = -EINVAL; in keymap_store()
316 (int)cp1[-3], (int)cp1[-2], (int)cp1[-1]); in keymap_store()
320 ret = -EINVAL; in keymap_store()
349 return -EINVAL; in silent_store()
379 rv = sprintf(buf, "%s\n", synth->name); in synth_show()
394 return -EINVAL; in synth_store()
396 if (new_synth_name[len - 1] == '\n') in synth_store()
397 len--; in synth_store()
400 if (synth && !strcmp(new_synth_name, synth->name)) { in synth_store()
404 return -ENODEV; in synth_store()
420 return -EPERM; in synth_direct_store()
424 return -ENOMEM; in synth_direct_store()
449 synth->name, synth->version); in version_show()
450 return cp - buf; in version_show()
467 p_header = spk_var_header_by_name(attr->attr.name); in punc_show()
469 pr_warn("p_header is null, attr->attr.name is %s\n", in punc_show()
470 attr->attr.name); in punc_show()
471 return -EINVAL; in punc_show()
474 var = spk_get_punc_var(p_header->var_id); in punc_show()
476 pr_warn("var is null, p_header->var_id is %i\n", in punc_show()
477 p_header->var_id); in punc_show()
478 return -EINVAL; in punc_show()
482 pb = (struct st_bits_data *)&spk_punc_info[var->value]; in punc_show()
483 mask = pb->mask; in punc_show()
490 return cp - buf; in punc_show()
507 return -EINVAL; in punc_store()
509 p_header = spk_var_header_by_name(attr->attr.name); in punc_store()
511 pr_warn("p_header is null, attr->attr.name is %s\n", in punc_store()
512 attr->attr.name); in punc_store()
513 return -EINVAL; in punc_store()
516 var = spk_get_punc_var(p_header->var_id); in punc_store()
518 pr_warn("var is null, p_header->var_id is %i\n", in punc_store()
519 p_header->var_id); in punc_store()
520 return -EINVAL; in punc_store()
525 while (x && punc_buf[x - 1] == '\n') in punc_store()
526 x--; in punc_store()
532 x = spk_set_mask_bits(NULL, var->value, 3); in punc_store()
534 x = spk_set_mask_bits(punc_buf, var->value, 3); in punc_store()
554 param = spk_var_header_by_name(attr->attr.name); in spk_var_show()
556 return -EINVAL; in spk_var_show()
559 var = (struct var_t *)param->data; in spk_var_show()
560 switch (param->var_type) { in spk_var_show()
564 rv = sprintf(buf, "%i\n", var->u.n.value); in spk_var_show()
572 for (cp = (char *)param->p_val; (ch = *cp); cp++) { in spk_var_show()
581 rv = cp1 - buf; in spk_var_show()
588 param->name, param->var_type); in spk_var_show()
610 pr_info("%s reset to default value\n", param->name); in spk_reset_default_value()
630 param = spk_var_header_by_name(attr->attr.name); in spk_var_store()
632 return -EINVAL; in spk_var_store()
633 if (!param->data) in spk_var_store()
640 switch (param->var_type) { in spk_var_store()
645 else if (*cp == '+' || *cp == '-') in spk_var_store()
653 if (ret == -ERANGE) { in spk_var_store()
654 var_data = param->data; in spk_var_store()
656 param->name, in spk_var_store()
657 var_data->u.n.low, var_data->u.n.high); in spk_var_store()
664 if (param->var_id == VOICE && synth && in spk_var_store()
665 (ret == 0 || ret == -ERESTART)) { in spk_var_store()
666 var_data = param->data; in spk_var_store()
667 value = var_data->u.n.value; in spk_var_store()
668 spk_reset_default_value("pitch", synth->default_pitch, in spk_var_store()
670 spk_reset_default_value("vol", synth->default_vol, in spk_var_store()
676 if ((len >= 1) && (cp[len - 1] == '\n')) in spk_var_store()
677 --len; in spk_var_store()
678 if ((len >= 2) && (cp[0] == '"') && (cp[len - 1] == '"')) { in spk_var_store()
680 len -= 2; in spk_var_store()
684 if (ret == -E2BIG) in spk_var_store()
686 param->name); in spk_var_store()
690 param->name, (int)param->var_type); in spk_var_store()
695 if (ret == -ERESTART) in spk_var_store()
696 pr_info("%s reset to default value\n", param->name); in spk_var_store()
712 int index = 0; in message_show_helper() local
715 for (cursor = first; cursor <= last; cursor++, index++) { in message_show_helper()
719 index, spk_msg_get(cursor)); in message_show_helper()
721 bufsize -= printed; in message_show_helper()
724 return buf_pointer - buf; in message_show_helper()
734 pr_info("i18n messages from group %s reset to defaults\n", in report_msg_status()
738 " updated %d of %d i18n messages from group %s\n", in report_msg_status()
741 snprintf(buf + (len - 1), sizeof(buf) - (len - 1), in report_msg_status()
749 struct msg_group_t *group) in message_store_helper() argument
758 unsigned long index = 0; in message_store_helper() local
763 enum msg_index_t firstmessage = group->start; in message_store_helper()
764 enum msg_index_t lastmessage = group->end; in message_store_helper()
795 index = simple_strtoul(cp, &temp, 10); in message_store_helper()
800 desc_length = linefeed - temp; in message_store_helper()
801 curmessage = firstmessage + index; in message_store_helper()
805 * redundant. Suppose that the user gave us an index in message_store_helper()
806 * equal to ULONG_MAX - 1. If firstmessage > 1, then in message_store_helper()
807 * firstmessage + index < firstmessage! in message_store_helper()
819 if (msg_stored == -ENOMEM) in message_store_helper()
830 spk_reset_msg_group(group); in message_store_helper()
832 report_msg_status(reset, received, used, rejected, group->name); in message_store_helper()
840 struct msg_group_t *group = spk_find_msg_group(attr->attr.name); in message_show() local
843 if (WARN_ON(!group)) in message_show()
844 return -EINVAL; in message_show()
847 retval = message_show_helper(buf, group->start, group->end); in message_show()
855 struct msg_group_t *group = spk_find_msg_group(attr->attr.name); in message_store() local
857 if (WARN_ON(!group)) in message_store()
858 return -EINVAL; in message_store()
860 return message_store_helper(buf, count, group); in message_store()
987 * An unnamed attribute group will put all of the attributes directly in
990 * attribute group.
1019 retval = -ENOMEM; in speakup_kobj_init()
1025 retval = -ENOMEM; in speakup_kobj_init()