• Kajol Jain's avatar
    drivers/nvdimm: Fix build failure when CONFIG_PERF_EVENTS is not set · de7a9e94
    Kajol Jain authored
    The following build failure occurs when CONFIG_PERF_EVENTS is not set
    as generic pmu functions are not visible in that scenario.
    
    |-- s390-randconfig-r044-20220313
    |   |-- nd_perf.c:(.text):undefined-reference-to-perf_pmu_migrate_context
    |   |-- nd_perf.c:(.text):undefined-reference-to-perf_pmu_register
    |   `-- nd_perf.c:(.text):undefined-reference-to-perf_pmu_unregister
    
    Similar build failure in nds32 architecture:
    nd_perf.c:(.text+0x21e): undefined reference to `perf_pmu_migrate_context'
    nd_perf.c:(.text+0x434): undefined reference to `perf_pmu_register'
    nd_perf.c:(.text+0x57c): undefined reference to `perf_pmu_unregister'
    
    Fix this issue by adding check for CONFIG_PERF_EVENTS config option
    and disabling the nvdimm perf interface incase this config is not set.
    
    Also remove function declaration of perf_pmu_migrate_context,
    perf_pmu_register, perf_pmu_unregister functions from nd.h as these are
    common pmu functions which are part of perf_event.h and since we
    are disabling nvdimm perf interface incase CONFIG_PERF_EVENTS option
    is not set, we not need to declare them in nd.h
    
    Also move the platform_device header file addition part from nd.h to
    nd_perf.c and add stub functions for register_nvdimm_pmu and
    unregister_nvdimm_pmu functions to handle CONFIG_PERF_EVENTS=n
    case.
    
    Fixes: 0fab1ba6 ("drivers/nvdimm: Add perf interface to expose nvdimm performance stats") (Commit id based on libnvdimm-for-next tree)
    Signed-off-by: default avatarKajol Jain <kjain@linux.ibm.com>
    Link: https://lore.kernel.org/all/62317124.YBQFU33+s%2FwdvWGj%25lkp@intel.com/Reported-by: default avatarkernel test robot <lkp@intel.com>
    Link: https://lore.kernel.org/r/20220323164550.109768-1-kjain@linux.ibm.comSigned-off-by: default avatarDan Williams <dan.j.williams@intel.com>
    de7a9e94
Makefile 945 Bytes