* @cas_count_cfg: Config
* @count: iMC number
*/
-static void get_read_event_and_umask(char *cas_count_cfg, int count)
+static void get_read_event_and_umask(char *cas_count_cfg, unsigned int count)
{
char *token[MAX_TOKENS];
int i = 0;
}
/* Get type and config of an iMC counter's read event. */
-static int read_from_imc_dir(char *imc_dir, int count)
+static int read_from_imc_dir(char *imc_dir, unsigned int *count)
{
char cas_count_cfg[1024], imc_counter_cfg[1024], imc_counter_type[1024];
FILE *fp;
return -1;
}
- if (fscanf(fp, "%u", &imc_counters_config[count].type) <= 0) {
+ if (fscanf(fp, "%u", &imc_counters_config[*count].type) <= 0) {
ksft_perror("Could not get iMC type");
fclose(fp);
}
fclose(fp);
- get_read_event_and_umask(cas_count_cfg, count);
+ get_read_event_and_umask(cas_count_cfg, *count);
+ *count += 1;
return 0;
}
if (temp[0] >= '0' && temp[0] <= '9') {
sprintf(imc_dir, "%s/%s/", DYN_PMU_PATH,
ep->d_name);
- ret = read_from_imc_dir(imc_dir, count);
+ ret = read_from_imc_dir(imc_dir, &count);
if (ret) {
closedir(dp);
return ret;
}
- count++;
}
}
closedir(dp);