Re: [PATCH 6/9] perf: Generic pci uncore device support

Peter Zijlstra
2012-05-03T21:40:10Z

On Wed, 2012-05-02 at 10:07 +0800, Yan, Zheng wrote:
> + uncores = msr_uncores;
> + while (1) {
> + for (i = 0; uncores[i]; i++) {
> + type = uncores[i];
> + for (j = 0; j < type->num_boxes; j++) {
> + pmu = &type->pmus[j];
> + box = uncore_pmu_find_box(pmu, phyid);
> + WARN_ON_ONCE(box->cpu != -1);
> + box->cpu = cpu;
> + }
> }
> + if (uncores != msr_uncores)
> + break;
> + uncores = pci_uncores;
> }

Wouldn't it be better to pull the body out into a separate function and
do something like:

__uncore_init_types(msr_uncores, cpu);
__uncore_init_types(pci_uncores, cpu);

same for the other such construct..