[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160903062605.GB2061@intel.com>
Date: Sat, 3 Sep 2016 09:26:05 +0300
From: Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
To: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
Cc: Peter Huewe <peterhuewe@....de>,
Marcel Selhorst <tpmdd@...horst.net>,
"moderated list:TPM DEVICE DRIVER"
<tpmdd-devel@...ts.sourceforge.net>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tpm: move struct tpm_class_ops to drivers/char/tpm/tpm.h
On Sat, Sep 03, 2016 at 09:22:21AM +0300, Jarkko Sakkinen wrote:
> On Fri, Sep 02, 2016 at 04:45:31PM -0600, Jason Gunthorpe wrote:
> > On Sat, Sep 03, 2016 at 01:35:22AM +0300, Jarkko Sakkinen wrote:
> > > On Fri, Sep 02, 2016 at 04:11:22PM -0600, Jason Gunthorpe wrote:
> > > > On Sat, Sep 03, 2016 at 12:48:03AM +0300, Jarkko Sakkinen wrote:
> > > > > The struct tpm_class_ops is not used outside the TPM driver. Thus,
> > > > > it can be safely move to drivers/char/tpm/tpm.h.
> > > >
> > > > No, this is the wrong direction.
> > > >
> > > > The goal is to make things more like other subsystems, so we should be
> > > > moving struct tpm_chip into the public header, and that requires ops
> > > > to be in the public header.
> > > >
> > > > This is why I put ops here in the first place.
> > >
> > > I'm OK with it as long as you explain why this is necessary. I see no
> > > use for them outside the TPM subsystem.
> >
> > That is because the users out side the subsystem are Doing it Wrong.
> >
> > eg this:
> >
> > extern int tpm_is_tpm2(u32 chip_num);
> >
> > Should be:
> >
> > extern int tpm_is_tpm2(struct tpm_chip *chip);
> >
> > And same for all other examples.
> >
> > The 'chip_num' thing is bonkers.
>
> OK, how would one get the chip instance?
This still doesn't explain why moving the structures inside the driver
would be wrong. Even if outside callers would use a pointer the
structure could be opaque.
/Jarkko
Powered by blists - more mailing lists