Skip to content

Commit

Permalink
Merge branch 'pm-drivers'
Browse files Browse the repository at this point in the history
* pm-drivers:
  rtc-cmos: report wakeups from interrupt handler
  PM / crypto / ux500: Use struct dev_pm_ops for power management
  PM / IPMI: Remove empty legacy PCI PM callbacks
  tpm_nsc: Use struct dev_pm_ops for power management
  tpm_tis: Use struct dev_pm_ops for power management
  tpm_atmel: Use struct dev_pm_ops for power management
  PM / TPM: Drop unused pm_message_t argument from tpm_pm_suspend()
  omap-rng: Use struct dev_pm_ops for power management
  mg_disk: Use struct dev_pm_ops for power management
  msi-laptop: Use struct dev_pm_ops for power management
  hdaps: Use struct dev_pm_ops for power management
  sonypi: Use struct dev_pm_ops for power management
  intel_mid_thermal: Use struct dev_pm_ops for power management
  acer-wmi: Use struct dev_pm_ops for power management
  intel_ips: Remove empty legacy PM callbacks
  thinkpad_acpi: Use struct dev_pm_ops instead of legacy PM routines
  thinkpad_acpi: Drop pm_message_t arguments from suspend routines
  • Loading branch information
rjwysocki committed Jul 18, 2012
2 parents 6148d38 + b45bae3 commit bfaa07b
Show file tree
Hide file tree
Showing 18 changed files with 104 additions and 150 deletions.
13 changes: 7 additions & 6 deletions drivers/block/mg_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,9 @@ static const struct block_device_operations mg_disk_ops = {
.getgeo = mg_getgeo
};

static int mg_suspend(struct platform_device *plat_dev, pm_message_t state)
static int mg_suspend(struct device *dev)
{
struct mg_drv_data *prv_data = plat_dev->dev.platform_data;
struct mg_drv_data *prv_data = dev->platform_data;
struct mg_host *host = prv_data->host;

if (mg_wait(host, MG_STAT_READY, MG_TMAX_CONF_TO_CMD))
Expand All @@ -804,9 +804,9 @@ static int mg_suspend(struct platform_device *plat_dev, pm_message_t state)
return 0;
}

static int mg_resume(struct platform_device *plat_dev)
static int mg_resume(struct device *dev)
{
struct mg_drv_data *prv_data = plat_dev->dev.platform_data;
struct mg_drv_data *prv_data = dev->platform_data;
struct mg_host *host = prv_data->host;

if (mg_wait(host, MG_STAT_READY, MG_TMAX_CONF_TO_CMD))
Expand All @@ -825,6 +825,8 @@ static int mg_resume(struct platform_device *plat_dev)
return 0;
}

static SIMPLE_DEV_PM_OPS(mg_pm, mg_suspend, mg_resume);

static int mg_probe(struct platform_device *plat_dev)
{
struct mg_host *host;
Expand Down Expand Up @@ -1074,11 +1076,10 @@ static int mg_remove(struct platform_device *plat_dev)
static struct platform_driver mg_disk_driver = {
.probe = mg_probe,
.remove = mg_remove,
.suspend = mg_suspend,
.resume = mg_resume,
.driver = {
.name = MG_DEV_NAME,
.owner = THIS_MODULE,
.pm = &mg_pm,
}
};

Expand Down
13 changes: 7 additions & 6 deletions drivers/char/hw_random/omap-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,22 +162,24 @@ static int __exit omap_rng_remove(struct platform_device *pdev)

#ifdef CONFIG_PM

static int omap_rng_suspend(struct platform_device *pdev, pm_message_t message)
static int omap_rng_suspend(struct device *dev)
{
omap_rng_write_reg(RNG_MASK_REG, 0x0);
return 0;
}

static int omap_rng_resume(struct platform_device *pdev)
static int omap_rng_resume(struct device *dev)
{
omap_rng_write_reg(RNG_MASK_REG, 0x1);
return 0;
}

static SIMPLE_DEV_PM_OPS(omap_rng_pm, omap_rng_suspend, omap_rng_resume);
#define OMAP_RNG_PM (&omap_rng_pm)

#else

#define omap_rng_suspend NULL
#define omap_rng_resume NULL
#define OMAP_RNG_PM NULL

#endif

Expand All @@ -188,11 +190,10 @@ static struct platform_driver omap_rng_driver = {
.driver = {
.name = "omap_rng",
.owner = THIS_MODULE,
.pm = OMAP_RNG_PM,
},
.probe = omap_rng_probe,
.remove = __exit_p(omap_rng_remove),
.suspend = omap_rng_suspend,
.resume = omap_rng_resume
};

static int __init omap_rng_init(void)
Expand Down
16 changes: 0 additions & 16 deletions drivers/char/ipmi/ipmi_si_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2503,18 +2503,6 @@ static void __devexit ipmi_pci_remove(struct pci_dev *pdev)
cleanup_one_si(info);
}

