tpm: device class for tpm
[deliverable/linux.git] / drivers / char / tpm / tpm-dev.c
index 356832146788ba139cc9c69ca48646dbb39eba6a..de0337ebd6585b7a68aeabdd297bd611474b1bee 100644 (file)
@@ -17,7 +17,6 @@
  * License.
  *
  */
-#include <linux/miscdevice.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 #include "tpm.h"
@@ -54,9 +53,8 @@ static void timeout_work(struct work_struct *work)
 
 static int tpm_open(struct inode *inode, struct file *file)
 {
-       struct miscdevice *misc = file->private_data;
-       struct tpm_chip *chip = container_of(misc, struct tpm_chip,
-                                            vendor.miscdev);
+       struct tpm_chip *chip =
+               container_of(inode->i_cdev, struct tpm_chip, cdev);
        struct file_priv *priv;
 
        /* It's assured that the chip will be opened just once,
@@ -173,7 +171,7 @@ static int tpm_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-static const struct file_operations tpm_fops = {
+const struct file_operations tpm_fops = {
        .owner = THIS_MODULE,
        .llseek = no_llseek,
        .open = tpm_open,
@@ -182,32 +180,4 @@ static const struct file_operations tpm_fops = {
        .release = tpm_release,
 };
 
-int tpm_dev_add_device(struct tpm_chip *chip)
-{
-       int rc;
 
-       chip->vendor.miscdev.fops = &tpm_fops;
-       if (chip->dev_num == 0)
-               chip->vendor.miscdev.minor = TPM_MINOR;
-       else
-               chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR;
-
-       chip->vendor.miscdev.name = chip->devname;
-       chip->vendor.miscdev.parent = chip->pdev;
-
-       rc = misc_register(&chip->vendor.miscdev);
-       if (rc) {
-               chip->vendor.miscdev.name = NULL;
-               dev_err(chip->pdev,
-                       "unable to misc_register %s, minor %d err=%d\n",
-                       chip->vendor.miscdev.name,
-                       chip->vendor.miscdev.minor, rc);
-       }
-       return rc;
-}
-
-void tpm_dev_del_device(struct tpm_chip *chip)
-{
-       if (chip->vendor.miscdev.name)
-               misc_deregister(&chip->vendor.miscdev);
-}
This page took 0.024525 seconds and 5 git commands to generate.