On Wed, Jan 10, 2007 at 09:01:12AM +0100, Pavel Machek wrote:
> 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 :-)

> diff -u -u -r1.45 s2ram.c
> --- s2ram.c   20 Sep 2006 16:23:51 -0000      1.45
> +++ s2ram.c   10 Jan 2007 07:59:05 -0000

> +static struct pci_dev vga_dev_s;
> +
> +struct pci_dev *find_vga(void)
> +{
> +     struct pci_dev *dev;
> +
> +     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)
> +                return NULL;
> +
> +     memcpy(&vga_dev_s, dev, sizeof(*dev));
> +     vga_dev_s.next = NULL;
> +     return &vga_dev_s;
> +}

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
just to make sure that the entangled pointer mess was not accidentally
freed behind our back. I assume that you know what you are doing here,
but there might actually have been a reason why Franks version was a bit
more clumsy. It might of course just be the result of the "evolution" of
this patch or some extra paranoia.
Frank, i would be grateful if you could double check Pavel's change just
to make sure everything is correct.

(Yes, we spent some time finding out what went wrong in my original
first try :-)
-- 
Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg  | "Well, surrounding them's out." 

-------------------------------------------------------------------------
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