#ifdef CONFIG_PM
static int ipmi_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
return 0;
}

static int ipmi_pci_resume(struct pci_dev *pdev)
{
return 0;
}
#endif

static struct pci_device_id ipmi_pci_devices[] = {
{ PCI_DEVICE(PCI_HP_VENDOR_ID, PCI_MMC_DEVICE_ID) },
{ PCI_DEVICE_CLASS(PCI_ERMC_CLASSCODE, PCI_ERMC_CLASSCODE_MASK) },
Expand All @@ -2527,10 +2515,6 @@ static struct pci_driver ipmi_pci_driver = {
.id_table = ipmi_pci_devices,
.probe = ipmi_pci_probe,
.remove = __devexit_p(ipmi_pci_remove),
#ifdef CONFIG_PM
.suspend = ipmi_pci_suspend,
.resume = ipmi_pci_resume,
#endif
};
#endif /* CONFIG_PCI */

Expand Down
13 changes: 7 additions & 6 deletions drivers/char/sonypi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,22 +1459,24 @@ static int __devexit sonypi_remove(struct platform_device *dev)
#ifdef CONFIG_PM
static int old_camera_power;

static int sonypi_suspend(struct platform_device *dev, pm_message_t state)
static int sonypi_suspend(struct device *dev)
{
old_camera_power = sonypi_device.camera_power;
sonypi_disable();

return 0;
}

static int sonypi_resume(struct platform_device *dev)
static int sonypi_resume(struct device *dev)
{
sonypi_enable(old_camera_power);
return 0;
}

static SIMPLE_DEV_PM_OPS(sonypi_pm, sonypi_suspend, sonypi_resume);
#define SONYPI_PM (&sonypi_pm)
#else
#define sonypi_suspend NULL
#define sonypi_resume NULL
#define SONYPI_PM NULL
#endif

static void sonypi_shutdown(struct platform_device *dev)
Expand All @@ -1486,12 +1488,11 @@ static struct platform_driver sonypi_driver = {
.driver = {
.name = "sonypi",
.owner = THIS_MODULE,
.pm = SONYPI_PM,
},
.probe = sonypi_probe,
.remove = __devexit_p(sonypi_remove),
.shutdown = sonypi_shutdown,
.suspend = sonypi_suspend,
.resume = sonypi_resume,
};

static struct platform_device *sonypi_platform_device;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ static struct tpm_input_header savestate_header = {
* 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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/tpm/tpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ extern ssize_t tpm_write(struct file *, const char __user *, size_t,
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 *);
Expand Down
12 changes: 2 additions & 10 deletions drivers/char/tpm/tpm_atmel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, msg);
}
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)
Expand Down
13 changes: 2 additions & 11 deletions drivers/char/tpm/tpm_nsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,13 @@ static void tpm_nsc_remove(struct device *dev)
}
}

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 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,
},
};

Expand Down
18 changes: 8 additions & 10 deletions drivers/char/tpm/tpm_tis.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,

static 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)
Expand Down Expand Up @@ -806,27 +806,25 @@ module_param_string(hid, tpm_pnp_tbl[TIS_HID_USR_IDX].id,
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, msg);
}

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;
Expand Down
39 changes: 19 additions & 20 deletions drivers/crypto/ux500/cryp/cryp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,27 +1661,26 @@ static void ux500_cryp_shutdown(struct platform_device *pdev)

}

