PM / TPM: Convert platform TPM drivers to PM handling based on struct dev_pm_ops
Subsystems (2)
cover PM / TPM: Convert platform TPM drivers to PM handling based on struct dev_pm_ops
Hi all,
As per
http://marc.info/?l=linux-kernel&m=133996733422413&w=4
the following patches convert the platform TPM drivers to the PM handling based on struct dev_pm_ops:
[1/4] Drop the (unused) pm_message_t argument of tpm_pm_suspend(). [2/4] tpm_atmel: Use struct dev_pm_ops for power management. [3/4] tpm_tis: Use struct dev_pm_ops for power management. [4/4] tpm_nsc: Use struct dev_pm_ops for power management.
Thanks,
Rafael
PATCH 1/4 PM / TPM: Drop unused pm_message_t argument from tpm_pm_suspend()
From: Rafael J. Wysocki <[email protected]>
The tpm_pm_suspend()'s second argument of type pm_message_t is not used, so remove it.
--- drivers/char/tpm/tpm.c | 2 +- drivers/char/tpm/tpm.h | 2 +- drivers/char/tpm/tpm_atmel.c | 2 +- drivers/char/tpm/tpm_nsc.c | 2 +- drivers/char/tpm/tpm_tis.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/char/tpm/tpm.h +1 -1
@@ -299,7 +299,7 @@ extern ssize_t tpm_write(struct file *, loff_t *);extern ssize_t tpm_read (struct file *,char __user *,size_t ,loff_t *);extern void tpm_remove_hardware (struct device *); -extern int tpm_pm_suspend (struct device *,pm_message_t ); +extern int tpm_pm_suspend (struct device *);extern int tpm_pm_resume (struct device *);extern int wait_for_tpm_stat (struct tpm_chip *,u8 ,unsigned long ,wait_queue_head_t *);
drivers/char/tpm/tpm_atmel.c +1 -1
@@ -170,7 +170,7 @@ static void atml_plat_remove(void)static int tpm_atml_suspend (struct platform_device *dev,pm_message_t msg) { -return tpm_pm_suspend (&dev->dev, msg); +return tpm_pm_suspend (&dev->dev); }static int tpm_atml_resume (struct platform_device *dev)
drivers/char/tpm/tpm_tis.c +2 -2
@@ -750,7 +750,7 @@ static int __devinit tpm_tis_pnp_init(ststatic int tpm_tis_pnp_suspend (struct pnp_dev *dev,pm_message_t msg) { -return tpm_pm_suspend (&dev->dev, msg); +return tpm_pm_suspend (&dev->dev); }static int tpm_tis_pnp_resume (struct pnp_dev *dev)
@@ -808,7 +808,7 @@ MODULE_PARM_DESC(hid, "Set additional sp#endif static int tpm_tis_suspend (struct platform_device *dev,pm_message_t msg) { -return tpm_pm_suspend (&dev->dev, msg); +return tpm_pm_suspend (&dev->dev); }static int tpm_tis_resume (struct platform_device *dev)
drivers/char/tpm/tpm_nsc.c +1 -1
@@ -276,7 +276,7 @@ static void tpm_nsc_remove(struct devicestatic int tpm_nsc_suspend (struct platform_device *dev,pm_message_t msg) { -return tpm_pm_suspend (&dev->dev, msg); +return tpm_pm_suspend (&dev->dev); }static int tpm_nsc_resume (struct platform_device *dev)
drivers/char/tpm/tpm.c +1 -1
@@ -1274,7 +1274,7 @@ static struct tpm_input_header savestate* We are about to suspend. Save the TPM state * so that it can be restored. */ -int tpm_pm_suspend (struct device *dev,pm_message_t pm_state) +int tpm_pm_suspend (struct device *dev) {struct tpm_chip *chip =dev_get_drvdata (dev);struct tpm_cmd_t cmd;
PATCH 2/4 tpm_atmel: Use struct dev_pm_ops for power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Make the tpm_atmel driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver.
This allows the driver to use tpm_pm_suspend() and tpm_pm_resume() as its PM callbacks directly, without defining its own PM callback routines.
--- drivers/char/tpm/tpm_atmel.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/char/tpm/tpm_atmel.c +2 -10
@@ -168,22 +168,14 @@ static void atml_plat_remove(void) } } -static int tpm_atml_suspend (struct platform_device *dev,pm_message_t msg) -{ -return tpm_pm_suspend (&dev->dev); -} +static SIMPLE_DEV_PM_OPS(tpm_atml_pm, tpm_pm_suspend, tpm_pm_resume); -static int tpm_atml_resume (struct platform_device *dev) -{ -return tpm_pm_resume (&dev->dev); -}static struct platform_driver atml_drv = { .driver = { .name ="tpm_atmel" , .owner =THIS_MODULE , + .pm = &tpm_atml_pm, }, - .suspend = tpm_atml_suspend, - .resume = tpm_atml_resume, };static int __init init_atmel (void )
PATCH 3/4 tpm_tis: Use struct dev_pm_ops for power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Make the tpm_tis driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver.
This allows the driver to use tpm_pm_suspend() as its suspend callback directly, without defining its own suspend callback routine.
--- drivers/char/tpm/tpm_tis.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/char/tpm/tpm_tis.c +7 -9
@@ -806,27 +806,25 @@ module_param_string(hid, tpm_pnp_tbl[TIS sizeof(tpm_pnp_tbl[TIS_HID_USR_IDX].id), 0444);MODULE_PARM_DESC (hid,"Set additional specific HID for this driver to probe" );#endif -static int tpm_tis_suspend (struct platform_device *dev,pm_message_t msg) -{ -return tpm_pm_suspend (&dev->dev); -} -static int tpm_tis_resume (struct platform_device *dev) +static int tpm_tis_resume (struct device *dev) { -struct tpm_chip *chip =dev_get_drvdata (&dev->dev); +struct tpm_chip *chip =dev_get_drvdata (dev);if (chip->vendor.irq)tpm_tis_reenable_interrupts (chip); -return tpm_pm_resume (&dev->dev); +return tpm_pm_resume (dev); } + +static SIMPLE_DEV_PM_OPS(tpm_tis_pm, tpm_pm_suspend, tpm_tis_resume); +static struct platform_driver tis_drv = { .driver = { .name ="tpm_tis" , .owner =THIS_MODULE , + .pm = &tpm_tis_pm, }, - .suspend = tpm_tis_suspend, - .resume = tpm_tis_resume, };static struct platform_device *pdev;
PATCH 4/4 tpm_nsc: Use struct dev_pm_ops for power management
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Make the tpm_nsc driver define its PM callbacks through a struct dev_pm_ops object rather than by using legacy PM hooks in struct platform_driver.
This allows the driver to use tpm_pm_suspend() and tpm_pm_resume() as its PM callbacks directly, without defining its own PM callback routines.
--- drivers/char/tpm/tpm_nsc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/char/tpm/tpm_nsc.c +2 -11
@@ -274,22 +274,13 @@ static void tpm_nsc_remove(struct device } } -static int tpm_nsc_suspend (struct platform_device *dev,pm_message_t msg) -{ -return tpm_pm_suspend (&dev->dev); -} - -static int tpm_nsc_resume (struct platform_device *dev) -{ -return tpm_pm_resume (&dev->dev); -} +static SIMPLE_DEV_PM_OPS(tpm_nsc_pm, tpm_pm_suspend, tpm_pm_resume);static struct platform_driver nsc_drv = { - .suspend = tpm_nsc_suspend, - .resume = tpm_nsc_resume, .driver = { .name ="tpm_nsc" , .owner =THIS_MODULE , + .pm = &tpm_nsc_pm, }, };