Hi!

> > I'm going to commit this: ...it is slightly cleaned up version of
> > patch by Frank Seidel <fseidel <at> suse.de>; and it should allow
> > s2ram to work on thinkpad R50 or so. It needs rather new libpci so
> > update it if you see compile problem.
> 
> Yes, everybody with video problems, please test this one :-)

Yep.

> Frank's version of this was:
> 
> +struct pci_dev *find_vga(void)
> +{
> +       struct pci_dev *dev;
> +       struct pci_dev *result;
> +
> +       pci_scan_bus(pacc);     /* We want to get the list of devices */
> +
> +       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)
> +                result = NULL;
> +        else {
> +               /* save result */
> +               result = malloc(sizeof(*dev));
> +               if (result) {
> +                       memcpy(result, dev, sizeof(*dev));
> +                       result->next = NULL;
> +               }
> +        }
> +
> +       return result;
> +}
> 
> I am not good at this pointer and memory management stuff at all, i just
> know that Frank went through his version with valgrind and other
> stuff

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.

So I made sure allocation can _not_ fail. Plus my version is simpler.

                                                                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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to