qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 4/8] tpm-backend: Made few interface methods


From: Amarnath Valluri
Subject: Re: [Qemu-devel] [PATCH v3 4/8] tpm-backend: Made few interface methods optional
Date: Thu, 4 May 2017 11:39:48 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0



On 05/02/2017 03:29 PM, Marc-André Lureau wrote:


On Tue, May 2, 2017 at 3:52 PM Amarnath Valluri <address@hidden <mailto:address@hidden>> wrote:

    This allows backend implementations left optional interface methods.
    For mandatory methods assertion checks added.

    Signed-off-by: Amarnath Valluri <address@hidden
<mailto:address@hidden>>
    ---
     backends/tpm.c           | 24 ++++++++++++++++++------
     hw/tpm/tpm_passthrough.c | 16 ----------------
     2 files changed, 18 insertions(+), 22 deletions(-)

    diff --git a/backends/tpm.c b/backends/tpm.c
    index cf5abf1..8245426 100644
    --- a/backends/tpm.c
    +++ b/backends/tpm.c
    @@ -48,7 +48,7 @@ const char *tpm_backend_get_desc(TPMBackend *s)
     {
         TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);

    -    return k->ops->desc();
    +    return k->ops->desc ? k->ops->desc() : "";
     }


If it only need to returns const, we may consider using a class field, defaulting to null.
Yes, it makes more sense being a const member than a function pointer.

Who is using it? tpm_backend_get_desc() not being called anywhere. Let's remove it?
Frankly no one using this API, rather it's been accessed directly(be_drivers[i]->desc()) in tpm.c. It can be removed.

- Amarnath


reply via email to

[Prev in Thread] Current Thread [Next in Thread]