static int ux500_cryp_suspend(struct platform_device *pdev, pm_message_t state)
static int ux500_cryp_suspend(struct device *dev)
{
int ret;
struct platform_device *pdev = to_platform_device(dev);
struct cryp_device_data *device_data;
struct resource *res_irq;
struct cryp_ctx *temp_ctx = NULL;

dev_dbg(&pdev->dev, "[%s]", __func__);
dev_dbg(dev, "[%s]", __func__);

/* Handle state? */
device_data = platform_get_drvdata(pdev);
if (!device_data) {
dev_err(&pdev->dev, "[%s]: platform_get_drvdata() failed!",
__func__);
dev_err(dev, "[%s]: platform_get_drvdata() failed!", __func__);
return -ENOMEM;
}

res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res_irq)
dev_err(&pdev->dev, "[%s]: IORESOURCE_IRQ, unavailable",
__func__);
dev_err(dev, "[%s]: IORESOURCE_IRQ, unavailable", __func__);
else
disable_irq(res_irq->start);

Expand All @@ -1692,32 +1691,32 @@ static int ux500_cryp_suspend(struct platform_device *pdev, pm_message_t state)

if (device_data->current_ctx == ++temp_ctx) {
if (down_interruptible(&driver_data.device_allocation))
dev_dbg(&pdev->dev, "[%s]: down_interruptible() "
"failed", __func__);
ret = cryp_disable_power(&pdev->dev, device_data, false);
dev_dbg(dev, "[%s]: down_interruptible() failed",
__func__);
ret = cryp_disable_power(dev, device_data, false);

} else
ret = cryp_disable_power(&pdev->dev, device_data, true);
ret = cryp_disable_power(dev, device_data, true);

if (ret)
dev_err(&pdev->dev, "[%s]: cryp_disable_power()", __func__);
dev_err(dev, "[%s]: cryp_disable_power()", __func__);

return ret;
}

static int ux500_cryp_resume(struct platform_device *pdev)
static int ux500_cryp_resume(struct device *dev)
{
int ret = 0;
struct platform_device *pdev = to_platform_device(dev);
struct cryp_device_data *device_data;
struct resource *res_irq;
struct cryp_ctx *temp_ctx = NULL;

dev_dbg(&pdev->dev, "[%s]", __func__);
dev_dbg(dev, "[%s]", __func__);

device_data = platform_get_drvdata(pdev);
if (!device_data) {
dev_err(&pdev->dev, "[%s]: platform_get_drvdata() failed!",
__func__);
dev_err(dev, "[%s]: platform_get_drvdata() failed!", __func__);
return -ENOMEM;
}

Expand All @@ -1730,11 +1729,10 @@ static int ux500_cryp_resume(struct platform_device *pdev)
if (!device_data->current_ctx)
up(&driver_data.device_allocation);
else
ret = cryp_enable_power(&pdev->dev, device_data, true);
ret = cryp_enable_power(dev, device_data, true);

if (ret)
dev_err(&pdev->dev, "[%s]: cryp_enable_power() failed!",
__func__);
dev_err(dev, "[%s]: cryp_enable_power() failed!", __func__);
else {
res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (res_irq)
Expand All @@ -1744,15 +1742,16 @@ static int ux500_cryp_resume(struct platform_device *pdev)
return ret;
}

static SIMPLE_DEV_PM_OPS(ux500_cryp_pm, ux500_cryp_suspend, ux500_cryp_resume);

static struct platform_driver cryp_driver = {
.probe = ux500_cryp_probe,
.remove = ux500_cryp_remove,
.shutdown = ux500_cryp_shutdown,
.suspend = ux500_cryp_suspend,
.resume = ux500_cryp_resume,
.driver = {
.owner = THIS_MODULE,
.name = "cryp1"
.pm = &ux500_cryp_pm,
}
};

Expand Down
Loading

0 comments on commit bfaa07b

Please sign in to comment.