Merge tag 'tty-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[cascardo/linux.git] / drivers / char / tpm / xen-tpmfront.c
index 441b44e..c3b4f5a 100644 (file)
@@ -175,9 +175,9 @@ static int setup_chip(struct device *dev, struct tpm_private *priv)
 {
        struct tpm_chip *chip;
 
-       chip = tpm_register_hardware(dev, &tpm_vtpm);
-       if (!chip)
-               return -ENODEV;
+       chip = tpmm_chip_alloc(dev, &tpm_vtpm);
+       if (IS_ERR(chip))
+               return PTR_ERR(chip);
 
        init_waitqueue_head(&chip->vendor.read_queue);
 
@@ -286,6 +286,7 @@ static int tpmfront_probe(struct xenbus_device *dev,
                const struct xenbus_device_id *id)
 {
        struct tpm_private *priv;
+       struct tpm_chip *chip;
        int rv;
 
        priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -302,21 +303,22 @@ static int tpmfront_probe(struct xenbus_device *dev,
 
        rv = setup_ring(dev, priv);
        if (rv) {
-               tpm_remove_hardware(&dev->dev);
+               chip = dev_get_drvdata(&dev->dev);
+               tpm_chip_unregister(chip);
                ring_free(priv);
                return rv;
        }
 
        tpm_get_timeouts(priv->chip);
 
-       return rv;
+       return tpm_chip_register(priv->chip);
 }
 
 static int tpmfront_remove(struct xenbus_device *dev)
 {
        struct tpm_chip *chip = dev_get_drvdata(&dev->dev);
        struct tpm_private *priv = TPM_VPRIV(chip);
-       tpm_remove_hardware(&dev->dev);
+       tpm_chip_unregister(chip);
        ring_free(priv);
        TPM_VPRIV(chip) = NULL;
        return 0;