Re: [patch, rft] amd74xx: implement suspend-to-ram

Pavel Machek
2006-07-25T23:09:55Z

Hi!

I do not have the affected hardware, sorry.

> Index: linux-2.6.18-rc2-git1/drivers/ide/pci/amd74xx.c
> ===================================================================
> --- linux-2.6.18-rc2-git1.orig/drivers/ide/pci/amd74xx.c
> +++ linux-2.6.18-rc2-git1/drivers/ide/pci/amd74xx.c
> @@ -494,6 +498,53 @@
> /* 19 */ DECLARE_AMD_DEV("AMD5536"),
> };
>
> +static int amd74xx_suspend(struct pci_dev *dev, pm_message_t state)
> +{
> + pci_save_state(dev);
> +
> + // PM_EVENT_SUSPEND means s2ram. otherwise, the disk behind this device
> + // might hold the s2disk image, and we can't disable the disk
> + // controller until we've used it to write that out.

C-style comments, please.

> + if(state.event == PM_EVENT_SUSPEND) {

"if (". Ouch and please don't do this. Suspend-to-disk will call
amd74xx_resume when it needs to talk to the disk.

> + pci_disable_device(dev);
> + pci_set_power_state(dev, pci_choose_state(dev, state));
> + }
> + return 0;
> +}

Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html