lkml.org 
[lkml]   [2022]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v5 07/10] tmp, tmp_tis: Implement usage counter for locality
    From
    Date
    On 15.06.22 at 20:23, Jarkko Sakkinen wrote:
    > On Fri, Jun 10, 2022 at 01:08:43PM +0200, LinoSanfilippo@gmx.de wrote:
    >> From: Lino Sanfilippo <l.sanfilippo@kunbus.com>
    >>
    >> Implement a usage counter for the (default) locality used by the TPM TIS
    >> driver:
    >> Request the locality from the TPM if it has not been claimed yet, otherwise
    >> only increment the counter. Also release the locality if the counter is 0
    >> otherwise only decrement the counter. Ensure thread-safety by protecting
    >> the counter with a mutex.
    >>
    >> This allows to request and release the locality from a thread and the
    >> interrupt handler at the same time without the danger to interfere with
    >> each other.
    >>
    >> Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
    >> ---
    >> drivers/char/tpm/tpm_tis_core.c | 30 ++++++++++++++++++++++++++++--
    >> drivers/char/tpm/tpm_tis_core.h | 2 ++
    >> 2 files changed, 30 insertions(+), 2 deletions(-)
    >>
    >> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
    >> index 028bec44362d..0ef74979bc2c 100644
    >> --- a/drivers/char/tpm/tpm_tis_core.c
    >> +++ b/drivers/char/tpm/tpm_tis_core.c
    >> @@ -158,16 +158,26 @@ static bool check_locality(struct tpm_chip *chip, int l)
    >> return false;
    >> }
    >>
    >> +static int release_locality_locked(struct tpm_tis_data *priv, int l)
    >> +{
    >> + tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
    >
    > nit: empty line here
    >
    > Also it would not hurt to prefix it with tpm_tis.
    >
    > This is for simple and practical reasons, like grepping. I don't
    > mind if you do that also for other functions (if you want to).
    >

    Ok, will do so.

    Regards,
    Lino

    \
     
     \ /
      Last update: 2022-06-16 00:23    [W:4.945 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site