tpm: Pull all driver sysfs code into tpm-sysfs.c
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tue, 26 Nov 2013 20:30:42 +0000 (13:30 -0700)
committerPeter Huewe <peterhuewe@gmx.de>
Mon, 6 Jan 2014 13:37:25 +0000 (14:37 +0100)
The tpm core now sets up and controls all sysfs attributes, instead
of having each driver have a unique take on it.

All drivers now now have a uniform set of attributes, and no sysfs
related entry points are exported from the tpm core module.

This also uses the new method used to declare sysfs attributes
with DEVICE_ATTR_RO and 'struct attribute *'

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
[phuewe: had to apply the tpm_i2c_atmel part manually due to commit
191ffc6bde3fc tpm/tpm_i2c_atmel: fix coccinelle warnings]

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
13 files changed:
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm-sysfs.c
drivers/char/tpm/tpm.h
drivers/char/tpm/tpm_atmel.c
drivers/char/tpm/tpm_i2c_atmel.c
drivers/char/tpm/tpm_i2c_infineon.c
drivers/char/tpm/tpm_i2c_nuvoton.c
drivers/char/tpm/tpm_i2c_stm_st33.c
drivers/char/tpm/tpm_ibmvtpm.c
drivers/char/tpm/tpm_infineon.c
drivers/char/tpm/tpm_nsc.c
drivers/char/tpm/tpm_tis.c
drivers/char/tpm/xen-tpmfront.c

index 3f8bddf8f7edb185a16fffe5b980b4a3142e2367..389d483a887c7dce8d3caa8ae6d2a6d7bdc30ffd 100644 (file)
@@ -879,7 +879,7 @@ void tpm_remove_hardware(struct device *dev)
        synchronize_rcu();
 
        tpm_dev_del_device(chip);
-       sysfs_remove_group(&dev->kobj, chip->vendor.attr_group);
+       tpm_sysfs_del_device(chip);
        tpm_remove_ppi(&dev->kobj);
        tpm_bios_log_teardown(chip->bios_dir);
 
@@ -1095,7 +1095,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
        if (tpm_dev_add_device(chip))
                goto put_device;
 
-       if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group))
+       if (tpm_sysfs_add_device(chip))
                goto del_misc;
 
        if (tpm_add_ppi(&dev->kobj))
index 310d9609566fb6dc545b9bd46d162f21c9ea60c1..506a07be5c3fc3c914919afe123d0d9c7456c516 100644 (file)
@@ -6,6 +6,9 @@
  * Reiner Sailer <sailer@watson.ibm.com>
  * Kylene Hall <kjhall@us.ibm.com>
  *
+ * Copyright (C) 2013 Obsidian Research Corp
+ * Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
+ *
  * sysfs filesystem inspection interface to the TPM
  *
  * This program is free software; you can redistribute it and/or
@@ -43,9 +46,8 @@ static struct tpm_input_header tpm_readpubek_header = {
        .length = cpu_to_be32(30),
        .ordinal = TPM_ORD_READPUBEK
 };
-
-ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
-                      char *buf)
+static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
 {
        u8 *data;
        struct tpm_cmd_t tpm_cmd;
@@ -99,10 +101,10 @@ out:
        rc = str - buf;
        return rc;
 }
-EXPORT_SYMBOL_GPL(tpm_show_pubek);
+static DEVICE_ATTR_RO(pubek);
 
-ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
-                     char *buf)
+static ssize_t pcrs_show(struct device *dev, struct device_attribute *attr,
+                        char *buf)
 {
        cap_t cap;
        u8 digest[TPM_DIGEST_SIZE];
@@ -128,10 +130,10 @@ ssize_t tpm_show_pcrs(struct device *dev, struct device_attribute *attr,
        }
        return str - buf;
 }
-EXPORT_SYMBOL_GPL(tpm_show_pcrs);
+static DEVICE_ATTR_RO(pcrs);
 
