static ssize_t stage2_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { int id; int i, j; int count; char data_buf[1024] = ""; int len = 0; id = 2; count = 0; /* sscanf(attr->attr.name, "%d", &id); */ kstrtoint(attr->attr.name, 0, &id); /* =========================================================================// */ if (!sdio_host_debug) { len = print_autok(&p_autok_predata[id], (char *)buf); count += len; } else { len = snprintf(data_buf + count, 32, "\nDetail Information\n"); count += len; len = snprintf(data_buf + count, 32, "vol_count:%d\n", p_autok_predata[id].vol_count); count += len; len = snprintf(data_buf + count, 32, "param_count:%d\n", p_autok_predata[id].param_count); count += len; for (i = 0; i < p_autok_predata[id].vol_count; i++) { len = snprintf(data_buf + count, 32, "vol[%d]:%d\n", i, p_autok_predata[id].vol_list[i]); count += len; } /* goto EXIT_STAGE2; */ for (i = 0; i < p_autok_predata[id].vol_count; i++) { for (j = 0; j < p_autok_predata[id].param_count; j++) { len = snprintf(data_buf + count, 32, "param[%d][%d]:%d\n", i, j, p_autok_predata[id].ai_data[i][j].data.sel); count += len; } } len = snprintf(buf, 1024, "%s\n", data_buf); } return len; }
static ssize_t stage1_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { char cur_name[DEVNAME_SIZE]=""; char data_buf[1024]=""; int test_len, cur_len; int i, j; int id; int len, count = 0; int select; struct msdc_host *host; //char *p_log; //id = 3; sscanf(kobj->name, "%d", &id); if (id >= HOST_MAX_NUM) { printk("[%s] id<%d> is bigger than HOST_MAX_NUM<%d>\n", __func__, id, HOST_MAX_NUM); return count; } host = mtk_msdc_host[id]; sscanf(attr->attr.name, "%s", cur_name); select = 0; for(i=0; i<TOTAL_STAGE1_NODE_COUNT; i++){ test_len = strlen(stage1_nodes[i]); cur_len = strlen(cur_name); if((test_len==cur_len) && (strncmp(stage1_nodes[i], cur_name, cur_len)==0)){ select = i; break; } } len = 0; count = 0; switch(select){ case VOLTAGE: len = snprintf(buf, 32, "%d\n", cur_voltage[id]); break; case PARAMS: if(!sdio_host_debug){ len = print_autok(&p_single_autok[id], (char*)buf); }else{ len = snprintf(data_buf + count, 32, "\nDetail Information\n"); count += len; len = snprintf(data_buf + count, 32, "vol_count:%d\n", p_single_autok[id].vol_count); count += len; len = snprintf(data_buf + count, 32, "param_count:%d\n", p_single_autok[id].param_count); count += len; for(i = 0; i<p_single_autok[id].vol_count; i++){ len = snprintf(data_buf + count, 32, "vol[%d]:%d\n", i, p_single_autok[id].vol_list[i]); count += len; } //goto EXIT_STAGE2; for(i = 0; i<p_single_autok[id].vol_count; i++){ for(j=0; j<p_single_autok[id].param_count; j++){ len = snprintf(data_buf + count, 32, "param[%d][%d]:%d\n", i, j, p_single_autok[id].ai_data[i][j].data.sel); count += len; } } len = snprintf(buf, 1024, "%s\n", data_buf); } break; case DONE: len = snprintf(buf, 32, "%d\n", p_autok_thread_data->is_autok_done[id]); break; case LOG: //if(autok_log_info != NULL) len = snprintf(buf, 32, "%d", is_full_log); break; } return len; }