]> xenbits.xensource.com Git - people/andrewcoop/mini-os.git/commitdiff
Eliminate tpmtis union member in struct file
authorJuergen Gross <jgross@suse.com>
Tue, 11 Jan 2022 14:58:12 +0000 (15:58 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 12 Jan 2022 11:35:59 +0000 (11:35 +0000)
Replace the tpmtis specific union member in struct file with the
common dev pointer.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
include/lib.h
lib/sys.c
tpm_tis.c

index 2ddc076c25fba635bdf70be3ccc41c69ea4546f8..d6a29ba47f85553511377cdb18fd4caf9b1948ea 100644 (file)
@@ -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
index b042bf51f06f3fb03d8537489e7a2459b7a11612..96fc769dc0ac6c722c4719568d85950fd7b17eb4 100644 (file)
--- 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
index 4127118d23f766108fcab3dd0261624d50263c64..477f55506665a9b4f210d07a7c9ce4b82d7b2e8f 100644 (file)
--- 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;