-ssize_t tpm_show_enabled(struct device *dev, struct device_attribute *attr,
-                       char *buf)
+static ssize_t enabled_show(struct device *dev, struct device_attribute *attr,
+                    char *buf)
 {
        cap_t cap;
        ssize_t rc;
@@ -144,10 +146,10 @@ ssize_t tpm_show_enabled(struct device *dev, struct device_attribute *attr,
        rc = sprintf(buf, "%d\n", !cap.perm_flags.disable);
        return rc;
 }
-EXPORT_SYMBOL_GPL(tpm_show_enabled);
+static DEVICE_ATTR_RO(enabled);
 
-ssize_t tpm_show_active(struct device *dev, struct device_attribute *attr,
-                       char *buf)
+ssize_t active_show(struct device *dev, struct device_attribute *attr,
+                   char *buf)
 {
        cap_t cap;
        ssize_t rc;
@@ -160,10 +162,10 @@ ssize_t tpm_show_active(struct device *dev, struct device_attribute *attr,
        rc = sprintf(buf, "%d\n", !cap.perm_flags.deactivated);
        return rc;
 }
-EXPORT_SYMBOL_GPL(tpm_show_active);
+static DEVICE_ATTR_RO(active);
 
-ssize_t tpm_show_owned(struct device *dev, struct device_attribute *attr,
-                       char *buf)
+static ssize_t owned_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
 {
        cap_t cap;
        ssize_t rc;
@@ -176,10 +178,10 @@ ssize_t tpm_show_owned(struct device *dev, struct device_attribute *attr,
        rc = sprintf(buf, "%d\n", cap.owned);
        return rc;
 }
-EXPORT_SYMBOL_GPL(tpm_show_owned);
+static DEVICE_ATTR_RO(owned);
 
-ssize_t tpm_show_temp_deactivated(struct device *dev,
-                               struct device_attribute *attr, char *buf)
+static ssize_t temp_deactivated_show(struct device *dev,
+                                    struct device_attribute *attr, char *buf)
 {
        cap_t cap;
        ssize_t rc;
@@ -192,10 +194,10 @@ ssize_t tpm_show_temp_deactivated(struct device *dev,
        rc = sprintf(buf, "%d\n", cap.stclear_flags.deactivated);
        return rc;
 }
-EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated);
+static DEVICE_ATTR_RO(temp_deactivated);
 
-ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr,
-                     char *buf)
+static ssize_t caps_show(struct device *dev, struct device_attribute *attr,
+                        char *buf)
 {
        cap_t cap;
        ssize_t rc;
@@ -234,10 +236,10 @@ ssize_t tpm_show_caps(struct device *dev, struct device_attribute *attr,
 
        return str - buf;
 }
-EXPORT_SYMBOL_GPL(tpm_show_caps);
+static DEVICE_ATTR_RO(caps);
 
-ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
-                       const char *buf, size_t count)
+static ssize_t cancel_store(struct device *dev, struct device_attribute *attr,
+                           const char *buf, size_t count)
 {
        struct tpm_chip *chip = dev_get_drvdata(dev);
        if (chip == NULL)
@@ -246,10 +248,10 @@ ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr,
        chip->vendor.cancel(chip);
        return count;
 }
-EXPORT_SYMBOL_GPL(tpm_store_cancel);
+static DEVICE_ATTR_WO(cancel);
 
-ssize_t tpm_show_durations(struct device *dev, struct device_attribute *attr,
-                         char *buf)
+static ssize_t durations_show(struct device *dev, struct device_attribute *attr,
+                             char *buf)
 {
        struct tpm_chip *chip = dev_get_drvdata(dev);
 
@@ -263,10 +265,10 @@ ssize_t tpm_show_durations(struct device *dev, struct device_attribute *attr,
                       chip->vendor.duration_adjusted
                       ? "adjusted" : "original");
 }
-EXPORT_SYMBOL_GPL(tpm_show_durations);
+static DEVICE_ATTR_RO(durations);
 
-ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr,
-                         char *buf)
+static ssize_t timeouts_show(struct device *dev, struct device_attribute *attr,
+                            char *buf)
 {
        struct tpm_chip *chip = dev_get_drvdata(dev);
 
@@ -278,4 +280,39 @@ ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr,
                       chip->vendor.timeout_adjusted
                       ? "adjusted" : "original");
 }
