"Kevin O'Connor" <kevin@koconnor.net> wrote on 02/01/2016 04:54:53 PM:

> From: "Kevin O'Connor" <kevin@koconnor.net>

> To: Stefan Berger/Watson/IBM@IBMUS
> Cc: seabios@seabios.org, Stefan Berger <stefanb@linux.vnet.ibm.com>
> Date: 02/01/2016 04:55 PM
> Subject: Re: [PATCH v2 03/10] tpm: Prepare code for TPM 2 functions
>
> On Fri, Jan 22, 2016 at 05:47:13PM -0500, Stefan Berger wrote:
> > From: Stefan Berger <stefanb@linux.vnet.ibm.com>
> >
> > This patch prepares the tcgbios.c file for extension with TPM 2
> > specific code by:
> >
> >  o prefixing all TPM 1.2 specific functions with tpm12_
> >  o where necessary, introduce switch statements in tpm_ - prefixedfunctions;
> >    here we branch into TPM versions specific code
> >  o introduce tpm_ - prefixed functions where necessary; mostly in those
> >    cases where tpm12_ functions are too large and where the tpm_ function
> >    then only holds the switch statement
> >  o leave FIXMEs where we need to write TPM 2 specific code;
> subsequent patches
> >    will replace those FIXMEs
> >
> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > ---
> >  src/tcgbios.c | 311 ++++++++++++++++++++++++++++++++++++
> +---------------------
> >  1 file changed, 199 insertions(+), 112 deletions(-)
> >
> > diff --git a/src/tcgbios.c b/src/tcgbios.c
> > index 799a8bf..7f314b7 100644
> > --- a/src/tcgbios.c
> > +++ b/src/tcgbios.c
> > @@ -171,7 +171,15 @@ tpm_is_working(void)
> >  int
> >  tpm_can_show_menu(void)
> >  {
> > -    return tpm_is_working() && TPM_has_physical_presence;
> > +    switch (TPM_version) {
> > +    case TPM_VERSION_NONE:
> > +        return 0;
>
> I find these "case TPM_VERSION_NONE:" clauses to be a little
> confusing, both in this patches and the later patches, because I don't
> think any of these additional code paths are reachable.  I think it
> would be better to just have the branches that are active (ie, v1.2
> and v2).



I know. The 'enum' forced this. So I'll remove these then and make TPM_VERSION_NONE etc. individual #define's.

   Stefan