tpm/tpm_tis_synquacer: do some cleanup
Commit Message
Use devm_platform_ioremap_resource() to simplify code,
and remove unnecessary struct tpm_tis_synquacer_info.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
drivers/char/tpm/tpm_tis_synquacer.c | 39 +++++-----------------------
1 file changed, 6 insertions(+), 33 deletions(-)
@@ -14,16 +14,6 @@
#include "tpm.h"
#include "tpm_tis_core.h"
-/*
- * irq > 0 means: use irq $irq;
- * irq = 0 means: autoprobe for an irq;
- * irq = -1 means: no irq support
- */
-struct tpm_tis_synquacer_info {
- struct resource res;
- int irq;
-};
-
struct tpm_tis_synquacer_phy {
struct tpm_tis_data priv;
void __iomem *iobase;
@@ -91,42 +81,25 @@ static const struct tpm_tis_phy_ops tpm_tcg_bw = {
.write_bytes = tpm_tis_synquacer_write_bytes,
};
-static int tpm_tis_synquacer_init(struct device *dev,
- struct tpm_tis_synquacer_info *tpm_info)
+static SIMPLE_DEV_PM_OPS(tpm_tis_synquacer_pm, tpm_pm_suspend, tpm_tis_resume);
+
+static int tpm_tis_synquacer_probe(struct platform_device *pdev)
{
struct tpm_tis_synquacer_phy *phy;
+ struct device *dev = &pdev->dev;
phy = devm_kzalloc(dev, sizeof(struct tpm_tis_synquacer_phy), GFP_KERNEL);
if (phy == NULL)
return -ENOMEM;
- phy->iobase = devm_ioremap_resource(dev, &tpm_info->res);
+ phy->iobase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(phy->iobase))
return PTR_ERR(phy->iobase);
- return tpm_tis_core_init(dev, &phy->priv, tpm_info->irq, &tpm_tcg_bw,
+ return tpm_tis_core_init(dev, &phy->priv, -1, &tpm_tcg_bw,
ACPI_HANDLE(dev));
}
-static SIMPLE_DEV_PM_OPS(tpm_tis_synquacer_pm, tpm_pm_suspend, tpm_tis_resume);
-
-static int tpm_tis_synquacer_probe(struct platform_device *pdev)
-{
- struct tpm_tis_synquacer_info tpm_info = {};
- struct resource *res;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "no memory resource defined\n");
- return -ENODEV;
- }
- tpm_info.res = *res;
-
- tpm_info.irq = -1;
-
- return tpm_tis_synquacer_init(&pdev->dev, &tpm_info);
-}
-
static void tpm_tis_synquacer_remove(struct platform_device *pdev)
{
struct tpm_chip *chip = dev_get_drvdata(&pdev->dev);