-EXPORT_SYMBOL_GPL(tpm_show_timeouts);
+static DEVICE_ATTR_RO(timeouts);
+
+static struct attribute *tpm_dev_attrs[] = {
+       &dev_attr_pubek.attr,
+       &dev_attr_pcrs.attr,
+       &dev_attr_enabled.attr,
+       &dev_attr_active.attr,
+       &dev_attr_owned.attr,
+       &dev_attr_temp_deactivated.attr,
+       &dev_attr_caps.attr,
+       &dev_attr_cancel.attr,
+       &dev_attr_durations.attr,
+       &dev_attr_timeouts.attr,
+       NULL,
+};
+
+static const struct attribute_group tpm_dev_group = {
+       .attrs = tpm_dev_attrs,
+};
+
+int tpm_sysfs_add_device(struct tpm_chip *chip)
+{
+       int err;
+       err = sysfs_create_group(&chip->dev->kobj,
+                                &tpm_dev_group);
+
+       if (err)
+               dev_err(chip->dev,
+                       "failed to create sysfs attributes, %d\n", err);
+       return err;
+}
+
+void tpm_sysfs_del_device(struct tpm_chip *chip)
+{
+       sysfs_remove_group(&chip->dev->kobj, &tpm_dev_group);
+}
index 41b1480e6e173dfcc3defe78f368598bd8287b28..14ba1627d78e392b725dc3c117b37211ac9ecd38 100644 (file)
@@ -61,27 +61,6 @@ enum tpm_duration {
 #define TPM_ERR_INVALID_POSTINIT 38
 
 #define TPM_HEADER_SIZE                10
-extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr,
-                               char *);
-extern ssize_t tpm_show_pcrs(struct device *, struct device_attribute *attr,
-                               char *);
-extern ssize_t tpm_show_caps(struct device *, struct device_attribute *attr,
-                               char *);
-extern ssize_t tpm_store_cancel(struct device *, struct device_attribute *attr,
-                               const char *, size_t);
-extern ssize_t tpm_show_enabled(struct device *, struct device_attribute *attr,
-                               char *);
-extern ssize_t tpm_show_active(struct device *, struct device_attribute *attr,
-                               char *);
-extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr,
-                               char *);
-extern ssize_t tpm_show_temp_deactivated(struct device *,
-                                        struct device_attribute *attr, char *);
-extern ssize_t tpm_show_durations(struct device *,
-                                 struct device_attribute *attr, char *);
-extern ssize_t tpm_show_timeouts(struct device *,
-                                struct device_attribute *attr, char *);
-
 struct tpm_chip;
 
 struct tpm_vendor_specific {
@@ -103,7 +82,6 @@ struct tpm_vendor_specific {
        u8 (*status) (struct tpm_chip *);
        void (*release) (struct device *);
        struct miscdevice miscdev;
-       struct attribute_group *attr_group;
        struct list_head list;
        int locality;
        unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
@@ -368,6 +346,8 @@ extern int wait_for_tpm_stat(struct tpm_chip *, u8, unsigned long,
 
 int tpm_dev_add_device(struct tpm_chip *chip);
 void tpm_dev_del_device(struct tpm_chip *chip);
+int tpm_sysfs_add_device(struct tpm_chip *chip);
+void tpm_sysfs_del_device(struct tpm_chip *chip);
 
 int tpm_pcr_read_dev(struct tpm_chip *chip, int pcr_idx, u8 *res_buf);
 
index 9692e2f252e0a1f29c830b90a2971985c1c6ded3..7e665d047c93cf77009db8c12c93ff1441e1c6cc 100644 (file)
@@ -121,21 +121,6 @@ static bool tpm_atml_req_canceled(struct tpm_chip *chip, u8 status)
        return (status == ATML_STATUS_READY);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR |S_IWGRP, NULL, tpm_store_cancel);
-
-static struct attribute* atmel_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       NULL,
-};
-
-static struct attribute_group atmel_attr_grp = { .attrs = atmel_attrs };
-
 static const struct tpm_vendor_specific tpm_atmel = {
        .recv = tpm_atml_recv,
        .send = tpm_atml_send,
@@ -144,7 +129,6 @@ static const struct tpm_vendor_specific tpm_atmel = {
        .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
        .req_complete_val = ATML_STATUS_DATA_AVAIL,
        .req_canceled = tpm_atml_req_canceled,
-       .attr_group = &atmel_attr_grp,
 };
 
 static struct platform_device *pdev;
index 079c19d31187467307dd2f0e77e19c014f1ecf85..fe8bdce7d24fdf857c096c98bbb7432be7859ffb 100644 (file)
@@ -135,35 +135,6 @@ static u8 i2c_atmel_read_status(struct tpm_chip *chip)
        return ATMEL_STS_OK;
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
-static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
-
-static struct attribute *i2c_atmel_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       &dev_attr_durations.attr,
-       &dev_attr_timeouts.attr,
-       NULL,
-};
-
-static struct attribute_group i2c_atmel_attr_grp = {
-       .attrs = i2c_atmel_attrs
-};
-
 static bool i2c_atmel_req_canceled(struct tpm_chip *chip, u8 status)
 {
        return false;
@@ -177,7 +148,6 @@ static const struct tpm_vendor_specific i2c_atmel = {
        .req_complete_mask = ATMEL_STS_OK,
        .req_complete_val = ATMEL_STS_OK,
        .req_canceled = i2c_atmel_req_canceled,
-       .attr_group = &i2c_atmel_attr_grp,
 };
 
 static int i2c_atmel_probe(struct i2c_client *client,
index c1ba7fa6830c3896839b3acc773bd7397d33be9b..ac1218f41afe780510865fb4cb2145ee49396381 100644 (file)
@@ -566,35 +566,6 @@ static bool tpm_tis_i2c_req_canceled(struct tpm_chip *chip, u8 status)
        return (status == TPM_STS_COMMAND_READY);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
-static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
-
-static struct attribute *tis_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       &dev_attr_durations.attr,
-       &dev_attr_timeouts.attr,
-       NULL,
-};
-
-static struct attribute_group tis_attr_grp = {
-       .attrs = tis_attrs
-};
-
 static struct tpm_vendor_specific tpm_tis_i2c = {
        .status = tpm_tis_i2c_status,
        .recv = tpm_tis_i2c_recv,
@@ -603,7 +574,6 @@ static struct tpm_vendor_specific tpm_tis_i2c = {
        .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_canceled = tpm_tis_i2c_req_canceled,
-       .attr_group = &tis_attr_grp,
 };
 
 static int tpm_tis_i2c_init(struct device *dev)
index c9bb60e45cb00cf8f408a12917ad30a796d0fd76..1e6905ba0deacb9686482acf04e1b04a4ceb73f2 100644 (file)
@@ -455,35 +455,6 @@ static bool i2c_nuvoton_req_canceled(struct tpm_chip *chip, u8 status)
        return (status == TPM_STS_COMMAND_READY);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
-static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
-
-static struct attribute *i2c_nuvoton_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       &dev_attr_durations.attr,
-       &dev_attr_timeouts.attr,
-       NULL,
-};
-
-static struct attribute_group i2c_nuvoton_attr_grp = {
-       .attrs = i2c_nuvoton_attrs
-};
-
 static const struct tpm_vendor_specific tpm_i2c = {
        .status = i2c_nuvoton_read_status,
        .recv = i2c_nuvoton_recv,
@@ -492,7 +463,6 @@ static const struct tpm_vendor_specific tpm_i2c = {
        .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_canceled = i2c_nuvoton_req_canceled,
-       .attr_group = &i2c_nuvoton_attr_grp,
 };
 
 /* The only purpose for the handler is to signal to any waiting threads that
index e519e6815780d298fc14d5087e6f94bb27f8af1b..6902f7b11e4814329fa24ba7518a790aa155b336 100644 (file)
@@ -574,30 +574,6 @@ static bool tpm_st33_i2c_req_canceled(struct tpm_chip *chip, u8 status)
        return (status == TPM_STS_COMMAND_READY);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-
-static struct attribute *stm_tpm_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr, NULL,
-};
-
-static struct attribute_group stm_tpm_attr_grp = {
-       .attrs = stm_tpm_attrs
-};
-
 static struct tpm_vendor_specific st_i2c_tpm = {
        .send = tpm_stm_i2c_send,
        .recv = tpm_stm_i2c_recv,
@@ -606,7 +582,6 @@ static struct tpm_vendor_specific st_i2c_tpm = {
        .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_canceled = tpm_st33_i2c_req_canceled,
-       .attr_group = &stm_tpm_attr_grp,
 };
 
 static int interrupts;
index 2ee43093066f2ac1d577932b41e264a01cf00612..ff064f08b48e81b8d4bccaab34575463b4a942d0 100644 (file)
@@ -403,33 +403,6 @@ static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status)
        return (status == 0);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated,
-                  NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
-static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
-
-static struct attribute *ibmvtpm_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       &dev_attr_durations.attr,
-       &dev_attr_timeouts.attr, NULL,
-};
-
-static struct attribute_group ibmvtpm_attr_grp = { .attrs = ibmvtpm_attrs };
-
 static const struct tpm_vendor_specific tpm_ibmvtpm = {
        .recv = tpm_ibmvtpm_recv,
        .send = tpm_ibmvtpm_send,
@@ -438,7 +411,6 @@ static const struct tpm_vendor_specific tpm_ibmvtpm = {
        .req_complete_mask = 0,
        .req_complete_val = 0,
        .req_canceled = tpm_ibmvtpm_req_canceled,
-       .attr_group = &ibmvtpm_attr_grp,
 };
 
 static const struct dev_pm_ops tpm_ibmvtpm_pm_ops = {
index c75c10ca2660365f7ddd6262aecb0eba1e27a092..9525be5c136c6adaf710b42280f88b36f637892c 100644 (file)
@@ -371,21 +371,6 @@ static u8 tpm_inf_status(struct tpm_chip *chip)
        return tpm_data_in(STAT);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-
-static struct attribute *inf_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       NULL,
-};
-
-static struct attribute_group inf_attr_grp = {.attrs = inf_attrs };
-
 static const struct tpm_vendor_specific tpm_inf = {
        .recv = tpm_inf_recv,
        .send = tpm_inf_send,
@@ -393,7 +378,6 @@ static const struct tpm_vendor_specific tpm_inf = {
        .status = tpm_inf_status,
        .req_complete_mask = 0,
        .req_complete_val = 0,
-       .attr_group = &inf_attr_grp,
 };
 
 static const struct pnp_device_id tpm_inf_pnp_tbl[] = {
index a4acac9008f7ab3d9a01c8fc206df458e14f22c2..ad980be553dc394cba60c8f49d30533513b7ae86 100644 (file)
@@ -232,21 +232,6 @@ static bool tpm_nsc_req_canceled(struct tpm_chip *chip, u8 status)
        return (status == NSC_STATUS_RDY);
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR|S_IWGRP, NULL, tpm_store_cancel);
-
-static struct attribute * nsc_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       NULL,
-};
-
-static struct attribute_group nsc_attr_grp = { .attrs = nsc_attrs };
-
 static const struct tpm_vendor_specific tpm_nsc = {
        .recv = tpm_nsc_recv,
        .send = tpm_nsc_send,
@@ -255,7 +240,6 @@ static const struct tpm_vendor_specific tpm_nsc = {
        .req_complete_mask = NSC_STATUS_OBF,
        .req_complete_val = NSC_STATUS_OBF,
        .req_canceled = tpm_nsc_req_canceled,
-       .attr_group = &nsc_attr_grp,
 };
 
 static struct platform_device *pdev = NULL;
index 46f57f5dda7d7e01988638e89548b6f4a8d8e7c7..a362edec58d4203bca97be880bd575a162f33d95 100644 (file)
@@ -432,35 +432,6 @@ static bool tpm_tis_req_canceled(struct tpm_chip *chip, u8 status)
        }
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated,
-                  NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
-static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
-
-static struct attribute *tis_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       &dev_attr_durations.attr,
-       &dev_attr_timeouts.attr, NULL,
-};
-
-static struct attribute_group tis_attr_grp = {
-       .attrs = tis_attrs
-};
-
 static struct tpm_vendor_specific tpm_tis = {
        .status = tpm_tis_status,
        .recv = tpm_tis_recv,
@@ -469,7 +440,6 @@ static struct tpm_vendor_specific tpm_tis = {
        .req_complete_mask = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_complete_val = TPM_STS_DATA_AVAIL | TPM_STS_VALID,
        .req_canceled = tpm_tis_req_canceled,
-       .attr_group = &tis_attr_grp,
 };
 
 static irqreturn_t tis_int_probe(int irq, void *dev_id)
index e3c7c01545151f8d813f62c681285e29bc97b2b8..d4f6b521344373a62c0b0e63f98365af00f0262a 100644 (file)
@@ -143,36 +143,6 @@ static int vtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
        return length;
 }
 
-static DEVICE_ATTR(pubek, S_IRUGO, tpm_show_pubek, NULL);
-static DEVICE_ATTR(pcrs, S_IRUGO, tpm_show_pcrs, NULL);
-static DEVICE_ATTR(enabled, S_IRUGO, tpm_show_enabled, NULL);
-static DEVICE_ATTR(active, S_IRUGO, tpm_show_active, NULL);
-static DEVICE_ATTR(owned, S_IRUGO, tpm_show_owned, NULL);
-static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated,
-               NULL);
-static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
-static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
-static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
-static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
-
-static struct attribute *vtpm_attrs[] = {
-       &dev_attr_pubek.attr,
-       &dev_attr_pcrs.attr,
-       &dev_attr_enabled.attr,
-       &dev_attr_active.attr,
-       &dev_attr_owned.attr,
-       &dev_attr_temp_deactivated.attr,
-       &dev_attr_caps.attr,
-       &dev_attr_cancel.attr,
-       &dev_attr_durations.attr,
-       &dev_attr_timeouts.attr,
-       NULL,
-};
-
-static struct attribute_group vtpm_attr_grp = {
-       .attrs = vtpm_attrs,
-};
-
 static const struct tpm_vendor_specific tpm_vtpm = {
        .status = vtpm_status,
        .recv = vtpm_recv,
@@ -181,7 +151,6 @@ static const struct tpm_vendor_specific tpm_vtpm = {
        .req_complete_mask = VTPM_STATUS_IDLE | VTPM_STATUS_RESULT,
        .req_complete_val  = VTPM_STATUS_IDLE | VTPM_STATUS_RESULT,
        .req_canceled      = vtpm_req_canceled,
-       .attr_group = &vtpm_attr_grp,
 };
 
 static irqreturn_t tpmif_interrupt(int dummy, void *dev_id)