Ошибка несовместимого типа указателя при попытке собрать ядро ​​android - PullRequest
0 голосов
/ 20 января 2020

Получение этой ошибки при попытке скомпилировать ядро ​​AOS:

arch/x86/kernel/cpu/perf_event_intel_pt.c: In function ‘pt_init’:

arch/x86/kernel/cpu/perf_event_intel_pt.c:1175:27: error: assignment
to ‘void * (*)(struct perf_event *, void **, int,  bool)’ {aka ‘void *
(*)(struct perf_event *, void **, int,  _Bool)’} from incompatible
pointer type ‘void * (*)(int,  void **, int,  bool)’ {aka ‘void *
(*)(int,  void **, int,  _Bool)’} [-Werror=incompatible-pointer-types]
1175 |  pt_pmu.pmu.setup_aux     = pt_buffer_setup_aux;                                                                                                    
     |                           ^

Код:

static __init int pt_init(void)
{
    int ret, cpu, prior_warn = 0;

    BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE);

    if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT))
        return -ENODEV;

    get_online_cpus();
    for_each_online_cpu(cpu) {
        u64 ctl;

        ret = rdmsrl_safe_on_cpu(cpu, MSR_IA32_RTIT_CTL, &ctl);
        if (!ret && (ctl & RTIT_CTL_TRACEEN))
            prior_warn++;
    }
    put_online_cpus();

    if (prior_warn) {
        x86_add_exclusive(x86_lbr_exclusive_pt);
        pr_warn("PT is enabled at boot time, doing nothing\n");

        return -EBUSY;
    }

    ret = pt_pmu_hw_init();
    if (ret)
        return ret;

    if (!pt_cap_get(PT_CAP_topa_output)) {
        pr_warn("ToPA output is not supported on this CPU\n");
        return -ENODEV;
    }

    if (!pt_cap_get(PT_CAP_topa_multiple_entries))
        pt_pmu.pmu.capabilities =
            PERF_PMU_CAP_AUX_NO_SG | PERF_PMU_CAP_AUX_SW_DOUBLEBUF;

    pt_pmu.pmu.capabilities |= PERF_PMU_CAP_EXCLUSIVE | PERF_PMU_CAP_ITRACE;
    pt_pmu.pmu.attr_groups   = pt_attr_groups;
    pt_pmu.pmu.task_ctx_nr   = perf_sw_context;
    pt_pmu.pmu.event_init    = pt_event_init;
    pt_pmu.pmu.add           = pt_event_add;
    pt_pmu.pmu.del           = pt_event_del;
    pt_pmu.pmu.start         = pt_event_start;
    pt_pmu.pmu.stop          = pt_event_stop;
    pt_pmu.pmu.read          = pt_event_read;
    pt_pmu.pmu.setup_aux     = pt_buffer_setup_aux;
    pt_pmu.pmu.free_aux      = pt_buffer_free_aux;
    ret = perf_pmu_register(&pt_pmu.pmu, "intel_pt", -1);

    return ret;
}
arch_initcall(pt_init);

Я немного новичок в C ++ и большую часть времени занимаюсь самообучением. Мои книги и Google не очень мне помогают на этом этапе, и я застрял. Я не новичок в компиляции, и до сих пор делал исправления предупреждений / ошибок. Любая помощь приветствуется.

Использование clang для компиляции

...