lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201112062312.36498.rjw@sisk.pl>
Date:	Tue, 6 Dec 2011 23:12:36 +0100
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Amit Shah <amit.shah@...hat.com>
Cc:	Virtualization List <virtualization@...ts.linux-foundation.org>,
	Rusty Russell <rusty@...tcorp.com.au>,
	"Michael S. Tsirkin" <mst@...hat.com>, levinsasha928@...il.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 01/12] virtio: pci: switch to new PM API

Hi,

On Tuesday, December 06, 2011, Amit Shah wrote:
> The older PM API doesn't have a way to get notifications on hibernate
> events.  Switch to the newer one that gives us those notifications.
> 
> Signed-off-by: Amit Shah <amit.shah@...hat.com>
> ---
>  drivers/virtio/virtio_pci.c |   16 ++++++++++++----
>  1 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
> index 03d1984..23e1532 100644
> --- a/drivers/virtio/virtio_pci.c
> +++ b/drivers/virtio/virtio_pci.c
> @@ -708,19 +708,28 @@ static void __devexit virtio_pci_remove(struct pci_dev *pci_dev)
>  }
>  
>  #ifdef CONFIG_PM
> -static int virtio_pci_suspend(struct pci_dev *pci_dev, pm_message_t state)
> +static int virtio_pci_suspend(struct device *dev)
>  {
> +	struct pci_dev *pci_dev = to_pci_dev(dev);
> +
>  	pci_save_state(pci_dev);
>  	pci_set_power_state(pci_dev, PCI_D3hot);
>  	return 0;
>  }
>  
> -static int virtio_pci_resume(struct pci_dev *pci_dev)
> +static int virtio_pci_resume(struct device *dev)
>  {
> +	struct pci_dev *pci_dev = to_pci_dev(dev);
> +
>  	pci_restore_state(pci_dev);
>  	pci_set_power_state(pci_dev, PCI_D0);
>  	return 0;
>  }
> +
> +static const struct dev_pm_ops virtio_pci_pm_ops = {
> +	.suspend = virtio_pci_suspend,
> +	.resume  = virtio_pci_resume,
> +};
>  #endif

You seem to have forgotten about hibernation callbacks.  Please use
one the macros defined in include/linux/pm.h if you want to use the same
callback routines for hibernation.

>  static struct pci_driver virtio_pci_driver = {
> @@ -729,8 +738,7 @@ static struct pci_driver virtio_pci_driver = {
>  	.probe		= virtio_pci_probe,
>  	.remove		= __devexit_p(virtio_pci_remove),
>  #ifdef CONFIG_PM
> -	.suspend	= virtio_pci_suspend,
> -	.resume		= virtio_pci_resume,
> +	.driver.pm	= &virtio_pci_pm_ops,
>  #endif
>  };

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