Hi!
> > Well, Frank was wrong here for subtle reason, and I did not like it:
> >
> > If malloc failed (basically can not happen, but...) he'd suspend,
> > anyway, failing to restore PCI config at the exit, and bringing video
> > corruption back to us... Without knowing that pci save state failed.
> You are absolutly right, this wan't that nice. But it still could happen,
> that find_vga returns NULL (eventhoug of course this is now very unlikely)
> and furthermore we now have a second global variable for
> the same thing (global static pointer to global static struct).
>
> So, i did a further cleanup to this patch. This version has only one global
> struct for the vga_dev and terminates execution if vga_dev
> couldn't be found.
If you can get me version relative to current cvs,
> + for (dev=pacc->devices; dev; dev=dev->next) {
> + pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_CLASS);
> + if (dev->device_class == 0x300)
> + break;
> + }
> +
> + if (!dev)
> + return 1;
> +
> + memcpy(&vga_dev, dev, sizeof(*dev));
> + vga_dev.next = NULL;
> +
> + return 0;
Fix the whitespace damage here, and fix an error
convention... (find_vga suggests 1 or success... so either reverse the
logic, or better make it 0 / -ENOFOUND or something).
-171,6 +209,17 @@ int s2ram_hacks(void)
> printf("Calling radeon_cmd_light(0)\n");
> radeon_cmd_light(0);
> }
> + if (flags & PCI_SAVE) {
> + pacc = pci_alloc(); /* Get the pci_access structure */
> + pci_init(pacc); /* Initialize the PCI library */
> +
> + if (find_vga() == 0) {
> + printf("saving PCI config of device %02x:%02x.%d\n",
> + vga_dev.bus, vga_dev.dev, vga_dev.func);
> + save_vga_pci();
> + } else
> + return 1;
> + }
>
> return 0;
> }
And now we propagate error back. good.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures)
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel