Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127622
b: refs/heads/master
c: 09f50c9
h: refs/heads/master
v: v3
  • Loading branch information
David Smith authored and Linus Torvalds committed Jan 8, 2009
1 parent 07d9f56 commit 1839a43
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad8f07ccaddca1b0f52d0e9677855122a46cfafc
refs/heads/master: 09f50c95425318232c534d931d8c28b96a3ce2c5
35 changes: 22 additions & 13 deletions trunk/drivers/char/tpm/tpm_nsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,23 @@ static void tpm_nsc_remove(struct device *dev)
}
}

static struct device_driver nsc_drv = {
.name = "tpm_nsc",
.bus = &platform_bus_type,
.owner = THIS_MODULE,
.suspend = tpm_pm_suspend,
.resume = tpm_pm_resume,
static int tpm_nsc_suspend(struct platform_device *dev, pm_message_t msg)
{
return tpm_pm_suspend(&dev->dev, msg);
}

static int tpm_nsc_resume(struct platform_device *dev)
{
return tpm_pm_resume(&dev->dev);
}

static struct platform_driver nsc_drv = {
.suspend = tpm_nsc_suspend,
.resume = tpm_nsc_resume,
.driver = {
.name = "tpm_nsc",
.owner = THIS_MODULE,
},
};

static int __init init_nsc(void)
Expand All @@ -297,7 +308,7 @@ static int __init init_nsc(void)
return -ENODEV;
}

err = driver_register(&nsc_drv);
err = platform_driver_register(&nsc_drv);
if (err)
return err;

Expand All @@ -308,17 +319,15 @@ static int __init init_nsc(void)
/* enable the DPM module */
tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01);

pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
pdev = platform_device_alloc("tpm_nscl0", -1);
if (!pdev) {
rc = -ENOMEM;
goto err_unreg_drv;
}

pdev->name = "tpm_nscl0";
pdev->id = -1;
pdev->num_resources = 0;
pdev->dev.driver = &nsc_drv.driver;
pdev->dev.release = tpm_nsc_remove;
pdev->dev.driver = &nsc_drv;

if ((rc = platform_device_register(pdev)) < 0)
goto err_free_dev;
Expand Down Expand Up @@ -377,7 +386,7 @@ static int __init init_nsc(void)
err_free_dev:
kfree(pdev);
err_unreg_drv:
driver_unregister(&nsc_drv);
platform_driver_unregister(&nsc_drv);
return rc;
}

Expand All @@ -390,7 +399,7 @@ static void __exit cleanup_nsc(void)
pdev = NULL;
}

driver_unregister(&nsc_drv);
platform_driver_unregister(&nsc_drv);
}

module_init(init_nsc);
Expand Down

0 comments on commit 1839a43

Please sign in to comment.