On Tue, 8 Jan 2019, Michael Ellerman wrote: > > The reason why that doesn't work boils down to introspection. (This > > was mentioned elsewhere in this email thread.) For example, we > > presently have code like this, > > > > ssize_t nvram_get_size(void) > > { > > if (ppc_md.nvram_size) > > return ppc_md.nvram_size(); > > return -1; > > } > > EXPORT_SYMBOL(nvram_get_size); > > > > This construction means we get to decide at run-time which of the NVRAM > > functions should be used. (Whereas your example makes a build-time > > decision.) > > Right, but we only need to make a runtime decision on powerpc (right?).
It's needed in many places outside of powerpc. Otherwise the caller can't determine at run-time which ops are implemented. Hence you have to duplicate the caller for each supported configuration that you build. Already, this precludes a shared misc device implementation and belies the "generic" in drivers/char/generic_nvram.c. --