Re: [PATCH v8 24/25] powerpc: Adopt nvram module for PPC64

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 31 Dec 2018, Arnd Bergmann wrote:

On Sun, Dec 30, 2018 at 4:29 AM Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx> wrote:

On Sat, 29 Dec 2018, Arnd Bergmann wrote:

With the current method, it does seem odd to have a single 
per-architecture instance of the exported structure containing 
function pointers. This doesn't give us the flexibility of having 
multiple copies in the kernel the way that ppc_md does, but it adds 
overhead compared to simply exporting the functions directly.


You're right, there is overhead here.

With a bit of auditing, wrappers like the one you quoted (which merely 
checks whether or not a ppc_md method is implemented) could surely be 
avoided.

The arch_nvram_ops methods are supposed to optional (that is, they are 
allowed to be NULL).

We could call exactly the same function pointers though either ppc_md 
or arch_nvram_ops. That would avoid the double indirection.

I think you can have a 'const' structure in the __ro_after_init section, 
so without changing anything else, powerpc could just copy the function 
pointers from ppc_md into the arch_nvram_ops at early init time, which 
should ideally simplify your implementation as well.


Does this require removing the 'const' from the powerpc arch_nvram_ops 
definition? That would mean removing the 'const' from the declaration in 
nvram.h, which means removing 'const' for every other instance of that 
struct too.

That's what happened when I tried removing the ppc_md.nvram_* methods 
entirely and assigning the same function pointers to arch_nvram_ops 
methods instead. Apparently all instances of arch_nvram_ops have to be 
const or none of them. Otherwise gcc says, "error: conflicting type 
qualifiers for 'arch_nvram_ops'".

-- 

        Arnd




[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux