aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_nsc.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index ab18c1e7b115..70efba2ee053 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -273,12 +273,23 @@ static void tpm_nsc_remove(struct device *dev)
273 } 273 }
274} 274}
275 275
276static struct device_driver nsc_drv = { 276static int tpm_nsc_suspend(struct platform_device *dev, pm_message_t msg)
277 .name = "tpm_nsc", 277{
278 .bus = &platform_bus_type, 278 return tpm_pm_suspend(&dev->dev, msg);
279 .owner = THIS_MODULE, 279}
280 .suspend = tpm_pm_suspend, 280
281 .resume = tpm_pm_resume, 281static int tpm_nsc_resume(struct platform_device *dev)
282{
283 return tpm_pm_resume(&dev->dev);
284}
285
286static struct platform_driver nsc_drv = {
287 .suspend = tpm_nsc_suspend,
288 .resume = tpm_nsc_resume,
289 .driver = {
290 .name = "tpm_nsc",
291 .owner = THIS_MODULE,
292 },
282}; 293};
283 294
284static int __init init_nsc(void) 295static int __init init_nsc(void)
@@ -297,7 +308,7 @@ static int __init init_nsc(void)
297 return -ENODEV; 308 return -ENODEV;
298 } 309 }
299 310
300 err = driver_register(&nsc_drv); 311 err = platform_driver_register(&nsc_drv);
301 if (err) 312 if (err)
302 return err; 313 return err;
303 314
@@ -308,17 +319,15 @@ static int __init init_nsc(void)
308 /* enable the DPM module */ 319 /* enable the DPM module */
309 tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01); 320 tpm_write_index(nscAddrBase, NSC_LDC_INDEX, 0x01);
310 321
311 pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL); 322 pdev = platform_device_alloc("tpm_nscl0", -1);
312 if (!pdev) { 323 if (!pdev) {
313 rc = -ENOMEM; 324 rc = -ENOMEM;
314 goto err_unreg_drv; 325 goto err_unreg_drv;
315 } 326 }
316 327
317 pdev->name = "tpm_nscl0";
318 pdev->id = -1;
319 pdev->num_resources = 0; 328 pdev->num_resources = 0;
329 pdev->dev.driver = &nsc_drv.driver;
320 pdev->dev.release = tpm_nsc_remove; 330 pdev->dev.release = tpm_nsc_remove;
321 pdev->dev.driver = &nsc_drv;
322 331
323 if ((rc = platform_device_register(pdev)) < 0) 332 if ((rc = platform_device_register(pdev)) < 0)
324 goto err_free_dev; 333 goto err_free_dev;
@@ -377,7 +386,7 @@ err_unreg_dev:
377err_free_dev: 386err_free_dev:
378 kfree(pdev); 387 kfree(pdev);
379err_unreg_drv: 388err_unreg_drv:
380 driver_unregister(&nsc_drv); 389 platform_driver_unregister(&nsc_drv);
381 return rc; 390 return rc;
382} 391}
383 392
@@ -390,7 +399,7 @@ static void __exit cleanup_nsc(void)
390 pdev = NULL; 399 pdev = NULL;
391 } 400 }
392 401
393 driver_unregister(&nsc_drv); 402 platform_driver_unregister(&nsc_drv);
394} 403}
395 404
396module_init(init_nsc); 405module_init(init_nsc);