[PATCH v2 1/3] tpm: of: Move of-tree specific code from tpm driver into of driver

Jarkko Sakkinen jarkko at kernel.org
Thu Jun 30 16:16:57 PDT 2022


On Wed, Jun 29, 2022 at 10:16:37AM -0400, Stefan Berger wrote:
> 
> 
> On 6/28/22 22:45, Jarkko Sakkinen wrote:
> > On Tue, Jun 28, 2022 at 09:29:48AM -0400, Stefan Berger wrote:
> > > 
> > > 
> > > On 6/27/22 18:43, Rob Herring wrote:
> > > > On Thu, Jun 16, 2022 at 11:41:28AM -0400, Stefan Berger wrote:
> > > > > Simplify tpm_read_log_of() by moving Openfirmware-specific code into
> > > > > the Openfirmware driver to make the code reusable. Call the new
> > > > 
> > > > There is no such 'Openfirmware driver'.
> > > > 
> > > > > of_tpm_get_sml_parameters() function from the TPM Openfirmware driver.
> > > > > 
> > > > > Signed-off-by: Stefan Berger <stefanb at linux.ibm.com>
> > > > > Cc: Jarkko Sakkinen <jarkko at kernel.org>
> > > > > Cc: Jason Gunthorpe <jgg at ziepe.ca>
> > > > > Cc: Rob Herring <robh+dt at kernel.org>
> > > > > Cc: Frank Rowand <frowand.list at gmail.com>
> > > > > ---
> > > > >    drivers/char/tpm/eventlog/of.c | 31 +++++--------------------------
> > > > >    drivers/of/Makefile            |  2 +-
> > > > >    drivers/of/device_node.c       | 27 +++++++++++++++++++++++++++
> > > > 
> > > > Humm, definitely the wrong direction. Generally, code for specific
> > > > bindings does not go in drivers/of/. There used to be some, but we've
> > > > moved it to the appropriate subsystems. kexec was an exception to not
> > > > have 2 copies of the same code in arch/.
> > > 
> > > The function I am moving here is called by the TPM subsystem and also now by
> > > of/kexec.c. The latter is compiled under the following conditions:
> > > 
> > > ifdef CONFIG_KEXEC_FILE
> > > ifdef CONFIG_OF_FLATTREE
> > > obj-y	+= kexec.o
> > > endif
> > > endif
> > > 
> > > The code that current calls it is compiled under the following conditions:
> > > 
> > > tpm-$(CONFIG_OF) += eventlog/of.o
> > > 
> > > To make it available to both I could keep it in the TPM subsystem like this:
> > > 
> > > obj-$(CONFIG_OF) = tpm_of.o
> > > 
> > > 
> > > Jarrko, if you read this, any comment?
> > > 
> > > 
> > >     Stefan
> > 
> > Why can't you convert of_tpm_get_sml_parameters() to inline function?
> 
> I can do that and put it into include/linux/tpm.h. The only concern would
> have been the size of the function.

It is somewhat insignificant amount (dozens of bytes at most).

BR, Jarkko



More information about the kexec mailing list