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

[PATCH v2 13/18] mini-os: eliminate tpmtis union member in struct file



Replace the tpmtis specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 include/lib.h | 5 -----
 lib/sys.c     | 2 +-
 tpm_tis.c     | 8 ++++----
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/include/lib.h b/include/lib.h
index 2ddc076..d6a29ba 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -193,11 +193,6 @@ struct file {
            struct evtchn_port_list ports;
        } evtchn;
        struct gntmap gntmap;
-#ifdef CONFIG_TPM_TIS
-       struct {
-          struct tpm_chip *dev;
-       } tpm_tis;
-#endif
 #ifdef CONFIG_XENBUS
         struct {
             /* To each xenbus FD is associated a queue of watch events for this
diff --git a/lib/sys.c b/lib/sys.c
index b042bf5..96fc769 100644
--- a/lib/sys.c
+++ b/lib/sys.c
@@ -468,7 +468,7 @@ int close(int fd)
 #endif
 #ifdef CONFIG_TPM_TIS
        case FTYPE_TPM_TIS:
-            shutdown_tpm_tis(files[fd].tpm_tis.dev);
+            shutdown_tpm_tis(files[fd].dev);
            files[fd].type = FTYPE_NONE;
            return 0;
 #endif
diff --git a/tpm_tis.c b/tpm_tis.c
index 4127118..477f555 100644
--- a/tpm_tis.c
+++ b/tpm_tis.c
@@ -1288,14 +1288,14 @@ int tpm_tis_open(struct tpm_chip* tpm)
 
    tpm->fd = alloc_fd(FTYPE_TPM_TIS);
    printk("tpm_tis_open() -> %d\n", tpm->fd);
-   files[tpm->fd].tpm_tis.dev = tpm;
+   files[tpm->fd].dev = tpm;
    return tpm->fd;
 }
 
 int tpm_tis_posix_write(int fd, const uint8_t* buf, size_t count)
 {
    struct tpm_chip* tpm;
-   tpm = files[fd].tpm_tis.dev;
+   tpm = files[fd].dev;
 
    if(tpm->locality < 0) {
       printk("tpm_tis_posix_write() failed! locality not set!\n");
@@ -1323,7 +1323,7 @@ int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
 {
    int rc;
    struct tpm_chip* tpm;
-   tpm = files[fd].tpm_tis.dev;
+   tpm = files[fd].dev;
 
    if(count == 0) {
       return 0;
@@ -1350,7 +1350,7 @@ int tpm_tis_posix_read(int fd, uint8_t* buf, size_t count)
 int tpm_tis_posix_fstat(int fd, struct stat* buf)
 {
    struct tpm_chip* tpm;
-   tpm = files[fd].tpm_tis.dev;
+   tpm = files[fd].dev;
 
    buf->st_mode = O_RDWR;
    buf->st_uid = 0;
-- 
2.26.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.