On 3/22/22 07:15, Dan Williams wrote: > On Mon, Mar 21, 2022 at 2:39 PM Dan Williams <dan.j.williams@xxxxxxxxx> wrote: >> >> On Fri, Mar 18, 2022 at 4:42 AM Kajol Jain <kjain@xxxxxxxxxxxxx> wrote: >>> >>> The following build failure occures when CONFIG_PERF_EVENTS is not set >>> as generic pmu functions are not visible in that scenario. >>> >>> arch/powerpc/platforms/pseries/papr_scm.c:372:35: error: ‘struct perf_event’ has no member named ‘attr’ >>> p->nvdimm_events_map[event->attr.config], >>> ^~ >>> In file included from ./include/linux/list.h:5, >>> from ./include/linux/kobject.h:19, >>> from ./include/linux/of.h:17, >>> from arch/powerpc/platforms/pseries/papr_scm.c:5: >>> arch/powerpc/platforms/pseries/papr_scm.c: In function ‘papr_scm_pmu_event_init’: >>> arch/powerpc/platforms/pseries/papr_scm.c:389:49: error: ‘struct perf_event’ has no member named ‘pmu’ >>> struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); >>> ^~ >>> ./include/linux/container_of.h:18:26: note: in definition of macro ‘container_of’ >>> void *__mptr = (void *)(ptr); \ >>> ^~~ >>> arch/powerpc/platforms/pseries/papr_scm.c:389:30: note: in expansion of macro ‘to_nvdimm_pmu’ >>> struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); >>> ^~~~~~~~~~~~~ >>> In file included from ./include/linux/bits.h:22, >>> from ./include/linux/bitops.h:6, >>> from ./include/linux/of.h:15, >>> from arch/powerpc/platforms/pseries/papr_scm.c:5: >>> >>> Fix the build issue by adding check for CONFIG_PERF_EVENTS config option >>> and disabling the papr_scm perf interface support incase this config >>> is not set >>> >>> Fixes: 4c08d4bbc089 ("powerpc/papr_scm: Add perf interface support") (Commit id >>> based on linux-next tree) >>> Signed-off-by: Kajol Jain <kjain@xxxxxxxxxxxxx> >>> --- >>> arch/powerpc/platforms/pseries/papr_scm.c | 15 +++++++++++++++ >> >> This is a bit messier than I would have liked mainly because it dumps >> a bunch of ifdefery into a C file contrary to coding style, "Wherever >> possible, don't use preprocessor conditionals (#if, #ifdef) in .c >> files". I would expect this all to move to an organization like: >> >> arch/powerpc/platforms/pseries/papr_scm/main.c >> arch/powerpc/platforms/pseries/papr_scm/perf.c >> >> ...and a new config symbol like: >> >> config PAPR_SCM_PERF >> depends on PAPR_SCM && PERF_EVENTS >> def_bool y >> >> ...with wrappers in header files to make everything compile away >> without any need for main.c to carry an ifdef. >> >> Can you turn a patch like that in the next couple days? Otherwise, I >> think if Linus saw me sending a late breaking compile fix that threw >> coding style out the window he'd have cause to just drop the pull >> request entirely. > > Also, please base it on the current state of the libnvdimm-for-next > branch as -next includes some of the SMART health changes leading to > at least one conflict. Ok Dan, I will rebase my changes on top of libnvdimm-for-next branch. Thanks, Kajol Jain